Add Pylint support and enable Pylint CI checks (#2658)
This commit is contained in:
parent
e3123671bf
commit
aecf3ea553
|
|
@ -0,0 +1,22 @@
|
||||||
|
on: [ push, pull_request ]
|
||||||
|
name: Pylint linting
|
||||||
|
jobs:
|
||||||
|
pylint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: archlinux/archlinux:latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Prepare arch
|
||||||
|
run: |
|
||||||
|
pacman-key --init
|
||||||
|
pacman --noconfirm -Sy archlinux-keyring
|
||||||
|
pacman --noconfirm -Syyu
|
||||||
|
pacman --noconfirm -Sy python-pip python-pyparted python-simple-term-menu pkgconfig gcc
|
||||||
|
- run: pip install --break-system-packages --upgrade pip
|
||||||
|
- name: Install Pylint and Pylint plug-ins
|
||||||
|
run: pip install --break-system-packages .[dev]
|
||||||
|
- run: python --version
|
||||||
|
- run: pylint --version
|
||||||
|
- name: Lint with Pylint
|
||||||
|
run: pylint .
|
||||||
|
|
@ -61,8 +61,8 @@ def ask_for_audio_selection(
|
||||||
current: Optional[AudioConfiguration] = None
|
current: Optional[AudioConfiguration] = None
|
||||||
) -> Optional[AudioConfiguration]:
|
) -> Optional[AudioConfiguration]:
|
||||||
choices = [
|
choices = [
|
||||||
Audio.Pipewire.name,
|
Audio.Pipewire.name, # pylint: disable=no-member
|
||||||
Audio.Pulseaudio.name,
|
Audio.Pulseaudio.name, # pylint: disable=no-member
|
||||||
Audio.no_audio_text()
|
Audio.no_audio_text()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class PasswordStrength(Enum):
|
||||||
STRONG = 'strong'
|
STRONG = 'strong'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def value(self) -> str:
|
def value(self) -> str: # pylint: disable=invalid-overridden-method
|
||||||
match self:
|
match self:
|
||||||
case PasswordStrength.VERY_WEAK: return str(_('very weak'))
|
case PasswordStrength.VERY_WEAK: return str(_('very weak'))
|
||||||
case PasswordStrength.WEAK: return str(_('weak'))
|
case PasswordStrength.WEAK: return str(_('weak'))
|
||||||
|
|
|
||||||
|
|
@ -113,4 +113,4 @@ def installed_package(package: str) -> LocalPackage:
|
||||||
except SysCallError:
|
except SysCallError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return LocalPackage({field.name: package_info.get(field.name) for field in dataclasses.fields(LocalPackage)}) # type: ignore
|
return LocalPackage({field.name: package_info.get(field.name) for field in dataclasses.fields(LocalPackage)}) # type: ignore # pylint: disable=no-value-for-parameter
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ dev = [
|
||||||
"flake8==7.1.1",
|
"flake8==7.1.1",
|
||||||
"pre-commit==4.0.1",
|
"pre-commit==4.0.1",
|
||||||
"ruff==0.7.2",
|
"ruff==0.7.2",
|
||||||
|
"pylint==3.3.1",
|
||||||
|
"pylint-pydantic==0.3.2",
|
||||||
]
|
]
|
||||||
doc = ["sphinx"]
|
doc = ["sphinx"]
|
||||||
|
|
||||||
|
|
@ -120,6 +122,53 @@ ignore_missing_imports = true
|
||||||
targets = ["archinstall"]
|
targets = ["archinstall"]
|
||||||
exclude = ["/tests"]
|
exclude = ["/tests"]
|
||||||
|
|
||||||
|
[tool.pylint.main]
|
||||||
|
ignore-paths = [
|
||||||
|
"^build/",
|
||||||
|
"^docs/",
|
||||||
|
]
|
||||||
|
load-plugins = ["pylint_pydantic"]
|
||||||
|
persistent = false
|
||||||
|
py-version = "3.11"
|
||||||
|
recursive = true
|
||||||
|
|
||||||
|
[tool.pylint.format]
|
||||||
|
max-line-length = 220
|
||||||
|
|
||||||
|
[tool.pylint."messages control"]
|
||||||
|
disable = [
|
||||||
|
"C",
|
||||||
|
"R",
|
||||||
|
"arguments-renamed",
|
||||||
|
"attribute-defined-outside-init",
|
||||||
|
"bad-indentation",
|
||||||
|
"bare-except",
|
||||||
|
"broad-exception-caught",
|
||||||
|
"cell-var-from-loop",
|
||||||
|
"comparison-with-callable",
|
||||||
|
"dangerous-default-value",
|
||||||
|
"expression-not-assigned",
|
||||||
|
"f-string-without-interpolation",
|
||||||
|
"fixme",
|
||||||
|
"protected-access",
|
||||||
|
"raise-missing-from",
|
||||||
|
"redefined-builtin",
|
||||||
|
"redefined-outer-name",
|
||||||
|
"self-assigning-variable",
|
||||||
|
"unnecessary-lambda",
|
||||||
|
"unreachable",
|
||||||
|
"unspecified-encoding",
|
||||||
|
"unused-argument",
|
||||||
|
"unused-variable",
|
||||||
|
"useless-parent-delegation",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.pylint.refactoring]
|
||||||
|
score = false
|
||||||
|
|
||||||
|
[tool.pylint.variables]
|
||||||
|
additional-builtins = ["_"]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
target-version = "py311"
|
target-version = "py311"
|
||||||
builtins = ["_"]
|
builtins = ["_"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue