Skip to content

Commit

Permalink
Improve formatting of context (no double parentheses)
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret committed Aug 30, 2021
1 parent 74c7a81 commit 1bc1b81
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jekyll_relative_url_check/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def check_file(self, file: Path):
return self._check_file(file)

def _check_file(self, file: Path):
return self._check_text(file.read_text(), context=f"(in file {file})")
return self._check_text(file.read_text(), context=f"in file {file}")

def check_files(self, files: Iterable[Path]):
return all(map(self._check_file, files))
Expand All @@ -38,9 +38,12 @@ def _check_text(self, text: str, context=""):
for regex in self.absolute_url_regexs:
found |= set(regex.findall(line))
if found:
print(
msg = (
f"We believe we have found absolute URLS: {found} in this "
f"line: '{line}' ({context})"
f"line: '{line}'"
)
if context:
msg += f" ({context})"
print(msg)
found_any = True
return not found_any

0 comments on commit 1bc1b81

Please sign in to comment.