cpp-check-lint
[toc]
Features
- cppcheck/cpplint:
- editor/context
- check current file
- check the directory of the current file
- cmd :
- clear all
- clear current file
- stop check
- explorer/context
- check directory || check current file
- cmd
- OnSave/QuickFix
Requirements
cppcheck
# http://cppcheck.net/
yum install -y gcc gcc-c++ cmake
sudo tar -zxvf cppcheck-x.y.tar.gz
cd cppcheck-x.y/
mkdir build && cd build
cmake ..
make -j$(nproc)
- Install for yum/apt_get/brew :
sudo apt-get install cppcheck
sudo yum install cppcheck
brew install cppcheck
http://cppcheck.sourceforge.net/manual.html
cpplint
https://github.com/cpplint/cpplint
pip install cpplint
builtin binaries
from |
to |
|
http://cppcheck.net/ |
cpp-check-lint\bin\linux64 |
cppcheck addons cfg platforms |
http://cppcheck.net/ |
cpp-check-lint\bin\win64 |
cppcheck.exe cppcheck-core.dll addons cfg platforms |
https://github.com/cpplint/cpplint/tree/1.6.1 |
cpp-check-lint\bin\win64 |
cpplint.py -> cpplint.exe |
https://github.com/cpplint/cpplint/tree/1.6.1 |
cpp-check-lint\bin\linux64 |
cpplint.py |
Extension Settings
- If ${workspaceFolder} is included, it will be replaced.
Cppcheck
if (cppcheck configure is null) {
use builtin binaries
} else {
if( ("path to executable" --version).trim().toLowerCase().startsWith("cppcheck") ){
use "path to executable"
} else {
use builtin binaries
}
}
[
"cert",
{
"script": "misra.py",
"args": [
"--rule-texts=/home/user/misra.txt"
]
},
"y2038.py",
"C:\\UsersAdministrator\\hreadsafety.json"
]
"addon" and "addon.py" will use addons folder under the same level folder as cppcheck .
[rorot@cpppcheck]$ tree | grep -E " cppcheck.exe| addons| misra.py| y2038.py| cert.py| threadsafety.py"
├── addons
│ ├── cert.py
│ ├── misra.py
│ ├── threadsafety.py
│ └── y2038.py
├── cppcheck.exe
Some addons need extra arguments. You can configure json or json file.
{
"script": "misra.py",
"args": [
"--rule-texts=/home/user/misra.txt"
]
}
"--rule-texts=/home/user/misra.txt" (need absolute path, and use "/" or "\\" to split paths)
"args": ["--rule-texts=${workspaceFolder}/rule/misra.txt"] -> "args":["--rule-texts=D:/code/demo/rule/misra.txt"]}
Cpplint
if (cpplint configure is null) {
use builtin binaries
} else {
if("path to executable"){
use "path to executable"
} else {
use builtin binaries
}
}
Cpplint:--recursive
Cpplint:--lintdir
if ( cpplint version support "--recursive") {
set --recursive true
} else {
set "--recursive" false
set "--lintdir"
}
customargs
If the configuration parameters cannot be satisfied, use custom configuration "--customargs="
OnSave
cpplint suggest use with clang-format
QuickFix
It's just suppresses alarms
Configure skip unsupported flag
type |
value |
bool |
false |
string |
"" |
number |
null |
object |
null |
Known Issues
Source code