Skip to content

Commit

Permalink
lint: re-add pylint
Browse files Browse the repository at this point in the history
Since ruff is currently disabled (pending issue #146), temporarily add
pylint so that we have at least some form of "stylistic" linting of
the code. Once we add ruff we can undo this commit, remove .pylintrc
and remove the many "# pylint:" comments on the code itself.
  • Loading branch information
tigarmo committed Jun 15, 2023
1 parent a7464b2 commit 710760e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -547,5 +547,5 @@ preferred-modules=

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
4 changes: 2 additions & 2 deletions craft_cli/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ def _active_guard(ignore_when_stopped: bool = False) -> Callable[..., Any]:
"""

def decorator(wrapped_func: FuncT) -> FuncT:
def func(
def func( # pylint: disable=inconsistent-return-statements
self, *args: Any, **kwargs: Any
) -> Any: # pylint: disable=inconsistent-return-statements
) -> Any:
if not self._initiated: # pylint: disable=protected-access
raise RuntimeError("Emitter needs to be initiated first")
if self._stopped: # pylint: disable=protected-access
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ dev = [
lint = [
"black==23.3.0",
"codespell[toml]==2.2.4",
"pylint==2.17.4",
"pylint-fixme-info==1.0.3",
"pylint-pytest==1.1.2",
"ruff==0.0.269",
"yamllint==1.32.0"
]
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
env_list = # Environments to run when called with no parameters.
lint-{black,ruff,pyright,shellcheck,codespell,docs}
lint-{black,ruff,pyright,shellcheck,codespell,docs,pylint}
test-{py38,py310,py311}
minversion = 4.5
# Tox will use these requirements to bootstrap a venv if necessary.
Expand Down Expand Up @@ -56,7 +56,7 @@ runner = ignore_env_name_mismatch
find = git ls-files
filter = file --mime-type -Nnf- | grep shellscript | cut -f1 -d:

[testenv:lint-{black,ruff,shellcheck,codespell,yaml}]
[testenv:lint-{black,ruff,shellcheck,codespell,yaml,pylint}]
description = Lint the source code
base = testenv, lint
labels = lint
Expand All @@ -70,6 +70,8 @@ commands =
shellcheck: xargs -ra {env_tmp_dir}/shellcheck_files shellcheck
codespell: codespell --toml {tox_root}/pyproject.toml {posargs}
yaml: yamllint {posargs} .
pylint: pylint craft_cli {posargs} --ignore _version.py
pylint: pylint tests {posargs} --disable=missing-module-docstring,missing-function-docstring,redefined-outer-name,protected-access,duplicate-code,too-many-lines,missing-class-docstring,too-few-public-methods

[testenv:lint-{mypy,pyright}]
description = Static type checking
Expand Down

0 comments on commit 710760e

Please sign in to comment.