Skip to content

Feature/ shared cppcheck.json settings file - #120

Open
danmar wants to merge 2 commits into
mainfrom
feature/-shared-settings-file
Open

danmar wants to merge 2 commits into
mainfrom
feature/-shared-settings-file

Conversation

@danmar

@danmar danmar commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Adds support for a cppcheck.json file in the workspace root that customers can commit to their repository, so that all developers get the same cppcheck arguments without having to share their whole .vscode/settings.json.

{
  "arguments": "--project=build/compile_commands.json --enable=style"
}
  • arguments may be a string or an array of strings.
  • If the file specifies arguments, it takes precedence over the cppcheck-official.arguments setting. Other settings (enable, path, minSeverity) are still read from the VS Code settings, so each developer can tweak them individually.
  • The file is read on each analysis, so changes (e.g. after a git pull) apply without reloading.
  • If the file is invalid, an error is shown once (not again until the error changes) and the VS Code setting is used.
  • A JSON schema is contributed (schemas/cppcheck.schema.json) for autocomplete and validation when editing cppcheck.json.
  • README and walkthrough updated.

Tested:

  • npm run compile and npm run lint pass
  • Unit tests in src/test/settingsFile.test.ts (run in CI via npm test): no file, string, array, empty arguments, missing arguments, file changes, invalid JSON, wrong type, non-object file, and error reporting after the file is fixed and broken again

Not yet tested in the Extension Development Host.

🤖 Generated with Claude Code

dmcppcheck and others added 2 commits October 8, 2026 11:29
Add support for a cppcheck.json file in the workspace root that can be
committed to version control so that all developers get the same
cppcheck arguments. If the file specifies "arguments" (string or array
of strings) it takes precedence over the cppcheck-official.arguments
setting. Other settings are still read from the VS Code settings.

A JSON schema is contributed for autocomplete and validation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Make the workspace root injectable in getArguments so that tests can use
a temporary directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants