Skip to content

Commit a799583

Browse files
committed
Use ruff for flake8 replacement
1 parent 06058d7 commit a799583

File tree

9 files changed

+26
-14
lines changed

9 files changed

+26
-14
lines changed

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503, F403, F401, E402, E722, C901, E231
3+
max-line-length = 79
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4,B9

.isort.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
known_third_party = imp,pytest,setuptools

.pre-commit-config.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ repos:
1515
id: prettier
1616
repo: https://github.com/pre-commit/mirrors-prettier
1717
rev: v4.0.0-alpha.8
18-
1918
- hooks:
2019
- id: black
2120
repo: https://github.com/python/black
2221
rev: 24.10.0
2322
- hooks:
2423
- id: check-added-large-files
24+
args: [--maxkb=10000]
2525
- id: check-ast
2626
- id: check-case-conflict
2727
- id: check-executables-have-shebangs
@@ -53,6 +53,16 @@ repos:
5353
- id: flake8
5454
repo: https://github.com/pycqa/flake8
5555
rev: 7.1.1
56+
rev: v4.6.0
57+
- repo: https://github.com/astral-sh/ruff-pre-commit
58+
# Ruff version.
59+
rev: v0.6.9
60+
hooks:
61+
# Run the linter.
62+
- id: ruff
63+
# Run the formatter.
64+
- id: ruff-format
65+
5666
- repo: https://github.com/scop/pre-commit-shfmt
5767
rev: v3.10.0-2
5868
hooks:
@@ -63,9 +73,9 @@ repos:
6373
- -i
6474
- "4"
6575
- -s
66-
6776
types:
6877
- shell
78+
6979
- hooks:
7080
- id: blacken-docs
7181
repo: https://github.com/asottile/blacken-docs
@@ -84,7 +94,7 @@ repos:
8494
args: [--mapping, "2", --sequence, "4", --offset, "2", "--preserve-quotes"]
8595

8696
# - repo: https://github.com/hcodes/yaspeller.git
87-
# rev: v8.0.1
97+
# rev: v10.0.1
8898
# hooks:
8999
# - id: yaspeller
90100
# types:

maguiclient/magui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ def autogroups(autodata):
482482
# Precreate groups
483483
for element in hostsdict:
484484
for item in iter(hostsdict[element].items()):
485-
if not item[0] in groups:
485+
if item[0] not in groups:
486486
groups["%s" % item[0]] = {}
487-
if not item[1] in groups["%s" % item[0]]:
487+
if item[1] not in groups["%s" % item[0]]:
488488
groups["%s" % item[0]]["%s" % item[1]] = [element]
489489
else:
490490
groups["%s" % item[0]]["%s" % item[1]].append(element)

risuclient/plugins/core/system/reboot.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
import os
2121
import re
2222
import sys
23-
from datetime import datetime
24-
from datetime import timedelta
23+
from datetime import datetime, timedelta
2524

2625
# Getting environment
2726
global root_path

risuclient/plugins/metadata/events/reboots.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
import os
2222
import re
2323
import sys
24-
from datetime import datetime
25-
from datetime import timedelta
24+
from datetime import datetime, timedelta
2625

2726
# Getting environment
2827
global root_path

ruff.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[lint]
2+
ignore = ["E722"]

tests/plugins-unit-tests/test_keystone_bug_1473713.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import tempfile
2323
from unittest import TestCase
2424

25-
2625
sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../" + "../"))
2726

2827
try:

tests/test_dmidecode.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/" + "../"))
99

1010
from risuclient.tools.dmidecode import (
11-
_get_output,
12-
_parse_handle_section,
13-
_show,
1411
parse_dmi,
15-
profile,
1612
)
1713

1814

0 commit comments

Comments
 (0)