Skip to content

Commit

Permalink
Rename maximum error configuration
Browse files Browse the repository at this point in the history
Closes #748
  • Loading branch information
Alexander Senier committed Aug 24, 2021
1 parent 39a634e commit ded5c81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions rflx/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pkg_resources import get_distribution

from rflx import __version__
from rflx.error import FAIL_AFTER_VALUE, RecordFluxError, Severity, Subsystem, fail
from rflx.error import ERROR_CONFIG, RecordFluxError, Severity, Subsystem, fail
from rflx.generator import Generator
from rflx.graph import Graph
from rflx.model import Message, Model, Session
Expand Down Expand Up @@ -106,7 +106,7 @@ def main(argv: List[str]) -> Union[int, str]:
if args.quiet:
logging.disable(logging.CRITICAL)

FAIL_AFTER_VALUE.v = args.max_errors
ERROR_CONFIG.fail_after_value = args.max_errors

try:
args.func(args)
Expand Down
8 changes: 4 additions & 4 deletions rflx/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from rflx.common import Base, verbose_repr

FAIL_AFTER_VALUE = local()
FAIL_AFTER_VALUE.v = 0
ERROR_CONFIG = local()
ERROR_CONFIG.fail_after_value = 0


class Location(Base):
Expand Down Expand Up @@ -143,7 +143,7 @@ def extend(
entries: Union[List[Tuple[str, Subsystem, Severity, Optional[Location]]], "BaseError"],
) -> None:
# pylint: disable = global-statement
global FAIL_AFTER_VALUE
global ERROR_CONFIG
if isinstance(entries, BaseError):
self.__errors.extend(entries.errors)
else:
Expand All @@ -152,7 +152,7 @@ def extend(
num_errors = len(
list(e for e in self.__errors if e.severity in (Severity.WARNING, Severity.ERROR))
)
if 0 < FAIL_AFTER_VALUE.v <= num_errors:
if 0 < ERROR_CONFIG.fail_after_value <= num_errors:
raise self

def check(self) -> bool:
Expand Down

0 comments on commit ded5c81

Please sign in to comment.