Skip to content

Commit

Permalink
Improve license checker error message (#1039)
Browse files Browse the repository at this point in the history
Improve error message
  • Loading branch information
maltekliemann authored Jul 10, 2023
1 parent cf141bf commit be494e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/check-license/src/check_license/check_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
import os

from check_license.console import echo
from check_license.console import echo_error
from check_license.copyright import Copyright, CopyrightError
from check_license.errors import (
LicenseCheckerError,
Expand Down Expand Up @@ -110,7 +110,7 @@ def check_files(year: int, files: list[str]) -> bool:
f.read()
f.check(year)
except LicenseCheckerError as e:
echo(str(e))
echo_error(str(e))
result = True
return result

Expand All @@ -126,6 +126,6 @@ def update_files(year: int, files: list[str]) -> tuple[bool, int]:
f.write()
count += changed
except LicenseCheckerError as e:
echo(str(e))
echo_error(str(e))
result = True
return result, count
5 changes: 5 additions & 0 deletions scripts/check-license/src/check_license/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@

def echo(msg: str) -> None:
click.echo(msg)


def echo_error(msg: str) -> None:
click.echo(click.style("error: ", fg="red"), nl=False)
click.echo(msg)

0 comments on commit be494e4

Please sign in to comment.