Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

C++Test Rule for indentation

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in C/C++test
Checking indentation level for public/protected/private & switch c
Hi all,

Does anybody have a C++Test rule to check the indentation level of public/protected/private keywords and switch cases?

Our coding standard requires these to be in the following form:

CODE
class MyClass
{
public:
   int foo(int x);
protected:
private:
   int bar;
}

Switch cases:

CODEswitch (bar)
{
case 1:
   foo(1);
   break;
case 2:
   foo(3);
   break;
default:
   foo(5);
   break;
}

Thanks in advance.

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Hello aarslan,


    Please view our Formatting rules we do have quite a few that could help:

    For switches please view
    FORMAT-37
    FORMAT-27
    FORMAT-36

    and we also have
    FORMAT-38

    Thank you,
    Techie2
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭

    Hello aarslan,


    Please view our Formatting rules we do have quite a few that could help:

    For switches please view
    FORMAT-37
    FORMAT-27
    FORMAT-36

    and we also have
    FORMAT-38

    Thank you,
    Techie2

    Hi techie2,

    I have updated them to check many of our indentation related coding standard items, however it is really not trivial to change them to fit my requirements.