dimaj Posted October 7, 2010 Share Posted October 7, 2010 Hey guys! I was wondering if anyone know of a quick way to check if a code file conform with some coding guidelines. Those guidelines will include: - variable and method naming style - function length (column-wise and row-wise) - spacing for indentation For example, if I have a function that is name: myfirstfunction, style checker would give an error because proper name should be MyFirstFunction. If I indented my code 5 spaces, it would give me an error because indentation should be 4 spaces, etc. Any ideas are welcomed :) Thanks. dimaj Quote Link to comment Share on other sites More sharing options...
Sparda Posted October 7, 2010 Share Posted October 7, 2010 Function names often use camel casing. But uurmm... coding styles makes use of natural language, so it is difficult for a program to analyze code for natural language errors. You'd basically need to combine a spelling and grammar checker with a syntactic checker adding in additional stuff for white space checking and other stuff. An example where it could mess up, the words old and ling are also another word when put together without changing the spelling (oldling). Thus both runOldling and run runOldLing are valid camel case names. Only way to ensure complete accuracy: read it our self. Similarly, functions name may not merit camel casing for one reason or another (e.g. trainspotter). Basic checks can be done autonomously though but won't be very accurate. Quote Link to comment Share on other sites More sharing options...
Phil K. Posted October 11, 2010 Share Posted October 11, 2010 Hey guys! I was wondering if anyone know of a quick way to check if a code file conform with some coding guidelines. Those guidelines will include: - variable and method naming style - function length (column-wise and row-wise) - spacing for indentation For example, if I have a function that is name: myfirstfunction, style checker would give an error because proper name should be MyFirstFunction. If I indented my code 5 spaces, it would give me an error because indentation should be 4 spaces, etc. Any ideas are welcomed :) Thanks. dimaj I think what you are looking for is something like this: http://www.jetbrains.com/resharper/ Though its not a general tool. Its for C# and VB.net Quote Link to comment Share on other sites More sharing options...
dimaj Posted October 11, 2010 Author Share Posted October 11, 2010 Hey guys! Thanks for your replies. well... I guess the naming conventions is hard to test for. However, you can still test if a function or a variable starts with an upper case or a lower case letter. I guess, I'm looking for something like this: Codestyle Checker... I'll see if I can read that code and maybe change it up a bit to work with JScript. Thanks! dimaj Quote Link to comment Share on other sites More sharing options...
Netshroud Posted October 12, 2010 Share Posted October 12, 2010 Different languages also have different guidelines. For example, while good C coding limits lines to 80 characters, Objective-C throws that rule straight out the window. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.