Skip to content

Commit

Permalink
[clang-tidy] Fix Clang tidy checker option output
Browse files Browse the repository at this point in the history
The `CodeChecker checkers --checker-config` command did not output the
clang-tidy checker options correcly because it left a "." before the
actual option.

This patch replaces the dot with a colon.
  • Loading branch information
vodorok committed Oct 19, 2023
1 parent 0a3cc8b commit c3dede5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ def parse_checker_config_old(config_dump):
config_dump -- clang-tidy config options YAML dump in pre-LLVM15 format.
"""
print(config_dump)
reg = re.compile(r'key:\s+(\S+)\s+value:\s+([^\n]+)')
return re.findall(reg, config_dump)
all = re.findall(reg, config_dump)
# tidy emits the checker option with a "." prefix, but we need a ":"
all = [(option[0].replace(".", ":"), option[1]) for option in all]
return all


def parse_checker_config_new(config_dump):
Expand Down
4 changes: 2 additions & 2 deletions analyzer/tests/unit/test_checker_option_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_old_format(self):
result = [[k, v] for (k, v) in result]
self.assertEqual(len(result), 6)
self.assertIn(
["readability-suspicious-call-argument.PrefixSimilarAbove",
["readability-suspicious-call-argument:PrefixSimilarAbove",
"'30'"], result)

def test_new_format(self):
Expand Down Expand Up @@ -86,5 +86,5 @@ def test_new_format(self):
result = [[k, v] for (k, v) in result]
self.assertEqual(len(result), 6)
self.assertIn(
["readability-suspicious-call-argument.PrefixSimilarAbove", "30"],
["readability-suspicious-call-argument:PrefixSimilarAbove", "30"],
result)

0 comments on commit c3dede5

Please sign in to comment.