Misra rule violation shows up when not running static test on full project

SeppeSeppe Posts: 2

Hi, when running static analysis with misra rules we get a lot of extra rule violations when running the analysis on a single module (single folder). The rule 20.9 "macro might not be defined" accounts for all of the extra violations. When the analysis is run on the full project, these do not show up. The project was created from a BDF file.
The thing is we would prefer to run the static analysis on a per module basis to save time.
What are we doing wrong for this rule violation to show up everywhere? Should the analysis always be run on the full project?


  • mstaronmstaron Posts: 26

    The static analysis rules (except GLOBAL and BD rules that can be cloned to MISRA2012 ) analyze every translation unit (source file and its headers) separately. Rules 'MISRA2012-RULE-20_9_a' and 'MISRA2012-RULE-20_9_b' should report the same number of violations in a file in the output scope independently from testing scope. If new violations appear when you narrowing the scope, then please check what is the limit of violations per rule. Maybe, when the whole project is tested, then the limit of violations was achieved for these rules and some violations were not reported. At this moment I don't have any other explanation for this behaviour.

  • SeppeSeppe Posts: 2

    Thank you, there does indeed seem to be a limit of 1000 violations per rule.
    And the violation occurs since MISRA2012-RULE-20_9_a-2 does not check the header files for defines, but only checks source.

Sign In or Register to comment.