Sunil Kumar
Sunil Kumar

Reputation: 416

configuration of cppcheck linter in sublime text 3

I installed the cppcheck in my machine and Sublimelinter & cppcheck plugin in my SublimeText3 as the documentation says but I am still unable to get the cppcheck working. I think I am doing some mistake in the path variable. I read this answer but couldn't understand. Please help me in configuring it. Thanks.

Here is my machine's (Ubuntu 16.04) output to relevant commands here:

which cppcheck
/usr/bin/cppcheck

my ~/.profile file:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH:/usr/bin"

Here is my Sublimelinter.sublime-settings file:

{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "manual",
        "linters": {
            "cppcheck": {
                "@disable": false,
                "args": [],
                "enable": "style",
                "excludes": [],
                "std": ["c++11"]
            }
        },
        "mark_style": "outline",
        "no_column_highlights_line": false,
        "passive_warnings": false,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "javascript (babel)": "javascript",
            "magicpython": "python",
            "php": "html",
            "python django": "python",
            "pythonimproved": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

Also note that whenever I try to add /usr/bin/ above i.e. "paths" : {"linux" : [/usr/bin/]} Sublime shows me error. Please help me here.

Upvotes: 0

Views: 1458

Answers (1)

groteworld
groteworld

Reputation: 711

This might be just in your question, but your path you are adding to your Sublimelinter.sublime-settings file should be in quotes.

incorrect:

"paths" : {"linux" : [/usr/bin/]}

corrected:

"paths" : {"linux" : ["/usr/bin/"]}

Note: The adding paths section from SublimeLinter Troubleshooting Guide states that if your PATH is initialized in the correct space (~/.profile for Ubuntu) that you shouldn't need to re-add the directory in the settings file. You should see the PATH output in the console if you turn on debugging for SublimeLinter and restart SublimeText

Upvotes: 1

Related Questions