Community
    • Login

    NppExec Cppcheck not working but NppExec Pylint is working

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 1.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Steven HaymesS
      Steven Haymes
      last edited by Steven Haymes

      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

      1 Reply Last reply Reply Quote 0
      • Michael VincentM
        Michael Vincent
        last edited by

        Plugins=>NppExec=>Console Output Filters

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

        Steven HaymesS 1 Reply Last reply Reply Quote 3
        • Steven HaymesS
          Steven Haymes @Michael Vincent
          last edited by Steven Haymes

          @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

          1 Reply Last reply Reply Quote 0
          • Michael VincentM
            Michael Vincent
            last edited by

            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.

            Steven HaymesS 1 Reply Last reply Reply Quote 3
            • Steven HaymesS
              Steven Haymes @Michael Vincent
              last edited by

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

              1 Reply Last reply Reply Quote 3
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors