ruff: enable W, COM, EXE rules
This commit is contained in:
parent
ac08af7aab
commit
c5df3ce128
9 changed files with 19 additions and 14 deletions
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/python3
|
|
||||||
"""
|
"""
|
||||||
[[https://bluemaestro.com/products/product-details/bluetooth-environmental-monitor-and-logger][Bluemaestro]] temperature/humidity/pressure monitor
|
[[https://bluemaestro.com/products/product-details/bluetooth-environmental-monitor-and-logger][Bluemaestro]] temperature/humidity/pressure monitor
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -242,7 +242,7 @@ def test_pure() -> None:
|
||||||
src = Path(__file__).read_text()
|
src = Path(__file__).read_text()
|
||||||
# 'import my' is allowed, but
|
# 'import my' is allowed, but
|
||||||
# dont allow anything other HPI modules
|
# dont allow anything other HPI modules
|
||||||
assert re.findall('import ' + r'my\.\S+', src, re.M) == []
|
assert re.findall('import ' + r'my\.\S+', src, re.MULTILINE) == []
|
||||||
assert 'from ' + 'my' not in src
|
assert 'from ' + 'my' not in src
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ def plot_one(sleep: SleepEntry, fig, axes, xlims=None, *, showtext=True):
|
||||||
# axes.title.set_size(10)
|
# axes.title.set_size(10)
|
||||||
|
|
||||||
if showtext:
|
if showtext:
|
||||||
axes.text(xlims[1] - timedelta(hours=1.5), 20, str(sleep),)
|
axes.text(xlims[1] - timedelta(hours=1.5), 20, str(sleep))
|
||||||
# plt.text(sleep.asleep(), 0, hhmm(sleep.asleep()))
|
# plt.text(sleep.asleep(), 0, hhmm(sleep.asleep()))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
import csv
|
import csv
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Iterator, List, NamedTuple
|
from typing import Iterator, List, NamedTuple
|
||||||
|
|
19
ruff.toml
19
ruff.toml
|
@ -3,17 +3,22 @@ target-version = "py38" # NOTE: inferred from pyproject.toml if present
|
||||||
lint.extend-select = [
|
lint.extend-select = [
|
||||||
"F", # flakes rules -- default, but extend just in case
|
"F", # flakes rules -- default, but extend just in case
|
||||||
"E", # pycodestyle -- default, but extend just in case
|
"E", # pycodestyle -- default, but extend just in case
|
||||||
"C4", # flake8-comprehensions -- unnecessary list/map/dict calls
|
"W", # various warnings
|
||||||
"UP", # detect deprecated python stdlib stuff
|
|
||||||
"FBT", # detect use of boolean arguments
|
|
||||||
"RUF", # various ruff-specific rules
|
|
||||||
"PLR", # 'refactor' rules
|
|
||||||
"B", # 'bugbear' set -- various possible bugs
|
"B", # 'bugbear' set -- various possible bugs
|
||||||
|
"C4", # flake8-comprehensions -- unnecessary list/map/dict calls
|
||||||
|
"COM", # trailing commas
|
||||||
|
"EXE", # various checks wrt executable files
|
||||||
|
"FBT", # detect use of boolean arguments
|
||||||
|
"FURB", # various rules
|
||||||
"PERF", # various potential performance speedups
|
"PERF", # various potential performance speedups
|
||||||
"RET", # early returns
|
|
||||||
"PIE", # 'misc' lints
|
"PIE", # 'misc' lints
|
||||||
|
"PLR", # 'refactor' rules
|
||||||
"PLW", # pylint warnings
|
"PLW", # pylint warnings
|
||||||
"PT", # pytest stuff
|
"PT", # pytest stuff
|
||||||
|
"RET", # early returns
|
||||||
|
"RUF", # various ruff-specific rules
|
||||||
|
"UP", # detect deprecated python stdlib stuff
|
||||||
# "FA", # TODO enable later after we make sure cachew works?
|
# "FA", # TODO enable later after we make sure cachew works?
|
||||||
# "PTH", # pathlib migration -- TODO enable later
|
# "PTH", # pathlib migration -- TODO enable later
|
||||||
# "ARG", # TODO useful, but results in some false positives in pytest fixtures... maybe later
|
# "ARG", # TODO useful, but results in some false positives in pytest fixtures... maybe later
|
||||||
|
@ -97,4 +102,6 @@ lint.ignore = [
|
||||||
"PT004", # deprecated rule, will be removed later
|
"PT004", # deprecated rule, will be removed later
|
||||||
"PT011", # pytest raises should is too broad
|
"PT011", # pytest raises should is too broad
|
||||||
"PT012", # pytest raises should contain a single statement
|
"PT012", # pytest raises should contain a single statement
|
||||||
|
|
||||||
|
"COM812", # trailing comma missing -- TODO maybe use this?
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue