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

fix output #2

Merged
merged 2 commits into from
Jul 30, 2024
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
13 changes: 6 additions & 7 deletions tf_authoritative_scanner/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import argparse

VERSION = "1.0.2"
VERSION = "1.0.3"


class TFAuthoritativeScanner:
Expand Down Expand Up @@ -111,12 +111,11 @@ def run(self, paths):

if file_entry["authoritative"]:
authoritative_files_found += 1
if self.verbosity:
authoritative_lines = file_entry["authoritative_lines"]
for item in authoritative_lines:
line_number = item["line_number"]
line = item["line"]
print(f"AUTHORITATIVE: {file_path}:{line_number}: {line}")
authoritative_lines = file_entry["authoritative_lines"]
for item in authoritative_lines:
line_number = item["line_number"]
line = item["line"]
print(f"AUTHORITATIVE: {file_path}:{line_number}: {line}")
elif file_entry["excepted_lines"]:
if self.verbosity:
excepted_lines = file_entry["excepted_lines"]
Expand Down
4 changes: 3 additions & 1 deletion tf_authoritative_scanner/scanner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ def test_main_function_invalid(self):
def test_main_directory_fail(self, temp_tf_dir):
result = subprocess.run(["tfas", temp_tf_dir], capture_output=True, text=True)
assert result.stderr == ""
assert result.stdout == "FAIL: 1 of 1 scanned files are authoritative.\n"
assert "FAIL: 1 of 1 scanned files are authoritative.\n" in result.stdout
# ensure that authoritative messages are emitted in non-verbose mode
assert "AUTHORITATIVE" in result.stdout
assert result.returncode == 1

def test_main_directory_ok(self, temp_non_authoritative_tf_file):
Expand Down
Loading