Skip to content
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

Escape filter list in a way that can be copied and pasted into a shell with NOMATCH #97

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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