Bug 1480089 - pass all of the test files to to our static-analysis pipeline. r=janx

Differential Revision: https://phabricator.services.mozilla.com/D4659

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andi-Bogdan Postelnicu 2018-09-20 07:38:27 +00:00
Родитель 06c6a4c550
Коммит fb4dc15757
59 изменённых файлов: 138 добавлений и 97 удалений

Просмотреть файл

@ -1969,7 +1969,7 @@ class StaticAnalysis(MachCommandBase):
# Build the dummy compile_commands.json
self._compilation_commands_path = self._create_temp_compilation_db(config)
checkers_test_batch = []
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = []
for item in config['clang_checkers']:
@ -1988,6 +1988,7 @@ class StaticAnalysis(MachCommandBase):
ignored_checker or \
checker_not_in_list:
continue
checkers_test_batch.append(item['name'])
futures.append(executor.submit(self._verify_checker, item))
error_code = self.TOOLS_SUCCESS
@ -2006,11 +2007,58 @@ class StaticAnalysis(MachCommandBase):
shutil.rmtree(self._compilation_commands_path)
return error_code
# Run the analysis on all checkers at the same time only if we don't dump results.
if not self._dump_results:
ret_val = self._run_analysis_batch(checkers_test_batch)
if ret_val != self.TOOLS_SUCCESS:
shutil.rmtree(self._compilation_commands_path)
return ret_val
self.log(logging.INFO, 'static-analysis', {}, "SUCCESS: clang-tidy all tests passed.")
# Also delete the tmp folder
shutil.rmtree(self._compilation_commands_path)
return self.TOOLS_SUCCESS
def _run_analysis(self, checks, header_filter, sources, jobs=1, fix=False, print_out=False):
cmd = self._get_clang_tidy_command(
checks=checks, header_filter=header_filter,
sources=sources,
jobs=jobs, fix=fix)
try:
clang_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8')
except subprocess.CalledProcessError as e:
print(e.output)
return None
return self._parse_issues(clang_output)
def _run_analysis_batch(self, items):
self.log(logging.INFO, 'static-analysis', {},"RUNNING: clang-tidy checker batch analysis.")
if not len(items):
self.log(logging.ERROR, 'static-analysis', {}, "ERROR: clang-tidy checker list is empty!.")
return self.TOOLS_CHECKER_LIST_EMPTY
issues = self._run_analysis(
checks='-*,' + ",".join(items), header_filter='',
sources=[mozpath.join(self._clang_tidy_base_path, "test", checker) + '.cpp' for checker in items], print_out=True)
if issues is None:
return self.TOOLS_CHECKER_FAILED_FILE
for checker in items:
test_file_path_json = mozpath.join(self._clang_tidy_base_path, "test", checker) + '.json'
# Read the pre-determined issues
baseline_issues = self._get_autotest_stored_issues(test_file_path_json)
found = all([element_base in issues for element_base in baseline_issues])
if not found:
self.log(
logging.ERROR, 'static-analysis', {},
"ERROR: clang-tidy auto-test failed for checker {0} in multiple files process unit.".
format(checker))
return self.TOOLS_CHECKER_DIFF_FAILED
return self.TOOLS_SUCCESS
def _create_temp_compilation_db(self, config):
directory = tempfile.mkdtemp(prefix='cc')
with open(mozpath.join(directory, "compile_commands.json"), "wb") as file_handler:
@ -2126,51 +2174,44 @@ class StaticAnalysis(MachCommandBase):
self.log(logging.ERROR, 'static-analysis', {}, "ERROR: clang-tidy checker {} doesn't have a test file.".format(check))
return self.TOOLS_CHECKER_NO_TEST_FILE
cmd = self._get_clang_tidy_command(
checks='-*,' + check, header_filter='', sources=[test_file_path_cpp], jobs=1, fix=False)
try:
clang_output = subprocess.check_output(
cmd, stderr=subprocess.STDOUT).decode('utf-8')
except subprocess.CalledProcessError as e:
print(e.output)
issues = self._run_analysis(
checks='-*,' + check, header_filter='', sources=[test_file_path_cpp])
if issues is None:
return self.TOOLS_CHECKER_FAILED_FILE
else:
issues = self._parse_issues(clang_output)
# Verify to see if we got any issues, if not raise exception
if not issues:
# Verify to see if we got any issues, if not raise exception
if not issues:
self.log(
logging.ERROR, 'static-analysis', {},
"ERROR: clang-tidy checker {0} did not find any issues in its associated test file.".
format(check))
return self.CHECKER_RETURNED_NO_ISSUES
if self._dump_results:
self._build_autotest_result(test_file_path_json, json.dumps(issues))
else:
if not os.path.exists(test_file_path_json):
# Result file for test not found maybe regenerate it?
self.log(
logging.ERROR, 'static-analysis', {},
"ERROR: clang-tidy checker {0} did not find any issues in its associated test file.".
format(check))
return self.CHECKER_RETURNED_NO_ISSUES
"ERROR: clang-tidy result file not found for checker {0}".format(
check))
return self.TOOLS_CHECKER_RESULT_FILE_NOT_FOUND
# Read the pre-determined issues
baseline_issues = self._get_autotest_stored_issues(test_file_path_json)
if self._dump_results:
self._build_autotest_result(test_file_path_json, issues)
else:
if not os.path.exists(test_file_path_json):
# Result file for test not found maybe regenerate it?
self.log(
logging.ERROR, 'static-analysis', {},
"ERROR: clang-tidy result file not found for checker {0}".format(
check))
return self.TOOLS_CHECKER_RESULT_FILE_NOT_FOUND
# Read the pre-determined issues
baseline_issues = self._get_autotest_stored_issues(test_file_path_json)
# Compare the two lists
if issues != baseline_issues:
print("Clang output: {}".format(clang_output))
self.log(
logging.ERROR, 'static-analysis', {},
"ERROR: clang-tidy auto-test failed for checker {0} Expected: {1} Got: {2}".
format(check, baseline_issues, issues))
return self.TOOLS_CHECKER_DIFF_FAILED
return self.TOOLS_SUCCESS
# Compare the two lists
if issues != baseline_issues:
self.log(
logging.ERROR, 'static-analysis', {},
"ERROR: clang-tidy auto-test failed for checker {0} Expected: {1} Got: {2}".
format(check, baseline_issues, issues))
return self.TOOLS_CHECKER_DIFF_FAILED
return self.TOOLS_SUCCESS
def _build_autotest_result(self, file, issues):
with open(file, 'w') as f:
json.dump(issues, f, indent=4, sort_keys=True)
f.write(issues)
def _get_autotest_stored_issues(self, file):
with open(file) as f:
@ -2201,7 +2242,7 @@ class StaticAnalysis(MachCommandBase):
header_group = header.groups()
element = [header_group[3], header_group[4], header_group[5]]
issues.append(element)
return json.dumps(issues)
return issues
def _get_checks(self):
checks = '-*'

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"argument name 'y' in comment does not match parameter name 'x'\", \"bugprone-argument-comment\"], [\"warning\", \"argument name 'z' in comment does not match parameter name 'y'\", \"bugprone-argument-comment\"]]"
[["warning", "argument name 'y' in comment does not match parameter name 'x'", "bugprone-argument-comment"], ["warning", "argument name 'z' in comment does not match parameter name 'y'", "bugprone-argument-comment"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"found assert() with side effect\", \"bugprone-assert-side-effect\"]]"
[["warning", "found assert() with side effect", "bugprone-assert-side-effect"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"dubious check of 'bool *' against 'nullptr', did you mean to dereference it?\", \"bugprone-bool-pointer-implicit-conversion\"]]"
[["warning", "dubious check of 'bool *' against 'nullptr', did you mean to dereference it?", "bugprone-bool-pointer-implicit-conversion"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"no definition found for 'A', but a definition with the same name 'A' found in another namespace 'nb'\", \"bugprone-forward-declaration-namespace\"]]"
[["warning", "no definition found for 'A', but a definition with the same name 'A' found in another namespace 'nb'", "bugprone-forward-declaration-namespace"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"side effects in the 1st macro argument 'x' are repeated in macro expansion\", \"bugprone-macro-repeated-side-effects\"]]"
[["warning", "side effects in the 1st macro argument 'x' are repeated in macro expansion", "bugprone-macro-repeated-side-effects"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"string constructor parameters are probably swapped; expecting string(count, character)\", \"bugprone-string-constructor\"], [\"warning\", \"length is bigger then string literal size\", \"bugprone-string-constructor\"], [\"warning\", \"constructor creating an empty string\", \"bugprone-string-constructor\"]]"
[["warning", "string constructor parameters are probably swapped; expecting string(count, character)", "bugprone-string-constructor"], ["warning", "length is bigger then string literal size", "bugprone-string-constructor"], ["warning", "constructor creating an empty string", "bugprone-string-constructor"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility\", \"bugprone-string-integer-assignment\"], [\"warning\", \"an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility\", \"bugprone-string-integer-assignment\"]]"
[["warning", "an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility", "bugprone-string-integer-assignment"], ["warning", "an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility", "bugprone-string-integer-assignment"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"memset fill value is char '0', potentially mistaken for int 0\", \"bugprone-suspicious-memset-usage\"], [\"warning\", \"memset fill value is out of unsigned character range, gets truncated\", \"bugprone-suspicious-memset-usage\"], [\"warning\", \"memset of size zero, potentially swapped arguments\", \"bugprone-suspicious-memset-usage\"]]"
[["warning", "memset fill value is char '0', potentially mistaken for int 0", "bugprone-suspicious-memset-usage"], ["warning", "memset fill value is out of unsigned character range, gets truncated", "bugprone-suspicious-memset-usage"], ["warning", "memset of size zero, potentially swapped arguments", "bugprone-suspicious-memset-usage"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"suspicious string literal, probably missing a comma\", \"bugprone-suspicious-missing-comma\"]]"
[["warning", "suspicious string literal, probably missing a comma", "bugprone-suspicious-missing-comma"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"potentially unintended semicolon\", \"bugprone-suspicious-semicolon\"]]"
[["warning", "potentially unintended semicolon", "bugprone-suspicious-semicolon"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"argument with implicit conversion from 'double' to 'int' followed by argument converted from 'int' to 'double', potentially swapped arguments.\", \"bugprone-swapped-arguments\"], [\"warning\", \"argument with implicit conversion from 'int' to 'double' followed by argument converted from 'double' to 'int', potentially swapped arguments.\", \"bugprone-swapped-arguments\"], [\"warning\", \"argument with implicit conversion from 'int' to 'double' followed by argument converted from 'double' to 'int', potentially swapped arguments.\", \"bugprone-swapped-arguments\"], [\"warning\", \"argument with implicit conversion from 'double' to 'int' followed by argument converted from 'int' to 'double', potentially swapped arguments.\", \"bugprone-swapped-arguments\"]]"
[["warning", "argument with implicit conversion from 'double' to 'int' followed by argument converted from 'int' to 'double', potentially swapped arguments.", "bugprone-swapped-arguments"], ["warning", "argument with implicit conversion from 'int' to 'double' followed by argument converted from 'double' to 'int', potentially swapped arguments.", "bugprone-swapped-arguments"], ["warning", "argument with implicit conversion from 'int' to 'double' followed by argument converted from 'double' to 'int', potentially swapped arguments.", "bugprone-swapped-arguments"], ["warning", "argument with implicit conversion from 'double' to 'int' followed by argument converted from 'int' to 'double', potentially swapped arguments.", "bugprone-swapped-arguments"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"object destroyed immediately after creation; did you mean to name the object?\", \"bugprone-unused-raii\"]]"
[["warning", "object destroyed immediately after creation; did you mean to name the object?", "bugprone-unused-raii"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Use of memory after it is freed\", \"clang-analyzer-cplusplus.NewDelete\"], [\"warning\", \"Use of memory after it is freed\", \"clang-analyzer-cplusplus.NewDelete\"], [\"warning\", \"Attempt to free released memory\", \"clang-analyzer-cplusplus.NewDelete\"], [\"warning\", \"Argument to 'delete' is the address of the local variable 'i', which is not memory allocated by 'new'\", \"clang-analyzer-cplusplus.NewDelete\"]]"
[["warning", "Use of memory after it is freed", "clang-analyzer-cplusplus.NewDelete"], ["warning", "Use of memory after it is freed", "clang-analyzer-cplusplus.NewDelete"], ["warning", "Attempt to free released memory", "clang-analyzer-cplusplus.NewDelete"], ["warning", "Argument to 'delete' is the address of the local variable 'i', which is not memory allocated by 'new'", "clang-analyzer-cplusplus.NewDelete"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Potential leak of memory pointed to by 'p'\", \"clang-analyzer-cplusplus.NewDeleteLeaks\"]]"
[["warning", "Potential leak of memory pointed to by 'p'", "clang-analyzer-cplusplus.NewDeleteLeaks"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Value stored to 'x' is never read\", \"clang-analyzer-deadcode.DeadStores\"]]"
[["warning", "Value stored to 'x' is never read", "clang-analyzer-deadcode.DeadStores"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Variable 'x' with floating point type 'float' should not be used as a loop counter\", \"clang-analyzer-security.FloatLoopCounter\"]]"
[["warning", "Variable 'x' with floating point type 'float' should not be used as a loop counter", "clang-analyzer-security.FloatLoopCounter"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges\", \"clang-analyzer-security.insecureAPI.UncheckedReturn\"]]"
[["warning", "The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges", "clang-analyzer-security.insecureAPI.UncheckedReturn"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"The bcmp() function is obsoleted by memcmp()\", \"clang-analyzer-security.insecureAPI.bcmp\"]]"
[["warning", "The bcmp() function is obsoleted by memcmp()", "clang-analyzer-security.insecureAPI.bcmp"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"The bcopy() function is obsoleted by memcpy() or memmove()\", \"clang-analyzer-security.insecureAPI.bcopy\"]]"
[["warning", "The bcopy() function is obsoleted by memcpy() or memmove()", "clang-analyzer-security.insecureAPI.bcopy"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"The bzero() function is obsoleted by memset()\", \"clang-analyzer-security.insecureAPI.bzero\"]]"
[["warning", "The bzero() function is obsoleted by memset()", "clang-analyzer-security.insecureAPI.bzero"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"The getpw() function is dangerous as it may overflow the provided buffer. It is obsoleted by getpwuid()\", \"clang-analyzer-security.insecureAPI.getpw\"]]"
[["warning", "The getpw() function is dangerous as it may overflow the provided buffer. It is obsoleted by getpwuid()", "clang-analyzer-security.insecureAPI.getpw"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Call to 'mkstemp' should have at least 6 'X's in the format string to be secure (2 'X's seen)\", \"clang-analyzer-security.insecureAPI.mkstemp\"]]"
[["warning", "Call to 'mkstemp' should have at least 6 'X's in the format string to be secure (2 'X's seen)", "clang-analyzer-security.insecureAPI.mkstemp"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file. Use 'mkstemp' instead\", \"clang-analyzer-security.insecureAPI.mktemp\"]]"
[["warning", "Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file. Use 'mkstemp' instead", "clang-analyzer-security.insecureAPI.mktemp"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Call to function 'vfork' is insecure as it can lead to denial of service situations in the parent process. Replace calls to vfork with calls to the safer 'posix_spawn' function\", \"clang-analyzer-security.insecureAPI.vfork\"]]"
[["warning", "Call to function 'vfork' is insecure as it can lead to denial of service situations in the parent process. Replace calls to vfork with calls to the safer 'posix_spawn' function", "clang-analyzer-security.insecureAPI.vfork"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Attempt to free released memory\", \"clang-analyzer-unix.Malloc\"], [\"warning\", \"Use of memory after it is freed\", \"clang-analyzer-unix.Malloc\"], [\"warning\", \"Potential leak of memory pointed to by 'p'\", \"clang-analyzer-unix.Malloc\"], [\"warning\", \"Argument to free() is the address of the local variable 'a', which is not memory allocated by malloc()\", \"clang-analyzer-unix.Malloc\"], [\"warning\", \"Argument to free() is offset by -4 bytes from the start of memory allocated by malloc()\", \"clang-analyzer-unix.Malloc\"]]"
[["warning", "Attempt to free released memory", "clang-analyzer-unix.Malloc"], ["warning", "Use of memory after it is freed", "clang-analyzer-unix.Malloc"], ["warning", "Potential leak of memory pointed to by 'p'", "clang-analyzer-unix.Malloc"], ["warning", "Argument to free() is the address of the local variable 'a', which is not memory allocated by malloc()", "clang-analyzer-unix.Malloc"], ["warning", "Argument to free() is offset by -4 bytes from the start of memory allocated by malloc()", "clang-analyzer-unix.Malloc"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Potential buffer overflow. Replace with 'sizeof(dest) - strlen(dest) - 1' or use a safer 'strlcat' API\", \"clang-analyzer-unix.cstring.BadSizeArg\"]]"
[["warning", "Potential buffer overflow. Replace with 'sizeof(dest) - strlen(dest) - 1' or use a safer 'strlcat' API", "clang-analyzer-unix.cstring.BadSizeArg"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"Null pointer argument in call to string length function\", \"clang-analyzer-unix.cstring.NullArg\"]]"
[["warning", "Null pointer argument in call to string length function", "clang-analyzer-unix.cstring.NullArg"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"namespace alias decl 'n1_unused' is unused\", \"misc-unused-alias-decls\"], [\"warning\", \"namespace alias decl 'n12_unused' is unused\", \"misc-unused-alias-decls\"]]"
[["warning", "namespace alias decl 'n1_unused' is unused", "misc-unused-alias-decls"], ["warning", "namespace alias decl 'n12_unused' is unused", "misc-unused-alias-decls"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"using decl 'C' is unused\", \"misc-unused-using-decls\"]]"
[["warning", "using decl 'C' is unused", "misc-unused-using-decls"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"prefer a lambda to std::bind\", \"modernize-avoid-bind\"]]"
[["warning", "prefer a lambda to std::bind", "modernize-avoid-bind"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"use range-based for loop instead\", \"modernize-loop-convert\"]]"
[["warning", "use range-based for loop instead", "modernize-loop-convert"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"escaped string literal can be written as a raw string literal\", \"modernize-raw-string-literal\"]]"
[["warning", "escaped string literal can be written as a raw string literal", "modernize-raw-string-literal"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"the shrink_to_fit method should be used to reduce the capacity of a shrinkable container\", \"modernize-shrink-to-fit\"], [\"warning\", \"the shrink_to_fit method should be used to reduce the capacity of a shrinkable container\", \"modernize-shrink-to-fit\"]]"
[["warning", "the shrink_to_fit method should be used to reduce the capacity of a shrinkable container", "modernize-shrink-to-fit"], ["warning", "the shrink_to_fit method should be used to reduce the capacity of a shrinkable container", "modernize-shrink-to-fit"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"converting integer literal to bool, use bool literal instead\", \"modernize-use-bool-literals\"], [\"warning\", \"converting integer literal to bool, use bool literal instead\", \"modernize-use-bool-literals\"], [\"warning\", \"converting integer literal to bool, use bool literal instead\", \"modernize-use-bool-literals\"], [\"warning\", \"converting integer literal to bool, use bool literal instead\", \"modernize-use-bool-literals\"]]"
[["warning", "converting integer literal to bool, use bool literal instead", "modernize-use-bool-literals"], ["warning", "converting integer literal to bool, use bool literal instead", "modernize-use-bool-literals"], ["warning", "converting integer literal to bool, use bool literal instead", "modernize-use-bool-literals"], ["warning", "converting integer literal to bool, use bool literal instead", "modernize-use-bool-literals"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"use '= default' to define a trivial default constructor\", \"modernize-use-equals-default\"], [\"warning\", \"use '= default' to define a trivial destructor\", \"modernize-use-equals-default\"]]"
[["warning", "use '= default' to define a trivial default constructor", "modernize-use-equals-default"], ["warning", "use '= default' to define a trivial destructor", "modernize-use-equals-default"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"use '= delete' to prohibit calling of a special member function\", \"modernize-use-equals-delete\"], [\"warning\", \"use '= delete' to prohibit calling of a special member function\", \"modernize-use-equals-delete\"], [\"warning\", \"use '= delete' to prohibit calling of a special member function\", \"modernize-use-equals-delete\"], [\"warning\", \"use '= delete' to prohibit calling of a special member function\", \"modernize-use-equals-delete\"]]"
[["warning", "use '= delete' to prohibit calling of a special member function", "modernize-use-equals-delete"], ["warning", "use '= delete' to prohibit calling of a special member function", "modernize-use-equals-delete"], ["warning", "use '= delete' to prohibit calling of a special member function", "modernize-use-equals-delete"], ["warning", "use '= delete' to prohibit calling of a special member function", "modernize-use-equals-delete"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"use nullptr\", \"modernize-use-nullptr\"]]"
[["warning", "use nullptr", "modernize-use-nullptr"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character\", \"performance-faster-string-find\"]]"
[["warning", "'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character", "performance-faster-string-find"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"the loop variable's type is not a reference type; this creates a copy in each iteration; consider making this a reference\", \"performance-for-range-copy\"]]"
[["warning", "the loop variable's type is not a reference type; this creates a copy in each iteration; consider making this a reference", "performance-for-range-copy"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"the type of the loop variable 'foo' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const SimpleClass &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value\", \"performance-implicit-conversion-in-loop\"]]"
[["warning", "the type of the loop variable 'foo' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const SimpleClass &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value", "performance-implicit-conversion-in-loop"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"this STL algorithm call should be replaced with a container method\", \"performance-inefficient-algorithm\"]]"
[["warning", "this STL algorithm call should be replaced with a container method", "performance-inefficient-algorithm"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead\", \"performance-inefficient-string-concatenation\"]]"
[["warning", "string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead", "performance-inefficient-string-concatenation"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"'push_back' is called inside a loop; consider pre-allocating the vector capacity before the loop\", \"performance-inefficient-vector-operation\"]]"
[["warning", "'push_back' is called inside a loop; consider pre-allocating the vector capacity before the loop", "performance-inefficient-vector-operation"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"std::move of the variable 'obj' of the trivially-copyable type 'TriviallyCopyable' has no effect; remove std::move()\", \"performance-move-const-arg\"]]"
[["warning", "std::move of the variable 'obj' of the trivially-copyable type 'TriviallyCopyable' has no effect; remove std::move()", "performance-move-const-arg"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"move constructor initializes base class by calling a copy constructor\", \"performance-move-constructor-init\"]]"
[["warning", "move constructor initializes base class by calling a copy constructor", "performance-move-constructor-init"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"move constructors should be marked noexcept\", \"performance-noexcept-move-constructor\"], [\"warning\", \"move assignment operators should be marked noexcept\", \"performance-noexcept-move-constructor\"]]"
[["warning", "move constructors should be marked noexcept", "performance-noexcept-move-constructor"], ["warning", "move assignment operators should be marked noexcept", "performance-noexcept-move-constructor"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"call to 'acos' promotes float to double\", \"performance-type-promotion-in-math-fn\"]]"
[["warning", "call to 'acos' promotes float to double", "performance-type-promotion-in-math-fn"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"the const qualified variable 'UnnecessaryCopy' is copy-constructed from a const reference; consider making it a const reference\", \"performance-unnecessary-copy-initialization\"]]"
[["warning", "the const qualified variable 'UnnecessaryCopy' is copy-constructed from a const reference; consider making it a const reference", "performance-unnecessary-copy-initialization"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"the const qualified parameter 'Value' is copied for each invocation; consider making it a reference\", \"performance-unnecessary-value-param\"]]"
[["warning", "the const qualified parameter 'Value' is copied for each invocation; consider making it a reference", "performance-unnecessary-value-param"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"statement should be inside braces\", \"readability-braces-around-statements\"], [\"warning\", \"statement should be inside braces\", \"readability-braces-around-statements\"], [\"warning\", \"statement should be inside braces\", \"readability-braces-around-statements\"], [\"warning\", \"statement should be inside braces\", \"readability-braces-around-statements\"], [\"warning\", \"statement should be inside braces\", \"readability-braces-around-statements\"], [\"warning\", \"statement should be inside braces\", \"readability-braces-around-statements\"]]"
[["warning", "statement should be inside braces", "readability-braces-around-statements"], ["warning", "statement should be inside braces", "readability-braces-around-statements"], ["warning", "statement should be inside braces", "readability-braces-around-statements"], ["warning", "statement should be inside braces", "readability-braces-around-statements"], ["warning", "statement should be inside braces", "readability-braces-around-statements"], ["warning", "statement should be inside braces", "readability-braces-around-statements"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"the 'empty' method should be used to check for emptiness instead of 'size'\", \"readability-container-size-empty\"]]"
[["warning", "the 'empty' method should be used to check for emptiness instead of 'size'", "readability-container-size-empty"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"do not use 'else' after 'return'\", \"readability-else-after-return\"]]"
[["warning", "do not use 'else' after 'return'", "readability-else-after-return"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"different indentation for 'if' and corresponding 'else'\", \"readability-misleading-indentation\"]]"
[["warning", "different indentation for 'if' and corresponding 'else'", "readability-misleading-indentation"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"redundant return statement at the end of a function with a void return type\", \"readability-redundant-control-flow\"]]"
[["warning", "redundant return statement at the end of a function with a void return type", "readability-redundant-control-flow"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"redundant call to 'c_str'\", \"readability-redundant-string-cstr\"]]"
[["warning", "redundant call to 'c_str'", "readability-redundant-string-cstr"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"redundant string initialization\", \"readability-redundant-string-init\"]]"
[["warning", "redundant string initialization", "readability-redundant-string-init"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"static member accessed through instance\", \"readability-static-accessed-through-instance\"]]"
[["warning", "static member accessed through instance", "readability-static-accessed-through-instance"]]

Просмотреть файл

@ -1 +1 @@
"[[\"warning\", \"prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> objects\", \"readability-uniqueptr-delete-release\"]]"
[["warning", "prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> objects", "readability-uniqueptr-delete-release"]]