Menu

Running the python addons doesn't work for me

versat
2015-09-09
2015-09-15
  • versat

    versat - 2015-09-09

    Hi,
    i experience some problems when i run the addon scripts on projects (especially on more complex ones)
    The first problem is that i get the following error very often:

    Traceback (most recent call last):
      File "C:\Program Files\Cppcheck/addons/cert.py", line 77, in <module>
        data = cppcheckdata.parsedump(arg)
      File "C:\Program Files\Cppcheck\addons\cppcheckdata.py", line 455, in parsedump
        return CppcheckData(filename)
      File "C:\Program Files\Cppcheck\addons\cppcheckdata.py", line 445, in __init__
        token.setId(IdMap)
      File "C:\Program Files\Cppcheck\addons\cppcheckdata.py", line 212, in setId
        self.typeScope = IdMap[self.typeScopeId]
    KeyError: '0000000000000000'
    

    Another problem is that the resulting xml output is missing some/many entries when i run cppcheck with '--dump'. The other parameters are the same and i expected the '--dump' to only produce the *.dump files, but not to suppress errors/warnings/....

    I tried it with the cppcheck sources with the following batch file:

    ==============================
    rem Project-Parameters:
    set ProjectName=cppcheck_cli
    set ProjectPath=H:\cppcheck_files\cppcheck\cli
    set Libraries=
    set Platform=unix32
    set Language=c++
    set Standards=
    set Definitions=
    set UnDefinitions=
    set Includes=
    -I "%ProjectPath%/platform/arch/wince/" ^
    -I "%ProjectPath%/common/"
    
    set CppcheckPath=C:\Program Files\Cppcheck
    
    set CppcheckCmd="%CppcheckPath%/cppcheck" --enable=all --check-library -f --max-configs=99 ^
    --language=%Language% ^
    %Libraries% ^
    %Definitions% ^
    %UnDefinitions% ^
    %Includes% ^
    --platform=%Platform% ^
    --inconclusive ^
    -v ^
    --debug-warnings ^
    %Standards% ^
    --dump ^
    --xml ^
    --xml-version=2 ^
    "%ProjectPath%" 2> %ProjectName%_cppcheck_result.xml
    
    %CppcheckCmd%
    
    pushd "%ProjectPath%"
    for /f "tokens=* delims=" %%d in ('dir /b/s *.dump') do call :runscripts "%%d"
    popd
    
    pause
    
    goto :EOF
    
    :runscripts
    echo %1
    set PythonPath=c:/python27
    set PythonCmd="%PythonPath%/python.exe" "%CppcheckPath%/addons/cert.py" %1
    %PythonCmd%
    echo ""
    goto :EOF
    ==============================
    

    The resulting cppcheck command looks like this:

    "C:\Program Files\Cppcheck/cppcheck" --enable=all --check-library -f --max-configs=99 --language=c++ --platform=unix32 --inconclusive -v --debug-warnings --std=c99 --std=c++11 --dump --xml --xml-version=2 "H:\cppcheck_files\cppcheck\cli"  2>cppcheck_cli_cppcheck_result.xml
    

    Is Python 2.7 ok or do i need another version?

     

    Last edit: versat 2015-09-09
  • Daniel Marjamäki

    Hi!

    Sorry for the late reply.

    It is good to know that some people finds this feature interesting.

    Is Python 2.7 ok or do i need another version?

    As far as I know that should be enough. Since you don't get syntax errors it should work.

    The first problem is that i get the following error very often:

    This is most interesting if you can reproduce with some specific source file.

    hmm.. I can see some crashes here:
    http://cppcheck.sourceforge.net/devinfo/daca2-addons-report/daca2.html

    so I have some material for fixes.

    Another problem is that the resulting xml output is missing some/many entries when i run cppcheck with '--dump'.

    Yes that is by intention right now. The intention was to separate these. However I guess that if you provide --enable and other stuff you clearly want that warnings are output.

    I tried it with the cppcheck sources with the following batch file:

    ok thanks.. maybe something like that could be added to our addons folder in case users want to reuse it.

     
  • versat

    versat - 2015-09-15

    Hi Daniel,

    thanks for the reply.
    I've already set "--enable=all" and "-v" to get the maximum output and tried it with and without "--dump". If it is intentional that "--dump" hides some warnings/errors/... that would otherwise be printed then i just have to make an extra run with --dump enabled i guess. But i wonder by which rule "--dump" suppresses some output (for me it seems very random).

    I've attached a logfile where you can see the error that i get from cppcheckdata.py when it is run over cppcheck/cli directory. If cert.py works for you with similar settings for the cppcheck sources then i know that there is some error on my side :)

     

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.