Skip to content

Commit

Permalink
refactor: Various quality improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Nov 11, 2020
1 parent 78267c7 commit e8aca77
Show file tree
Hide file tree
Showing 12 changed files with 577 additions and 392 deletions.
2 changes: 1 addition & 1 deletion duties.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def check_types(ctx):
Arguments:
ctx: The context instance (passed automatically).
"""
ctx.run(f"mypy --config-file config/mypy.ini {PY_SRC}", title="Type-checking", pty=PTY)
ctx.run(f"mypy --config-file config/mypy.ini {PY_SRC}", title="Type-checking", pty=PTY, nofail=True, quiet=True)


@duty(silent=True)
Expand Down
30 changes: 27 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ include_trailing_comma = true
format = "colored"
max_line_length = 132
show_source = false
exclude = ["tests/fixtures"]
# TODO: reduce the excludes to tests/fixtures at some point
exclude = ["tests/", "src/aria2p/interface.py"]

[tool.flakehell.plugins]
"*" = [
Expand All @@ -96,6 +97,7 @@ exclude = ["tests/fixtures"]
"-C0103", # two-lowercase-letters variable DO conform to snake_case naming style
"-C0116", # redunant with D102 (missing docstring)
"-C0301", # line too long
"-C0302", # too many lines in module
"-R0902", # too many instance attributes
"-R0903", # too few public methods
"-R0904", # too many public methods
Expand All @@ -107,14 +109,16 @@ exclude = ["tests/fixtures"]
"-W0611", # redundant with F401 (unused import)
"-W1203", # lazy formatting for logging calls
"-WPS305", # f-strings
"-WPS110", # common variable names (too annoying)
"-WPS100", # common module names
"-WPS110", # common variable names
"-WPS125", # redundant with W0622 (builtin override), which is more precise about line number
"-WPS201", # too many imports
"-WPS202", # too many module members
"-WPS210", # too many local variables
"-WPS211", # too many arguments
"-WPS213", # too many expressions
"-WPS214", # too many methods
"-WPS219", # too deep access level
"-WPS220", # too deep nesting
"-WPS223", # too many elif branches
"-WPS226", # string over-use: can't disable it per file?
Expand All @@ -124,6 +128,7 @@ exclude = ["tests/fixtures"]
"-WPS322", # multi-line strings (incompatible with attributes docstrings)
"-WPS326", # implicit string concatenation
"-WPS336", # explicit string concatenation
"-WPS342", # implicit raw string
"-WPS402", # noqa overuse
"-WPS412", # __init__ modules with logic
"-WPS428", # statement with no effect (not compatible with attribute docstrings)
Expand All @@ -143,7 +148,26 @@ exclude = ["tests/fixtures"]
"-WPS602", # staticmethod
]

[tool.flakehell.exceptions."src/aria2p/options.py"]
"*" = [
"-WPS204", # overused expression bool_to_str(value)
]

[tool.flakehell.exceptions."src/aria2p/interface.py"]
"*" = [
"-VNE001", # name too short
"-WPS111", # name too short
"-WPS115", # uppercase constant in class
"-WPS420", # pass (methods not implemented)
"-WPS601", # shadowed class attribute
]

[tool.flakehell.exceptions."src/aria2p/types.py"]
"*" = [
"-WPS221", # high jones complexity
]

[tool.flakehell.exceptions."tests/"]
"*" = [
"-WPS432", # magic numbers
]
]
2 changes: 1 addition & 1 deletion src/aria2p/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def enable_logger(sink=sys.stderr, level="WARNING"):
Configure the `logger` variable imported from `loguru`.
Args:
Arguments:
sink (file): An opened file pointer, or stream handler. Default to standard error.
level (str): The log level to use. Possible values are TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL.
Default to WARNING.
Expand Down
Loading

0 comments on commit e8aca77

Please sign in to comment.