python-linters 0.1.6__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-linters
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: bundling config files for linters like ruff and pyright
5
5
  Project-URL: repository, https://github.com/dertilo/python-linters
6
6
  Author-email: Tilo Himmelsbach <dertilo@gmail.com>
@@ -6,15 +6,20 @@ from python_linters.config_files import RUFF_CONFIG_FILE
6
6
 
7
7
  def create_extended_ruff_toml(package_root:str) -> str:
8
8
  ruff_extension_file = Path(f"{package_root}/ruff_extension.toml")
9
+ ruff_toml_file = Path(f"{package_root}/ruff.toml")
10
+ if ruff_toml_file.is_file():
11
+ ruff_config_file = str(ruff_toml_file)
12
+ else:
13
+ ruff_config_file = RUFF_CONFIG_FILE
9
14
 
15
+ print(f"using {ruff_config_file=}")
10
16
  if ruff_extension_file.is_file():
11
- fingerprint = f"{ruff_extension_file.stat().st_size}-{ruff_extension_file.stat().st_mtime}"
12
- extended_ruff_toml_file = f"{package_root}/extended_ruff-{fingerprint}.toml"
17
+ extended_ruff_toml_file = f"{package_root}/extended_ruff.toml"
13
18
  if not Path(extended_ruff_toml_file).is_file():
14
- print(f"extending {RUFF_CONFIG_FILE} with {ruff_extension_file=}")
19
+ print(f"extending {ruff_config_file} with {ruff_extension_file=}")
15
20
  with Path(extended_ruff_toml_file).open("w", encoding="locale") as f:
16
21
  lines = [
17
- f'extend = "{RUFF_CONFIG_FILE}"',
22
+ f'extend = "{ruff_config_file}"',
18
23
  *list(_read_lines(ruff_extension_file)),
19
24
  ]
20
25
  for l in lines:
@@ -22,7 +27,7 @@ def create_extended_ruff_toml(package_root:str) -> str:
22
27
  else:
23
28
  print(f"using {extended_ruff_toml_file}")
24
29
  else:
25
- extended_ruff_toml_file = RUFF_CONFIG_FILE
30
+ extended_ruff_toml_file = ruff_config_file
26
31
  return extended_ruff_toml_file
27
32
 
28
33
 
@@ -1,4 +1,4 @@
1
- target-version = "py310"
1
+ target-version = "py312"
2
2
  # Exclude a variety of commonly ignored directories. see https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
3
3
  [lint]
4
4
  preview = true
@@ -33,76 +33,77 @@ exclude = [
33
33
  "venv",
34
34
  ]
35
35
  select = [
36
- "F", # Pyflakes
37
- "W", # pycodestyle Warning
38
- "E", # pycodestyle Error
39
- "C90", # mccabe
40
- "I", # isort
41
- "N", # pep8-naming
42
- # excluded "D", # pydocstyle -> tilo: docstrings are almost always bad-practice! if function/class needs explanation it is not self-explanatory, should be refactored+renamed and/or split up into smaller pieces
43
- "UP", # pyupgrade
44
- "YTT", # flake8-2020
45
- "ANN", # flake8-annotations
46
- "ASYNC", # flake8-async
47
- "S", # flake8-bandit
48
- "BLE", # flake8-blind-except
36
+ # excluded "AIR", # Airflow -> we are not using airflow!
37
+ # excluded "ERA", # eradicate commented-out-code tilo: better having it committed than uncommitted/unstaged only locally!
38
+ "FAST", # FastAPI
39
+ "ANN", # flake8-annotations
40
+ "ASYNC", # flake8-async
41
+ "S", # flake8-bandit
42
+ "BLE", # flake8-blind-except
49
43
  # excluded "FBT", # flake8-boolean-trap -> tilo: this one might be too strict/hard to refactor
50
- "B", # flake8-bugbear
51
- "A", # flake8-builtins
44
+ "B", # flake8-bugbear
45
+ "A", # flake8-builtins
52
46
  # "COM", # flake8-commas # may cause conflicts when used with the formatter: `COM812` -> recommended to be disabled
47
+ "C4", # flake8-comprehensions
53
48
  # excluded "CPY", # flake8-copyright -> tilo: who cares about copyright? chatGPT does not care!
54
- "C4", # flake8-comprehensions
55
- "DTZ", # flake8-datetimez
56
- "T10", # flake8-debugger#
49
+ "DTZ", # flake8-datetimez
50
+ "T10", # flake8-debugger
57
51
  # excluded "DJ", # flake8-django -> tilo: we are not using django
58
- "EM", # flake8-errmsg
59
- "EXE", # flake8-executable
60
- "FA", # flake8-future-annotations
61
- "ISC", # flake8-implicit-str-concat
62
- "ICN", # flake8-import-conventions
63
- "LOG", # flake8-logging
64
- "G", # flake8-logging-format
65
- "INP", # flake8-no-pep420
66
- "PIE", # flake8-pie
67
- "T20", # flake8-print
68
- "PYI", # flake8-pyi
69
- "PT", # flake8-pytest-style
70
- "Q", # flake8-quotes
71
- "RSE", # flake8-raise
72
- "RET", # flake8-return
73
- "SLF", # flake8-self
74
- "SLOT", # flake8-slots
75
- "SIM", # flake8-simplify
76
- "TID", # flake8-tidy-imports
77
- "TC", # flake8-type-checking
78
- "INT", # flake8-gettext
79
- "ARG", # flake8-unused-arguments
80
- "PTH", # flake8-use-pathlib
52
+ "EM", # flake8-errmsg
53
+ "EXE", # flake8-executable
54
+ # excluded "FIX", # flake8-fixme -> this is debatable
55
+ "FA", # flake8-future-annotations
56
+ "INT", # flake8-gettext
57
+ "ISC", # flake8-implicit-str-concat
58
+ "ICN", # flake8-import-conventions
59
+ "LOG", # flake8-logging
60
+ "G", # flake8-logging-format
61
+ "INP", # flake8-no-pep420
62
+ "PIE", # flake8-pie
63
+ # excluded "T20", # flake8-print # -> adults know when not to print
64
+ "PYI", # flake8-pyi
65
+ "PT", # flake8-pytest-style
66
+ "Q", # flake8-quotes
67
+ "RSE", # flake8-raise
68
+ "RET", # flake8-return
69
+ "SLF", # flake8-self
70
+ "SIM", # flake8-simplify
71
+ "SLOT", # flake8-slots
72
+ "TID", # flake8-tidy-imports
81
73
  # "TD", # flake8-todos
82
- # "FIX", # flake8-fixme
83
- # excluded "ERA", # eradicate commented-out-code tilo: better having it commit than uncommitted/unstaged only locally!
84
- "PD", # pandas-vet
85
- "PGH", # pygrep-hooks
86
- "PL", # Pylint
87
- "C", # Convention
88
- "E", # Error
89
- "R", # Refactor
90
- "W", # Warning
91
- "TRY", # tryceratops
92
- "FLY", # flynt
93
- "NPY", # NumPy-specific rules
94
- "FAST", # FastAPI
95
- # excluded "AIR", # Airflow -> we are not using airflow!
96
- "PERF", # Perflint
97
- "FURB", # refurb
74
+ "TC", # flake8-type-checking
75
+ "ARG", # flake8-unused-arguments
76
+ "PTH", # flake8-use-pathlib
77
+ "FLY", # flynt
78
+ "I", # isort
79
+ "C90", # mccabe
80
+ "NPY", # NumPy-specific rules
81
+ "PD", # pandas-vet
82
+ "N", # pep8-naming
83
+ "PERF", # Perflint
84
+ "E", # Error
85
+ "W", # Warning
98
86
  # "DOC", # pydoclint # tilo: maybe somewhen!
99
- "RUF", # Ruff-specific rules
87
+ # excluded "D", # pydocstyle -> tilo: docstrings are almost always bad-practice! if function/class needs explanation it is not self-explanatory, should be refactored+renamed and/or split up into smaller pieces
88
+ "F", # Pyflakes
89
+ "PGH", # pygrep-hooks
90
+ "PL", # Pylint
91
+ "PLC", # Convention
92
+ "PLE", # Error
93
+ "PLR", # Refactor
94
+ "PLW", # Warning
95
+ "UP", # pyupgrade
96
+ "FURB", # refurb
97
+ "RUF", # Ruff-specific rules
98
+ "TRY", # tryceratops
100
99
  ]
101
100
  # --------------- IGNORING specific rules --------------------------------------------------------
102
101
  ignore = [
102
+ "T20",
103
103
  "TC001","TC002","TC003", # typing-import-only-first-party-import -> tilo: I need those types for runtime-type-validation! (beartype
104
104
  "E501", # E501 line-too-long
105
105
  "S101", # prohibits using any assert! -> TODO!
106
+ "S104", # prohibits binding to "0.0.0.0"
106
107
  "W605", # Invalid escape sequence: `\ ` tilo: looks like false-positive to me! but not sure -> TODO!
107
108
  "ANN401", # ANN401 disallows "Any"
108
109
  "ANN204", # missing-return-type-special-method (ANN204) is very annoying especially for __enter__, __exit__ etc
@@ -134,25 +135,25 @@ ignore = [
134
135
  # PyCQA default seems to be 7: https://github.com/PyCQA/mccabe/blob/60cf21c21f8e5880f9907561c53732e80d1be400/mccabe.py#L273
135
136
  # flake8's default is 10: https://flake8.pycqa.org/en/2.5.5/
136
137
  # radon: cc<=5 is A ; 5<cc<=10 is B ; see: https://radon.readthedocs.io/en/latest/commandline.html#the-cc-command
137
- max-complexity = 7 # seven is a "magical" number!
138
+ # max-complexity = 10 # seven is a "magical" number!
138
139
 
139
140
  [lint.pylint]
140
141
  # --------------- PLR0913 too-many-arguments --------------------------------------------------------
141
142
  # Default value: 5
142
- max-args = 5
143
+ # max-args = 5
143
144
  # --------------- PLR0912 too-many-branches --------------------------------------------------------
144
145
  # By default, this rule allows up to 12 branches
145
- max-branches = 7
146
+ # max-branches = 12
146
147
  # --------------- PLR0911 too-many-return-statements ------------------------------------------------
147
148
  # "max-returns": ruff has default of 6, but recommends only 1; "wemake" has default of 5
148
149
  # tilo would like to set this to 1! but no need to be so strict, cause "max-complexity" is getting triggered, so basically it is impossible to have 5 returns!
149
- max-returns = 3
150
+ # max-returns = 3
150
151
  # --------------- PLR0911 too-many-statements --------------------------------------------------------
151
152
  #"TooManyExpressionsViolation" is it really referring to "expressions" not "statements"?
152
153
  # see https://wemake-python-styleguide.readthedocs.io/en/latest/pages/usage/violations/complexity.html#wemake_python_styleguide.violations.complexity.TooManyExpressionsViolation
153
154
  # wemake: --max-expressions. Default: 9
154
155
  # PLR0915 default is 50! -> can you ever reach this limit? max-complexity would catch those code-blocks first!
155
- max-statements = 25
156
+ # max-statements = 50
156
157
  # --------------- PLR0904 too-many-public-methods --------------------------------------------------------
157
158
  # Default value: 20, wemake's TooManyMethodsViolation (WPS214) has default of 7
158
159
  max-public-methods = 20 # is not only counting public but all methods!
File without changes
File without changes