Jump to content

Coding Style Checker


dimaj

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...