Skip to content

Commit 2fd8886

Browse files
Update linting setup (#197)
* Update linting setup * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 02896a4 commit 2fd8886

File tree

9 files changed

+67
-37
lines changed

9 files changed

+67
-37
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,3 @@ jobs:
4444

4545
- name: Run tox targets for ${{ matrix.python-version }}
4646
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
47-
48-
lint:
49-
name: Lint
50-
runs-on: ubuntu-latest
51-
steps:
52-
- uses: actions/checkout@v4
53-
54-
- name: Set up Python
55-
uses: actions/setup-python@v5
56-
with:
57-
python-version: "3.13"
58-
59-
- name: Install dependencies
60-
run: |
61-
python -m pip install --upgrade pip tox
62-
- name: Run lint
63-
run: tox -e lint

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-ast
7+
- id: check-builtin-literals
8+
- id: check-case-conflict
9+
- id: check-docstring-first
10+
- id: check-json
11+
- id: check-merge-conflict
12+
- id: check-symlinks
13+
- id: check-toml
14+
- id: check-vcs-permalinks
15+
- id: check-yaml
16+
- id: debug-statements
17+
- id: destroyed-symlinks
18+
- id: end-of-file-fixer
19+
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: v0.9.8
22+
hooks:
23+
- id: ruff
24+
args: [--fix]
25+
- id: ruff-format

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Community Participation Guidelines
22

33
This repository is governed by Django's code of conduct. See https://www.djangoproject.com/conduct/.
4-

pyproject.toml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "Python library to integrate axe and selenium for web accessibilit
88
dynamic = ["version"]
99
readme = "README.rst"
1010
authors = [
11-
{name="Kimberly Sereduck", email="ksereduck@mozilla.com"}
11+
{name="Kimberly Sereduck", email="ksereduck@mozilla.com"}
1212
]
1313
license = {"text" = "Mozilla Public License 2.0 (MPL 2.0)"}
1414
keywords = ["axe-core", "selenium", "pytest-selenium", "accessibility" , "automation", "mozilla"]
@@ -18,8 +18,42 @@ dependencies = [
1818
"pytest>=3.0",
1919
]
2020

21+
[project.optional-dependencies]
22+
lint = [
23+
"pre-commit",
24+
]
25+
2126
[project.urls]
2227
"Homepage" = "https://github.com/axe-selenium-python/axe-selenium-python"
2328
"Issues" = "https://github.com/axe-selenium-python/axe-selenium-python/issues"
2429

25-
[tool.setuptools_scm]
30+
[tool.ruff.lint]
31+
select = [
32+
"A",
33+
"B",
34+
"BLE",
35+
"C4",
36+
"DTZ",
37+
"E",
38+
"ERA",
39+
"F",
40+
"FA",
41+
"FLY",
42+
"FURB",
43+
"I",
44+
"N",
45+
"PERF",
46+
"PIE",
47+
"PT",
48+
"RSE",
49+
"RUF",
50+
"SIM",
51+
"T10",
52+
"T20",
53+
"W",
54+
]
55+
56+
[tool.ruff.lint.isort]
57+
force-single-line = true
58+
59+
[tool.setuptools_scm]

tests/requirements/lint.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/requirements/tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pytest
22
selenium
33
pytest-html
4-
pytest-mock
4+
pytest-mock

tests/src/axe.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_axe.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# You can obtain one at http://mozilla.org/MPL/2.0/.
44

55
import json
6-
from os import getcwd, getenv, path
6+
from os import getcwd
7+
from os import getenv
8+
from os import path
79

810
import pytest
911
from selenium import webdriver

tox.ini

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
[tox]
2-
envlist = py312, py313, lint
2+
envlist = py312, py313
33
skipsdist = true
44

55
[testenv]
66
setenv =
77
MOZ_HEADLESS = 1
88
deps = -rtests/requirements/tests.txt
99
commands = pytest -rsx --verbose
10-
11-
[testenv:lint]
12-
deps = -rtests/requirements/lint.txt
13-
commands =
14-
flake8 axe_selenium_python tests
15-
isort axe_selenium_python tests --check --dif
16-
black axe_selenium_python tests --check
17-
18-
[flake8]
19-
max-line-length = 88

0 commit comments

Comments
 (0)