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.

Static analysis violation

fatmanur61
fatmanur61 Posts: 82

Hi I run the recommeded rules in c++test. I take a several violation in code. I did not interpret one violation which says 'Value 42 is out of acceptable range' lower than 30'. What does the meaning of it? I did not understand violation. The sreen shot of violation is attached to question.

Answers

  • Bogdan Czwartkowski
    Bogdan Czwartkowski Posts: 163 admin
    edited April 2019

    Hi @fatmanur61 ,
    This is violation of METRIC.CC rule, which calculates McCabe Cyclomatic Complexity.
    It is important to note, that Parasoft metrics can work two-fold:

    • metric rules calculate actual metric value for code elements, e.g. functions, which then can be displayed and analyzed in DTP widgets and explorers,
    • metric rules can also be configured to report a violation, whenever the calculated value is outside of specified thresholds.

    The metric rules are best configured in Test Configuration area of the DTP. In brief:
    1. go to Test Configurations page of DTP (details are here: https://docs.parasoft.com/display/DTP541/Test+Configurations+Overview)
    2. Expand list of test configurations for specific tool, C/C++test in this case. If the list of configurations is empty, you may want to create a new one, or import existing configuration from your desktop (see here for details: https://docs.parasoft.com/display/DTP541/Adding+Test+Configurations)
    3. Select your test configuration and then go to Metrics tab, and locate the METRIC.CC rule (https://docs.parasoft.com/display/DTP541/Configuring+Test+Configurations#ConfiguringTestConfigurations-MetricsTab)
    4. Under the rule list you will see tabs with Documentation and Parameters for the selected rule. In the parameters tab you can select whether particular metric rule will report static analysis violations at all, and if so, under which conditions specified by thresholds.