Menu

Suppression rules idea

Mi-La
2020-01-28
2020-02-05
  • Mi-La

    Mi-La - 2020-01-28

    Hi, I've just an idea for a new feature. We run cppcheck even on our generated code. We get several warnings but we want the generated code as it is. Therefor we need to add suppressions. However it's not handy to define the suppressions per file[:line] since it is generated and the generated code can change occasionally. It also doens't seem as a good idea to use inline suppressions since it make a mess in the generated code for users who don't want to use cppcheck.
    Since we don't want to disable particular rules completely, it would be really nice if we could write something as "suppression rule". We have several patterns in generated code which fire cppcheck warnings which are still the same. So the idea is to describe the patterns by regular expressions as it works for custom rules and specify that such patters should not fire the warnings.
    What do you think?

     
  • Daniel Marjamäki

    In principle I think this sounds fine.

    What are the messages that you want to suppress? I'd assume that for generated code any stylistic message is rather useless.

    I don't know if that could help.. We could also give the messages some more attribute. For instance we added "symbolName" a few years ago so suppressions can trigger on specific symbolnames.

     
  • Mi-La

    Mi-La - 2020-02-05

    Hi, thanks for the response!

    Currently we get the [variableScope] messages - e.g.: "The scope of the variable 'row' can be reduced". It is because we don't want to complicate freemarker templates to check whether we have only a single column (when there are multiple columns, the 'row' is used multiple times and the warning doesn't occur).

    I'll check the "symbolName" if it can help for now.

     

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.