johnthagen/clion-cppcheck

Crash due to unhandled ExecutionException with cppcheck installed with snap in ubuntu 20.04

Open

#39 opened on Jun 14, 2020

 (5 comments) (0 reactions) (0 assignees)Java (7 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (37 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Environment

  • Operating System : Ubuntu 20.04 LTS
  • IDE Version : CLion 2020.1.2
  • Cppcheck executable version : 2.0
  • Cppcheck plugin version : 1.4.2
  • Exact strings used in cppcheck plugin options:
    • cppcheck path: /snap/bin/cppcheck
    • cppcheck options: --enable=warning,performance,portability,style --language=c++

Expected behaviour

I expect the found errors being highlighted in clion for this main.cpp:

int main() {
    char *p; //(style) unassignedVariable: Variable 'p' is not assigned a value.
    *p = 0; // (error) uninitvar: Uninitialized variable: p
}

Just like when I run it from the terminal:

/snap/bin/cppcheck "--template=[{file}:{line}]: ({severity}) {id}: {message}" -I/home/anders/CLionProjects/untitled --enable=warning,performance,portability,style --language=c++ /home/anders/CLionProjects/untitled/main.cpp
Checking /home/anders/CLionProjects/untitled/main.cpp ...
[/home/anders/CLionProjects/untitled/main.cpp:5]: (error) uninitvar: Uninitialized variable: p
[/home/anders/CLionProjects/untitled/main.cpp:4]: (style) unassignedVariable: Variable 'p' is not assigned a value.

Actual behaviour

No inspection warnings/errors are shown, but this is in the event log:

11:22 AM	Error: ExecutionException: Cppcheck Error : Exit Code - 1 : /snap/bin/cppcheck "--template=[{file}:{line}]: ({severity}) {id}: {message}" -I/home/anders/CLionProjects/untitled --enable=warning,performance,portability,style --language=c++ /tmp/___main.cpp

Steps to reproduce the behaviour

  • Install cppcheck with software center https://snapcraft.io/cppcheck
  • Install cppcheck plugin and update to version 1.4.2
  • Make a new project.
  • Insert code from above in main.
  • Watch event log for error message.

Possible workaround

  • Install cppcheck with apt-get and use /usr/bin/cppcheck as path

Contributor guide