truyet / hotween

Automatically exported from code.google.com/p/hotween
0 stars 1 forks source link

Coding style + fixes #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Your coding style is really outdated and forces a user to manually format many 
things instead of using Visual Studios / Resharpers Auto-formatting.

Attached patch fixes many issues Resharper was pointing out:
- sorted usings and removed unused usings
- moved declaration into inner loop
- used as instead of is and then as (performance improvement because as already 
checks if its null and if it is the correct type)
- used direct typecasting instead of as if variable is used without null check
- made functions static where possible
- made two functions protected within an abstract class because those can never 
be initialized directly
- made some properties readonly which are only set in constructor
- removed redundant prefix like this. or base.
- removed redundant else (especially after return)

Original issue reported on code.google.com by stfxm...@gmail.com on 28 Mar 2012 at 10:14

Attachments:

GoogleCodeExporter commented 9 years ago
Also you should never use TABS but rather 4 spaces for open source projects 
because TABS are interpreted differently on mac linux and windows. This 
behaviour can be changed in VS ... 
tools->options->text-editor->c#->tabs->insert spaces.

Additionally you should remove trailing whitespaces where possible with this 
regex: [ \t]+$

Original comment by stfxm...@gmail.com on 28 Mar 2012 at 10:18

GoogleCodeExporter commented 9 years ago
Patch applied, now to apply spaces and remove trailing whitespaces.

Original comment by daniele....@gmail.com on 29 Mar 2012 at 12:12

GoogleCodeExporter commented 9 years ago
Uhm, couldn't find any triling whitespaces with that regex. Nor have I a way to 
change all TABS into spaces for an existing project (with MonoDevelop at least).

Original comment by daniele....@gmail.com on 29 Mar 2012 at 12:27

GoogleCodeExporter commented 9 years ago
use notepad++ to replace /t (need to enable extended search mode) with 4 spaces 
for all *.cs files in your project path (CTRL+SHIFT+F). then switch to regular 
expression mode and replace [ \t]+$ with an empty string ;)

Original comment by stfxm...@gmail.com on 29 Mar 2012 at 10:53

GoogleCodeExporter commented 9 years ago
Added in r149 + r151

Original comment by stfxm...@gmail.com on 31 Mar 2012 at 12:48