Indentor

Indentor is a dll that I have created to indent the source code according to some widely accepted convensions. It is too irritating to debug a code if your code is not properly aligned and indented.
Don't worry. Now, write the code in any way you want and let the Indentor to think and decide how your code should look like.

Many editors these days provides the facility to indent your code easily and indenting the code is not at all a problem. The problem comes when you have downloaded an unindented code or the code which is indented using other coding standards. To indent all your code in just a mouse click saves a lot of time. So, I created the application and want to share with you.

Coding Conventions and Indentation rules:

  • For all the blocks of if, else, for, while and do-while, opening brace should lie immediately below these keywords.
  • All the statements within "{" and "}" should be indented one tab right.
  • If there only a single statement within if, else, while, for, etc. Then, That statement should be indented one tab right from the keyword.
  • A blank line should be inserted before and after every every function.
  • Two consecutive lines should never be blank.
  • The space must be given before binary operators like +, -, *, /, <, >, =, !=, >=, <=, &&, ||, ==, etc.
  • Unary operators usually don't have spaces before and after untill followed by a binary operator. So, operators like ++, --, ->, ., etc should be handled properly.
  • There should have no space before any comma, "," and "?" but must have a space after it.
  • There should not be any space before or after parenthesis: "(", ")".
  • In switch block, all the cases should be indented one tab right from the opening switch brace and the code within case should be further indented one tab right from the case.
  • Inline comments should start two space after the end of the code for that line.
  • Developer can write anything in any way within the comment. So, anything within comment should not be touched.