Menu

Excluding paths containing a specific folder

2023-06-23
2023-06-23
  • Agathe Bernier

    Agathe Bernier - 2023-06-23

    Hello everyone,

    I'm using cppcheck with inline commands to check MISRA2012 rules, and I want to exclude every .c files holding the "tests" folder in their path. E.g:

    foo/bar/tests/baz/file.c
    

    These files were not designed to be analysed, so they are flooding my analysis results with many errors.

    I'm trying to use the option --suppressions-list, and my suppressions.txt file looks like this:

    *:foo/**/tests/**
    

    But cppcheck is giving me a glob error

    cppcheck: error: Failed to add suppression. Invalid glob pattern 'foo/**/tests/**'
    

    I've tried many combinations of simple and double *, with or without "*.c" at the end, but without success.

    If you have any ideas, I'll be glad to read it !

    Thanks a lot

     
  • Agathe Bernier

    Agathe Bernier - 2023-06-23

    Turns out this suppressions.txt matches my needs:

    *:foo/*/tests/*
    

    The * character seems to be recursive inside subfolders.

    Sorry for the post, hope it helps someone !

     

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.