Skip to content

Commit

Permalink
Add Pylint support and enable Pylint CI checks
Browse files Browse the repository at this point in the history
  • Loading branch information
correctmost committed Nov 2, 2024
1 parent 69294e1 commit 3d44f7a
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
@@ -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 .
4 changes: 2 additions & 2 deletions archinstall/lib/interactions/general_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def ask_for_audio_selection(
current: Optional[AudioConfiguration] = None
) -> Optional[AudioConfiguration]:
choices = [
Audio.Pipewire.name,
Audio.Pulseaudio.name,
Audio.Pipewire.name, # pylint: disable=no-member
Audio.Pulseaudio.name, # pylint: disable=no-member
Audio.no_audio_text()
]

Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PasswordStrength(Enum):
STRONG = 'strong'

@property
def value(self) -> str:
def value(self) -> str: # pylint: disable=invalid-overridden-method
match self:
case PasswordStrength.VERY_WEAK: return str(_('very weak'))
case PasswordStrength.WEAK: return str(_('weak'))
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/packages/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ def installed_package(package: str) -> LocalPackage:
except SysCallError:
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
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ dev = [
"flake8==7.1.1",
"pre-commit==4.0.1",
"ruff==0.7.2",
"pylint==3.3.1",
"pylint-pydantic==0.3.2",
]
doc = ["sphinx"]

Expand Down Expand Up @@ -120,6 +122,53 @@ ignore_missing_imports = true
targets = ["archinstall"]
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]
target-version = "py311"
builtins = ["_"]
Expand Down

0 comments on commit 3d44f7a

Please sign in to comment.