Community
    • 登入

    NppExec Cppcheck not working but NppExec Pylint is working

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    5 貼文 2 Posters 1.5k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Steven HaymesS
      Steven Haymes
      最後由 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 條回覆 最後回覆 回覆 引用 0
      • Michael VincentM
        Michael Vincent
        最後由 編輯

        Plugins=>NppExec=>Console Output Filters

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

        Steven HaymesS 1 條回覆 最後回覆 回覆 引用 3
        • Steven HaymesS
          Steven Haymes @Michael Vincent
          最後由 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 條回覆 最後回覆 回覆 引用 0
          • Michael VincentM
            Michael Vincent
            最後由 編輯

            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 條回覆 最後回覆 回覆 引用 3
            • Steven HaymesS
              Steven Haymes @Michael Vincent
              最後由 編輯

              @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 條回覆 最後回覆 回覆 引用 3
              • 第一個貼文
                最後的貼文
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors