Looking for something to add some standard rules for my c++ project.

Posted by rkb on Stack Overflow See other posts from Stack Overflow or by rkb
Published on 2011-02-09T23:16:28Z Indexed on 2011/02/10 7:25 UTC
Read the original article Hit count: 124

Filed under:

Hello all,

My team is developing a C++ project on linux. We use vim as editor. I want to enforce some code standard rules in our team in such a way that if the code is not in accordance with it, some sort of warning or error will be thrown when it builds or compiles. Not necessarily it builds but at least I can run some plugin or tools on that code to make sure it meets the standard. So that before committing to svn everyone need to run the code through some sort of plugin or script and make sure it meets the requirement and then only he/she can commit. Not sure if we can add some rules to vim, if there are any let me know about it.

For eg. In our code standards all the member variables and private functions should start with _

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

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

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

Please note that warning and error are not from compiler becoz program is still valid. Its from the tool I want to use so that code goes to re-factoring but still works fine on the executable side.

I am looking for some sort of plugin or pre parsers or scripts which will help me in achieving all this.

Currently we use svn; just to anser the comment.

© Stack Overflow or respective owner

Related posts about c++