Keep your code healthy


More Rules

Attention: SSW Developers

TODO:

  • Sumesh(with Joe's help) to make this page driven by a sharepoint list
  • The rules will need a tag "In Code Auditor" (then they show the yellow box)
  • The grid on this page will then be List (where InCodeAuditor=True, Order By Popularity)

After that same for Link Auditor, then SQL Auditor

Internet Explorer WEB - HTML

  1. Anchor Name can't start with #
  2. Anchor names must be valid
  3. CSS stylesheets must specify a font (you should never use Times New Roman)
  4. Do not use META tags to redirect
  5. Always close quotations of HTML attributes. See Do you close quotations of all your html attributes? for more details.
  6. Empty tags must not exist (except server tags, SCRIPT or TD)
  7. FONT tags must not be used
  8. Google Alt Or Title in Image Tag
  9. Google File Size Limit
  10. Google Relevancy
  11. Google URL Case Sensitive
  12. Heading tags should not contain bold or strong tags
  13. No absolute paths or direct external links
  14. No UNC in HTML Link
  15. Page must contain META description
  16. Page must contain META keywords
  17. Page must have a TITLE tag
  18. Page must not link to the same URL twice. See Do you only have one link to the same page per page? for more details.
  19. Page must reference a CSS stylesheet
  20. Special characters must be encoded
  21. Specify shortcut icon "favicon.ico" at the site level. See Where do you store your favicon.ico file? for more details.
  22. Table tags should not specify the width
  23. Times New Roman should not be used
  24. TITLE tag must exist
  25. No non ASCII characters
  26. CSS stylesheets must have DocType to display accurately across all browsers. See Do you use DocType in Web Pages while using CSS style sheets? for more details.
  27. Links for reading back through data should use "< Back" instead of "< Previous" or other variations. See Do you use "< Back" instead of "< Previous" or other variations? for more details.
  28. "Return to" links should not be used for inter-page navigation. See Do you leave your users Bread Crumbs instead of "Return to" links? for more details.
  29. Width of images in web pages must not be more than 600 pixels. See Printing: Do you check for oversized images and table? for more details.
  30. Images referenced in your page should be inside an Images folder. See Do you put all images in your image folder? for more details.

Internet Explorer WEB - ASPX

  1. Don't use listboxes. See Do you use Combo Boxes instead of single-select List Boxes? and Do you use Checked List Boxes instead of multi-select List Boxes? for more details.
  2. Don't use server controls image paths
  3. Windows must not be opened from a function that is called by the OnLoad event
  4. Windows must not be opened in the OnLoad event
  5. Do not put debug attributes on page. See Do you put debug information on page? for more details.

C Sharp Dot Net C#

  1. All Buttons (except OK and Cancel), CheckBoxes, RadioButtons must have mnemonics. Look at Do your buttons have a mnemonic? for more details.
  2. AssemblyInfo.cs must have AssemblyVersion attribute
  3. Boolean Properties must be prefixed by a verb
  4. Buttons, CheckBoxes, GroupBoxes, Labels & RadioButtons must have System FlatStyle. Look at Do you have consistent look on your buttons? for more details.
  5. CenterParent must be used with FixedDialog
  6. CenterScreen must be used with FixedSingle
  7. Exception variables should be called ex
  8. Exception should be caught more precise. Look at Do you catch exception more precise? for more details.
  9. FixedDialog must be used with CenterParent
  10. FixedSingle must be used with CenterScreen
  11. If statement must have braces
  12. EnableVisualStyles must not be used, should include manifest file. Look at Do your applications support XP themes? for more details.
  13. No empty catch blocks
  14. No variable name with the same class name.
  15. OK and Cancel buttons should not have mnemonics
  16. SQL stored procedure names should be prefixed with the owner (dbo). Look at Do you always prefix SQL stored procedure names with the owner? for more details.
  17. String literals containing file paths should be @-quoted
  18. Windows Forms should use Tahoma Font
  19. WinExe Must have MainForm
  20. Don't use hard coded connection string. Look at Do you hard coded your connection string?  for more details.
  21. Button heights must be 23 pixels.
  22. Use Standard width for Date control. Look at Do you make common control with certain width? for more details.
  23. Use Standard width for  Ellipsis button. Look at Do you make common control with certain width? for more details.
  24. Use .Net naming standard. See Commonly used variables for more details.
  25. Message box title must be the application's product name and version only.  See Do you know how to make message boxes user friendly? for more details.

VB Dot NET VB.NET

  1. All Buttons (except OK and Cancel), CheckBoxes, RadioButtons must have mnemonics. Look at Do your buttons have a mnemonic? for more details.
  2. AssemblyInfo.vb must have AssemblyVersion attribute
  3. Boolean Properties must be prefixed by a verb
  4. Buttons, CheckBoxes, GroupBoxes, Labels & RadioButtons must have System FlatStyle. Look at Do you have consistent look on your buttons? for more details.
  5. CenterParent must be used with FixedDialog
  6. CenterScreen must be used with FixedSingle
  7. Do not re-throw exceptions?. See Do you re-throw your exceptions? for more details
  8. FixedDialog must be used with CenterParent
  9. FixedSingle must be used with CenterScreen
  10. EnableVisualStyles must not be used, should include manifest file. Look at Do your applications support XP themes? for more details.
  11. Exception should be caught more precise
  12. No Empty Catch Blocks. See Do you have meaningless Catch blocks in your applications? for more details.
  13. Open In Try Block
  14. Option Explicit must not be off. See Do you always use Option Explicit? for more details.
  15. Project must Option Strict On
  16. SQL stored procedure names should be prefixed with the owner. See Do you always prefix SQL stored procedure names with the owner? for more details.
  17. String variables must have the str prefix
  18. Windows Forms should use Tahoma Font. See Do you use Microsoft Recommended Font in your Application? for more details.
  19. WinExe Must have MainForm
  20. Button heights must be 23 pixels
  21. Do not use CreateObject() for COM. See Do you use interoperability mechanism for COM object? for more details.
  22. Windows applications must have a MainForm or WizardPage. See Do you have a MainForm in your Windows application? for more details.
  23. Use .Net naming standard. See Commonly used variables for more details.
  24. Do not put Exit Sub just before End Sub. See Do you put Exit Sub before End Sub? for more details.
  25. Message box title must be the application's product name and version only. See Do you know how to make message boxes user friendly? for more details

DOT NET Logo VB.NET & C#

  1. All "OK" button should be renamed to an Action point. See Do you name all your "OK" buttons to be an Action eg. Save, Open etc? for more details.
  2. CancelButton must be called Cancel
  3. Controls must be less than (800,600). See Does your application's interface fit in the screen under any resolutions? for more details.
  4. Don't use listboxes. See Control Choice - Do you use Combo Boxes instead of single-select List Boxes? for more details.
  5. Forms which have buttons must have a CancelButton. See Do your form have Accept and Cancel Button? for more details.
  6. Forms which have buttons must have an AcceptButton
  7. Greater than/less than operators should not be used on integer/decimal literals (use >=)
  8. MessageBoxes must have icons
  9. Ok is not OK
  10. TextAlign should be TopLeft or MiddleLeft
  11. No non ASCII characters
  12. Use more descriptive variable names at least 3 letters
  13. Never use empty string like this "", use String.Empty. See Do you use String.Empty instead of ""? for more details.
  14. Not to Release in Debug mode. See Do you release your product in release mode? for more details
  15. Windows form name should not start with frm. See Do you use more meaningful names than Hungarian short form? for more details.
  16. Windows Form should have a minimum size to avoid unexpected UI behavior. See Do you keep a minimum size in the window forms? for more details.
  17. TimeSpan.Parse() function must be used with FormatTimeSpanString() to pre-format the time-string parameter. See Do you pre-format your time strings before using TimeSpan.Parse()? for more details.

VB Dot NET VB 6.0

  1. Standard Button must be 23 pixels in height. See Do you make your buttons 23 pixels in height? for more details.
  2. Option Explicit must be on. See Do you always use Option Explicit? for more details.

SQL Server Scripts

  1. Do you avoid using the FILENAME parameter of CREATE DATABASE? See Do you create new databases in the default data directory? for more details.

How is Code Auditor able to work on Access .mdbs and .adps?

We convert all forms, reports and modules to text or .vb files.

Once you installed SSW Code Auditor, try our sample from <Installation Path>\SSW Code Auditor\Samples\NorthwindAccess2003

  Access 2003

  1. OnError Goto Statements should not be used. See Do you use OnError Goto Statements? for more details.

Folder File Structure

  1. .BMP Files must not exist
  2. Images should be in the images directory. Look at Do you put all images in your image folder? for more details.
  3. No BAK Files
  4. There must not be any zz-ed files
  5. Images Folder can only contain Image Files
  6. Always include setup files in setup folder. Look at Do you put setup files in setup folder? for more details.

text screen shot All Text Files

  1. No carriage returns without line feed
  2. Spelling in American standards
  3. Non ASCII characters must not exist. Look at Do you check for funny apostrophes? for more details.
  4. Email is not Email. Look at Do you know email should be email without the hyphen? for more details.

Reporting Services Reporting Services

I'm Sold... What's next?