NppExec Cppcheck not working but NppExec Pylint is working



  • To All,

    I have NppExec set up so that if I click on an error line that is output to the NppExec console, then I jump to the line of code with the error in NPP. This works for Python files when running both Pylint and Flake8 in NppExec. This does not work with C source files when running Cppcheck in NppExec.

    The NppExec script for Pylint is: C:\Python37\Scripts\pylint.exe “$(FULL_CURRENT_PATH)”

    The NppExec script for Cppcheck is: “C:\Program Files (x86)\Cppcheck\cppcheck.exe” “$(FULL_CURRENT_PATH)”

    When clicking on the error message from Cppcheck in the console, instead of jumping to the line of code with the error, I get in a popup window with the following error message:

    “C:\Program Files (x86)\Notepad++.exe[Full\path\to\a_file.c” cannot be opened:
    Folder “C:\Program Files (x86)\Notepad++.exe[Full\path\to” doesn’t exist.

    Does anyone know how to fix this?

    Thanks,

    Steve



  • Plugins=>NppExec=>Console Output Filters

    You’ll need to match the output from Cppcheck errors / warnings you want to catch.



  • @Michael-Vincent

    Thanks, I am figuring that out now. I got the filter(s) working for Pylint, Flake8, Cppcheck, but not gcc. Can you have multiple filters?

    This is what is working for the 3 above: star:%FILE%:%LINE%:star

    This is an error line from gcc by introducing a deliberate error (no “;”) : ex4_all_calculator.c:62:5: error: expected ‘,’ or ‘;’ before ‘double’

    The error message in the popup window with the title “Create new file” is: “C:\path\to\file\62” doesn’t exist. Create it?

    The NppExec examples only show ABSFILE and FILE as keywords. It seems like I need a “BASENAMEFILE” keyword when gcc only puts out only a basename like above.

    Steve



  • I believe you can use %FILE% for the filename or %ABSFILE% for the fully qualified filename. Instructions are provided in the bottom of the pop-up window for Console Output Filters.



  • @Michael-Vincent

    The order of the filters is critical when there are multiple filters. This is what worked (1st to last filter) for a combination of filters for Pylint, Flake8, Cppcheck, and gcc:

    %FILE%:%LINE%:%CHAR%:*error*
    %FILE%:%LINE%:*note*
    %FILE%:%LINE%:%CHAR%:*
    *:%FILE%:%LINE%:*

    I assume that NppExec’s logic follows a series of conditional statements when processing the filters.


Log in to reply