Skip to content

Commit

Permalink
style: Now using pylint in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Christie committed Jan 11, 2025
1 parent a622eca commit d420893
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 16 deletions.
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ repos:
args:
- --target-version
- py312

# pylint
- repo: https://github.com/pycqa/pylint
rev: v3.3.3
hooks:
- id: pylint
entry: pylint behaviour/features/steps/*.py
args:
- --disable=import-error
- --py-version=3.12
always_run: true
pass_filenames: false
10 changes: 8 additions & 2 deletions behaviour/features/steps/api_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"""A collection of functions to simplify access to the stack's API,
used primarily to reduce the number of lines in the step file.
"""

import os
from typing import List, Optional
from typing import Optional
from urllib.parse import urljoin

import requests
Expand Down Expand Up @@ -79,7 +83,9 @@ def upload_target_experiment(
"target_access_string": tas,
"file": (
file_name,
open(os.path.join(file_directory, file_name), "rb"),
open( # pylint: disable=consider-using-with
os.path.join(file_directory, file_name), "rb"
),
"application/octet-stream",
),
}
Expand Down
5 changes: 2 additions & 3 deletions behaviour/features/steps/awx_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ def launch_awx_job_template(template, *, extra_vars) -> None:
# Put any extra_vars into a local temporary YAML file
fp = None
if extra_vars:
fp = tempfile.NamedTemporaryFile(mode="w", delete=False)
yaml.dump(extra_vars, fp)
fp.close()
with tempfile.NamedTemporaryFile(mode="w", delete=False) as fp:
yaml.dump(extra_vars, fp)

cmd += f" --extra_vars @{fp.name}"

Expand Down
3 changes: 3 additions & 0 deletions behaviour/features/steps/browser_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env python
"""Utilities for interacting with the fragalysis UI that are normally accomplished
via a browser, such as logging in. Underlying logic is handled by playwright.
"""
import re
from html import unescape

Expand Down
111 changes: 100 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ requests-toolbelt = "^1.0.0"

[tool.poetry.group.dev.dependencies]
black = "^24.10.0"
isort = "^5.13.2"
pre-commit = "^4.0.1"
pylint = "^3.3.3"

[tool.pylint.messages_control]
disable = [
"line-too-long",
"too-many-arguments",
]

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit d420893

Please sign in to comment.