Skip to content

Commit fdf8aee

Browse files
authored
Merge pull request avocado-framework#6231 from richtja/pre_commit_hook
Pre commit hook
2 parents 75f87ad + 1b84dc7 commit fdf8aee

98 files changed

Lines changed: 2480 additions & 3295 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ jobs:
241241
uses: actions/checkout@v4
242242
with:
243243
fetch-depth: 0
244-
- name: Run Codespell Check
245-
run: make -f Makefile.gh codespell
246244
- name: Run bandit check
247245
run: make -f Makefile.gh bandit
248246
continue-on-error: True

.github/workflows/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
projectId: $project
9494
itemId: $item
9595
fieldId: $status_field
96-
value: {
96+
value: {
9797
singleSelectOptionId: $status_value
9898
}
9999
}) {

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./static-checks/.pre-commit-config.yaml

.pylintrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ persistent=yes
3636
# Specify a configuration file.
3737
#rcfile=
3838

39-
# When enabled, pylint would attempt to guess common misconfiguration and emit
40-
# user-friendly hints instead of false-positive error messages.
41-
suggestion-mode=yes
42-
4339
# Allow loading of arbitrary C extensions. Extensions are imported into the
4440
# active Python interpreter and may run arbitrary code.
4541
unsafe-load-any-extension=no
@@ -100,6 +96,7 @@ disable=C0103,
10096
R0913,
10197
R0914,
10298
R0915,
99+
R0917,
103100
R1702,
104101
R1703,
105102
R1704,

.pylintrc_utils

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ persistent=yes
3434
# Specify a configuration file.
3535
#rcfile=
3636

37-
# When enabled, pylint would attempt to guess common misconfiguration and emit
38-
# user-friendly hints instead of false-positive error messages.
39-
suggestion-mode=yes
40-
4137
# Allow loading of arbitrary C extensions. Extensions are imported into the
4238
# active Python interpreter and may run arbitrary code.
4339
unsafe-load-any-extension=no
@@ -70,6 +66,7 @@ disable=line-too-long,
7066
useless-suppression,
7167
use-symbolic-message-instead,
7268
too-few-public-methods,
69+
too-many-positional-arguments,
7370
fixme
7471

7572

@@ -504,4 +501,3 @@ accept-no-yields-doc = false
504501

505502
# Possible choices: ['sphinx', 'epytext', 'google', 'numpy', 'default']
506503
default-docstring-type = sphinx
507-

Makefile.gh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ all:
1717
@echo "This file contains targets used by GitHub Actions."
1818
@echo
1919

20-
codespell:
21-
pip install codespell==2.2.4
22-
codespell --check-filenames --check-hidden --skip ".git,*.js,./selftests/unit/utils/cpu.py.data/*,./avocado/utils/pmem.py,./avocado/utils/cpu.py,./avocado/utils/linux_modules.py,./selftests/functional/output.py,./selftests/unit/utils/vmimage.py"
23-
2420
bandit:
2521
pip install bandit
2622
bandit -o bandit-output.txt -r --skip B101,B105,B311,B404,B603 .

avocado-static-checks.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[lint]
2-
avocado/utils:static-checks/default_configs/pylintrc
32
avocado/utils:.pylintrc_utils
43
.:.pylintrc

avocado/core/data_dir.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ def get_job_results_dir(job_ref, logs_dir=None):
373373
if len(short_jobid) < 7:
374374
short_jobid += "*"
375375
idfile_pattern = os.path.join(logs_dir, f"job-*-{short_jobid}", "id")
376+
match_file = None
376377
for id_file in glob.glob(idfile_pattern):
377378
with open(id_file, "r", encoding="utf-8") as fid:
378379
line = fid.read().strip("\n")

avocado/core/nrunner/runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def running_loop(self, condition):
7373
condition for continuing the loop
7474
"""
7575
most_current_execution_state_time = None
76+
next_execution_state_mark = 0
7677
while not condition():
7778
now = time.monotonic()
7879
if most_current_execution_state_time is not None:

avocado/core/status/repo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def _handle_task_finished(self, message):
4343
if result is not None and result.upper() not in STATUSES:
4444
overridden = "error"
4545
message["result"] = overridden
46-
message[
47-
"fail_reason"
48-
] = f'Runner error occurred: Test reports unsupported status "{result}"'
46+
message["fail_reason"] = (
47+
f'Runner error occurred: Test reports unsupported status "{result}"'
48+
)
4949
LOG.error(
5050
'Task "%s" finished message with unsupported status '
5151
'"%s", changing to "%s"',

0 commit comments

Comments
 (0)