Menu

MISRA Rules File Format Change?

2021-08-13
2021-08-17
  • Mike Banducci

    Mike Banducci - 2021-08-13

    I have a MISRA rules file that worked with cppcheck 2.1, but with 2.5, the rules are not being parsed.

    My file is the format shown in the repo:

    Rule 14.4
    Rule text
    

    The cppcheck gui, however, shows:

    misra violation 1404 with no text in the supplied rule-texts-file [misra-c2012-14.4]
    

    Has the format changed, or is this a bug with the misra scripts?

    Thanks!

     

    Last edit: Mike Banducci 2021-08-13
  • Daniel Marjamäki

    hmm strange as far as I know we have not changed the format.

     
  • Georgiy Komarov

    Georgiy Komarov - 2021-08-14

    Well, this error message was recently added: https://github.com/danmar/cppcheck/pull/3343/files . But the format of the rules files has not been changed. Only error message was added. So, this error with suppressions was even when you were using Cppcheck 2.1, but you didn't see any errors.

    I'm not sure about the format of rule files from your message. You need something like this:

    Appendix A Summary of guidelines
    Rule 1.1 Required
    text of rule 1.1
    Rule 1.2 Advisory
    text of rule 1.2
    etc.
    
     
  • Mike Banducci

    Mike Banducci - 2021-08-17

    I did some poking around, and it looks like the rules parser doesn't handle multi-line rules or rule text that starts with a special character . I'd been adding rules with multiple parts like this:

    Rule x.y Required
    (a) Rule x.y part a
    (b) Rule x.y part b
    

    If I remove the parenthesis and make the rule a single line, like this:

    Rule x.y Required
    Rule x.y part a;Rule x.y part b
    

    The parser appears to work.

    Regarding 'special characters', it appears that any non-alphanumeric character causes a rule to fail to parse, for example, the following will not be parsed:

    Rule x.y Required
    'quoted words' in a rule text
    

    Thank you for pointing me in the right direction!

     

    Last edit: Mike Banducci 2021-08-17

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.