Fix cppcheck issues for incorrect language
Review Request #10067 — Created July 4, 2018 and submitted
cppcheck will fallback to C language if it checks a .h file. A lot of C++ applications uses .h for C++ header. So cppcheck will add issues for C++ only keywords like a "namespace". This change adds another option to force cppcheck to use given language.
Description | From | Last Updated |
---|---|---|
E999 SyntaxError: invalid syntax |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
E112 expected an indented block |
reviewbot | |
This isn't a compatibility-breaking change, so we shouldn't change the tool version. |
david | |
Is it likely that this will ever support more? Perhaps we should change this to use a ChoiceField and give … |
david | |
"options" is a funky name for this, because it ends up being turned into a single arg. How about: cppcheck_args … |
david |
- Commit:
-
893304c52ff5d33d46f8a82f3b54e1d28213dddfa9b5d85950df6ceb23c1700a0515de3aacb55c86
- Diff:
-
Revision 2 (+19 -1)
Checks run (2 succeeded)
-
-
-
Is it likely that this will ever support more? Perhaps we should change this to use a ChoiceField and give it the options "auto-detect", "C", and "C++"
-
"options" is a funky name for this, because it ends up being turned into a single arg. How about:
cppcheck_args = [ 'cppcheck', '--template=\"{file}::{line}::{severity}::{id}::{message}\"', '--enable=%s' % enable_settings, ] lang = settings['force_language'].strip() if lang: cppcheck_args.append('--language=%s' % lang) cppcheck_args.append(path) output = execute(cppcheck_args, split_lines=True, ingore_errors=True)
That way future optional things can also be added easily.
- Commit:
-
a9b5d85950df6ceb23c1700a0515de3aacb55c86ea10fbe2cac6790fae53f1524b238a0e55493950
- Diff:
-
Revision 3 (+29 -9)