Fix cppcheck issues for incorrect language

Review Request #10067 — Created July 4, 2018 and submitted

misery
ReviewBot
release-1.0.x
4717
ea10fbe...
reviewbot
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.


  • 0
  • 0
  • 6
  • 0
  • 6
Description From Last Updated
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

misery
david
  1. 
      
  2. bot/reviewbot/tools/cppcheck.py (Diff revision 2)
     
     

    This isn't a compatibility-breaking change, so we shouldn't change the tool version.

  3. bot/reviewbot/tools/cppcheck.py (Diff revision 2)
     
     

    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++"

  4. bot/reviewbot/tools/cppcheck.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    "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.

  5. 
      
misery
david
  1. Ship It!
  2. 
      
misery
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (870cb33)
Loading...