rkb
rkb

Reputation: 11231

How do I enforce coding standards?

I want to write a script to enforce some rules on the code of my team.

For example, in our code standards all of the member variables and private functions should start with an underscore:

class A{
private:
    int _count;
    float _amount;
    void _increment_count(){ ++_count; }
}

So I want to throw some warning or error or some sort of message for this class if the variables are declared as follows.

class A{
private:
    int count;
    float amount;
    void increment_count(){ ++_count; }
}

I want to write a script that -- when run with this program as the argument -- will show the respective message.

What options are available for accomplishing this?

Upvotes: 1

Views: 1089

Answers (1)

Daniel
Daniel

Reputation: 141

You should take a look at http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis and maybe save a lot of time implementing your own code analyzer.

Upvotes: 1

Related Questions