Skip to content

Commit

Permalink
Update pylint to version 3.0 (#1310)
Browse files Browse the repository at this point in the history
* Remove leading `_` from type alias (since it is type annotations it is
effectively a public name)
* Disable the cyclic import checker. By its definition, we do have
cyclic imports. pylint seems not to find them when using multiple
processes but it does find them when using a single process.
* Remove default parallelism from tox pylint runs and from the CI run
* Move `posargs` from black to pylint in the tox lint commands so that
parallelism can be used optionally
  • Loading branch information
wshanks authored Nov 2, 2023
1 parent 12a71b9 commit 0666228
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ disable=fixme, # disabled as TODOs would show up as warnings
no-else-return, # relax "elif" after a clause with a return
docstring-first-line-empty, # relax docstring style
import-outside-toplevel,
cyclic-import, # This checker raises on all module pairs that import each other,
# even submodules that only import already loaded objects from a
# parent module, a common pattern in qiskit-experiments.
assigning-non-slot # https://github.com/Qiskit/qiskit-terra/pull/7347#issuecomment-985007311


Expand Down
4 changes: 2 additions & 2 deletions qiskit_experiments/framework/experiment_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _repr_svg_(self):
return None


_FigureT = Union[str, bytes, MatplotlibFigure, FigureData]
FigureT = Union[str, bytes, MatplotlibFigure, FigureData]


class ExperimentData:
Expand Down Expand Up @@ -1134,7 +1134,7 @@ def data(
@do_auto_save
def add_figures(
self,
figures: Union[_FigureT, List[_FigureT]],
figures: Union[FigureT, List[FigureT]],
figure_names: Optional[Union[str, List[str]]] = None,
overwrite: bool = False,
save_figure: Optional[bool] = None,
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
black~=22.0
stestr
pylint~=2.16.2
astroid~=2.14.2 # Must be kept aligned to what pylint wants
pylint~=3.0.2
astroid~=3.0.1 # Must be kept aligned to what pylint wants
jinja2==3.0.3
sphinx>=6.2.1,<=7
jupyter-sphinx>=0.4.0
Expand All @@ -20,4 +20,4 @@ coverage>=5.5
ipykernel<=6.21.3
jupyter-client<=8.0.3
ipython<8.13.0 ; python_version<"3.9" # for python 3.8 compatibility
sphinx-remove-toctrees
sphinx-remove-toctrees
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ commands = stestr run {posargs}
[testenv:lint]
envdir = .tox/lint
commands =
black --check {posargs} qiskit_experiments test tools setup.py
pylint -rn -j 0 --rcfile={toxinidir}/.pylintrc qiskit_experiments/ test/ tools/
black --check qiskit_experiments test tools setup.py
pylint -rn {posargs} --rcfile={toxinidir}/.pylintrc qiskit_experiments/ test/ tools/
python {toxinidir}/tools/verify_headers.py

[testenv:lint-incr]
Expand All @@ -62,7 +62,7 @@ allowlist_externals = git
commands =
black --check {posargs} qiskit_experiments test tools setup.py
-git fetch -q https://github.com/Qiskit-Extensions/qiskit-experiments :lint_incr_latest
python {toxinidir}/tools/pylint_incr.py -rn -j4 -sn --paths :/qiskit_experiments/*.py :/test/*.py :/tools/*.py
python {toxinidir}/tools/pylint_incr.py -rn {posargs} -sn --paths :/qiskit_experiments/*.py :/test/*.py :/tools/*.py
python {toxinidir}/tools/verify_headers.py qiskit_experiments test tools

[testenv:black]
Expand Down Expand Up @@ -105,4 +105,4 @@ commands =
skip_install = true
deps =
allowlist_externals = rm
commands = rm -rf {toxinidir}/docs/stubs/ {toxinidir}/docs/_build
commands = rm -rf {toxinidir}/docs/stubs/ {toxinidir}/docs/_build

0 comments on commit 0666228

Please sign in to comment.