Skip to content

Commit

Permalink
fix setting of lines-changed-only (#90)
Browse files Browse the repository at this point in the history
The README states that the value of true focuses on
lines in diff with additions only.
Setting it to 'diff' will use the original behavior (meaning
entire diff chunks with unchanged lines).

However, I forgot to change this value's
interpretation in the src code (& test).

This commit makes the README accurate.
  • Loading branch information
2bndy5 authored Aug 19, 2022
1 parent df06936 commit 92298bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpp_linter/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"-l",
"--lines-changed-only",
default=0,
type=lambda a: 1 if a.lower() == "true" else (2 if a.lower() == "strict" else 0),
type=lambda a: 2 if a.lower() == "true" else (1 if a.lower() == "diff" else 0),
help="Set this option to 'true' to only analyze changes in the event's diff. "
"Set this to 'strict' to only analyze additions in the event's diff. "
"Defaults to %(default)s.",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def test_defaults():
("extensions", "cxx,.hpp", "extensions", ["cxx", "hpp"]),
("repo-root", "src", "repo_root", "src"),
("ignore", "!src|", "ignore", "!src|"),
("lines-changed-only", "True", "lines_changed_only", 1),
("lines-changed-only", "stricT", "lines_changed_only", 2),
("lines-changed-only", "True", "lines_changed_only", 2),
("lines-changed-only", "Diff", "lines_changed_only", 1),
("files-changed-only", "True", "files_changed_only", True),
("thread-comments", "True", "thread_comments", True),
("file-annotations", "False", "file_annotations", False),
Expand Down

0 comments on commit 92298bd

Please sign in to comment.