-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLI] Fix double clang-tidy config flags #3157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,12 +474,12 @@ def test_tidyargs_saargs(self): | |
""" | ||
build_json = os.path.join(self.test_workspace, "build_extra_args.json") | ||
report_dir = os.path.join(self.test_workspace, "reports_extra_args") | ||
source_file = os.path.join(self.test_dir, "extra_args.c") | ||
source_file = os.path.join(self.test_dir, "extra_args.cpp") | ||
tidyargs_file = os.path.join(self.test_dir, "tidyargs") | ||
saargs_file = os.path.join(self.test_dir, "saargs") | ||
|
||
build_log = [{"directory": self.test_dir, | ||
"command": "cc -c " + source_file, | ||
"command": "g++ -c " + source_file, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any test cases where you use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I extended the content of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I understand it but I would like to see a test for example where we set the |
||
"file": source_file | ||
}] | ||
|
||
|
@@ -488,7 +488,9 @@ def test_tidyargs_saargs(self): | |
json.dump(build_log, outfile) | ||
|
||
analyze_cmd = [self._codechecker_cmd, "analyze", build_json, | ||
"-o", report_dir, "--tidyargs", tidyargs_file] | ||
"-o", report_dir, "--tidyargs", tidyargs_file, | ||
"--analyzer-config", 'clang-tidy:HeaderFilterRegex=.*', | ||
'clang-tidy:Checks=modernize-use-bool-literals'] | ||
|
||
process = subprocess.Popen( | ||
analyze_cmd, | ||
|
@@ -509,6 +511,8 @@ def test_tidyargs_saargs(self): | |
out, _ = process.communicate() | ||
|
||
self.assertIn("division by zero", out) | ||
self.assertIn("modernize-avoid-bind", out) | ||
self.assertNotIn("performance-for-range-copy", out) | ||
|
||
analyze_cmd = [self._codechecker_cmd, "analyze", build_json, | ||
"-o", report_dir, "--saargs", saargs_file] | ||
|
@@ -821,13 +825,13 @@ def test_makefile_generation(self): | |
analyze_cmd = [self._codechecker_cmd, "analyze", build_json, | ||
"-o", self.report_dir, '--makefile'] | ||
|
||
source_file = os.path.join(self.test_dir, "extra_args.c") | ||
source_file = os.path.join(self.test_dir, "extra_args.cpp") | ||
build_log = [{"directory": self.test_workspace, | ||
"command": "gcc -DTIDYARGS -c " + source_file, | ||
"command": "g++ -DTIDYARGS -c " + source_file, | ||
"file": source_file | ||
}, | ||
{"directory": self.test_workspace, | ||
"command": "gcc -DSAARGS -DTIDYARGS -c " + source_file, | ||
"command": "g++ -DSAARGS -DTIDYARGS -c " + source_file, | ||
"file": source_file | ||
}] | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <functional> | ||
|
||
int add(int x, int y) { return x + y; } | ||
|
||
int main() | ||
{ | ||
#ifdef TIDYARGS | ||
int i = 1 / 0; | ||
#endif | ||
|
||
#ifdef SAARGS | ||
int* p = 0; | ||
*p = 42; | ||
#endif | ||
|
||
int x = 2; | ||
auto clj = std::bind(add, x, std::placeholders::_1); | ||
|
||
bool b = 1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
--extra-arg=-DTIDYARGS | ||
--extra-arg=-DTIDYARGS '-config={"Checks": "modernize-avoid-bind"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add this information to the
--analyzer-config
/--tidyargs
options help messages that the options in --tidyargs are stonger.