Submit and vote on feature ideas.

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.

Adding new Rule via RuleWizard

fatmanur61
fatmanur61 Posts: 82
edited March 2019 in C/C++test

Briefly, I want to learn RuleWizard to create my rules via RuleWizard for Static Analysis in C/C++Test. But I have an issue about it. For example, I want to check a case which is given in below.

void Trial(INT32U x){ //violation ( bracket should be put in new line not after the function)
...
}

void Trial(INT32U x) //correct
{
...
}

As far as I checked, I need to use python script for this.(Some added rules use script for functions)

My questions are :

  1. How can I create a rule to check this example could you give me a hint for this?
  2. If I need to use python, how can i find explanatory examples?
  3. If I can create this rule with shematics, could you guide me how I can understand meaning of these scheme etc.?

Comments

  • mstaron
    mstaron Posts: 35

    You need to create cross rule. It should start from C/C++ rule that looks for functions and fires C++Text rule in python method (see existing rule i.e FORMAT-30 <- you can duplicate this rule and modify it). In C++text rule you can detect if an opening brace '{' is used correctly. The API for python is described in Rule Wizard documentation: Help->Documentation->C++test API for Python Scripting. Other examples of rules are in Help->Documentation->Tutorials->RuleWizard for C and C++