Code standards review with RegEx

On our project we use Macroview to visualise and edit data. The script that drives the proces is subject to our definition of done code standards. A review of the script is a time consuming activity that is leading to frustration in our team. Time to get some tooling support.

First we looked at StyleCop and other static code analysis tools. Since the script language isn’t widely used no of-the-shelve solution was found. We did stumble upon a tool that seemed to use regular expressions. This was an idea worth exploring.

We have a full license to EditPad Pro. This rich text editor has the ability to search with regular expressions. When a match is found, the text is highlighted. In an hour or two we developed some expressions that can be divided in three groups:

  1. Highlight blocks, used to view comment blocks

    regex-codereview-highlight-blocks-comments

    Comment blocks to inspect

  2. Highlight correct, correct used and spelled keywords are highlighted, this was abnormalities are found easy (not highlighted)

    regex-codereview-hightlight-correct-keywords

    Correct cased keywords

  3. Find defects, negative search used for explicit rules, highlighted items are wrong

    regex-codereview-highlight-wrong-naming

    Wrong prefix in name

Using the list of regular expressions sped up the code review and made it more reliable. The code quality has gone up and new code is quickly reviewed. One up for regular expressions. 1up

About erictummers

My work as a recruited developer changes almost every month. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development, Tooling and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s