Skip to content

Commit

Permalink
Merge pull request #97 from bwrsandman/running_string
Browse files Browse the repository at this point in the history
Escape filter list in a way that can be copied and pasted into a shell with `NOMATCH`
  • Loading branch information
ZedThree authored Oct 11, 2023
2 parents e3c07fc + fec5c54 commit e7f5af5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions post/clang_tidy_review/clang_tidy_review/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import re
import io
import zipfile
import shlex
from github import Github
from github.Requester import Requester
from github.PaginatedList import PaginatedList
Expand Down Expand Up @@ -763,12 +764,12 @@ def create_review(

# Run clang-tidy with the configured parameters and produce the CLANG_TIDY_FIXES file
build_clang_tidy_warnings(
line_ranges,
shlex.quote(line_ranges),
build_dir,
clang_tidy_checks,
clang_tidy_binary,
config_file,
'"' + '" "'.join(files) + '"',
shlex.join(files),
)

# Read and parse the CLANG_TIDY_FIXES file
Expand Down Expand Up @@ -887,7 +888,7 @@ def get_line_ranges(diff, files):

line_filter_json = []
for name, lines in lines_by_file.items():
line_filter_json.append(str({"name": name, "lines": lines}))
line_filter_json.append({"name": name, "lines": lines})
return json.dumps(line_filter_json, separators=(",", ":"))


Expand Down
2 changes: 1 addition & 1 deletion tests/test_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_filter_files():
def test_line_ranges():
line_ranges = ctr.get_line_ranges(TEST_DIFF, ["src/hello.cxx"])

expected_line_ranges = """["{'name': 'src/hello.cxx', 'lines': [[5, 16]]}"]"""
expected_line_ranges = '[{"name":"src/hello.cxx","lines":[[5,16]]}]'
assert line_ranges == expected_line_ranges


Expand Down

0 comments on commit e7f5af5

Please sign in to comment.