Skip to content

Commit 9781bf4

Browse files
authored
forward cppcheck options + rename config option 'args' to 'extra_args' (#9)
1 parent f7bfda3 commit 9781bf4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ The configuration file is written in json, as **run-cppcheck-config.json**. It i
1919
- **log_file**: Path to log file. The default log file location is `$XDG_STATE_HOME/run-cppcheck` or `$HOME/.local/state/run-cppcheck` on Linux,
2020
and `%LOCALAPPDATA%\run-cppcheck` on Windows. The log file may provide more information than the editor plugin if analysis fails.
2121
- **enable_logging**: Default is `true`.
22-
- **args**: Extra arguments to pass to cppcheck. Example: `["--enable=style"]`.
22+
- **extra_args**: Extra arguments to pass to cppcheck. Example: `["--enable=style"]`.

config.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ std::string Config::load(const std::filesystem::path &path)
7171
continue;
7272
}
7373

74-
if (key == "args") {
74+
if (key == "extra_args") {
7575
if (!value.is<picojson::array>())
7676
return "Invalid value type for '" + key + "'";
7777

@@ -150,8 +150,10 @@ std::string Config::parseArgs(int argc, char **argv)
150150
continue;
151151
}
152152

153-
if (arg[0] == '-')
154-
return "Invalid option '" + std::string(arg) + "'";
153+
if (arg[0] == '-') {
154+
m_args.push_back(arg);
155+
continue;
156+
}
155157

156158
if (!m_filename.empty())
157159
return "Multiple filenames provided";

0 commit comments

Comments
 (0)