simplint 0.1.0__py3-none-win_amd64.whl
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.
|
Binary file
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: simplint
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Programming Language :: Python
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
15
|
+
Classifier: Programming Language :: Rust
|
|
16
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
17
|
+
Classifier: Topic :: Utilities
|
|
18
|
+
License-File: LICENSE.txt
|
|
19
|
+
Summary: Ruff companion linter enforcing the simp house style
|
|
20
|
+
Keywords: linter,python,ruff,style
|
|
21
|
+
Author-email: Bernat Gabor <gaborjbernat@gmail.com>
|
|
22
|
+
License-Expression: MIT
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/x-rst
|
|
25
|
+
Project-URL: Bug Tracker, https://github.com/gaborbernat/simplint/issues
|
|
26
|
+
Project-URL: Changelog, https://github.com/gaborbernat/simplint/blob/main/CHANGELOG.md
|
|
27
|
+
Project-URL: Documentation, https://simplint.readthedocs.io/en/latest/
|
|
28
|
+
Project-URL: Homepage, https://github.com/gaborbernat/simplint
|
|
29
|
+
Project-URL: Source Code, https://github.com/gaborbernat/simplint
|
|
30
|
+
|
|
31
|
+
simplint
|
|
32
|
+
========
|
|
33
|
+
|
|
34
|
+
``simplint`` is a companion linter for `astral-sh/ruff <https://github.com/astral-sh/ruff>`_. It enforces the parts of the ``simp`` house style that
|
|
35
|
+
Ruff has no rule for, such as definition order, ``Final`` constants, explicit exports and test layout. It is built on
|
|
36
|
+
Ruff's own parser crates, so the 264 files of `tox-dev/tox <https://github.com/tox-dev/tox>`_ lint in about 10 ms, and it fixes what it reports
|
|
37
|
+
wherever the fix is mechanical. See the `release history <https://github.com/gaborbernat/simplint/releases>`_ for
|
|
38
|
+
version changes.
|
|
39
|
+
|
|
40
|
+
.. code-block:: console
|
|
41
|
+
|
|
42
|
+
$ simplint check --select SMP050,SMP101 src/tox/util/path.py src/tox/util/spinner.py
|
|
43
|
+
src/tox/util/path.py:16:1: SMP050 `_CACHEDIR_TAG` is used by one function only; define it there
|
|
44
|
+
src/tox/util/path.py:16:1: SMP101 [*] `_CACHEDIR_TAG` is never reassigned; annotate it `Final`
|
|
45
|
+
src/tox/util/spinner.py:41:1: SMP101 [*] `MISS_DURATION` is never reassigned; annotate it `Final`
|
|
46
|
+
src/tox/util/spinner.py:181:1: SMP050 `_PERIODS` is used by one function only; define it there
|
|
47
|
+
src/tox/util/spinner.py:181:1: SMP101 `_PERIODS` is never reassigned; annotate it `Final`
|
|
48
|
+
Found 5 issues.
|
|
49
|
+
[*] 2 fixable with `--fix`.
|
|
50
|
+
2 hidden fixes can be enabled with `--unsafe-fixes`.
|
|
51
|
+
|
|
52
|
+
Install
|
|
53
|
+
-------
|
|
54
|
+
|
|
55
|
+
simplint ships as a single binary inside a Python wheel, like Ruff, so it needs no Python at runtime. An isolated tool
|
|
56
|
+
environment keeps it apart from the project it lints.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
.. code-block:: bash
|
|
60
|
+
|
|
61
|
+
uv tool install simplint
|
|
62
|
+
simplint --help
|
|
63
|
+
|
|
64
|
+
Pre-commit
|
|
65
|
+
----------
|
|
66
|
+
|
|
67
|
+
Add the hook to ``.pre-commit-config.yaml`` and set ``rev`` to the required release. The hook lints the whole project
|
|
68
|
+
on every run, since several rules need to know which names other modules import:
|
|
69
|
+
|
|
70
|
+
.. code-block:: yaml
|
|
71
|
+
|
|
72
|
+
- repo: https://github.com/gaborbernat/simplint
|
|
73
|
+
rev: ""
|
|
74
|
+
hooks:
|
|
75
|
+
- id: simplint
|
|
76
|
+
|
|
77
|
+
See `pre-commit/pre-commit <https://github.com/pre-commit/pre-commit>`_ for installation and update commands.
|
|
78
|
+
|
|
79
|
+
Running it
|
|
80
|
+
----------
|
|
81
|
+
|
|
82
|
+
``simplint check [PATHS]`` lints the Python files under each path, honoring ``.gitignore``. Add ``--fix`` to apply safe
|
|
83
|
+
fixes, ``--unsafe-fixes`` to also apply fixes that can change behavior, and ``--diff`` to print the fixes without
|
|
84
|
+
writing them. ``--select`` and ``--ignore`` take comma-separated rule codes, code prefixes or rule names.
|
|
85
|
+
``simplint rules`` lists every rule and whether it fixes, and ``simplint rule SMP111`` prints one rule's documentation.
|
|
86
|
+
|
|
87
|
+
Fixes rewrite code without formatting it, so run the formatter afterwards, the same way you would after
|
|
88
|
+
``ruff check --fix``:
|
|
89
|
+
|
|
90
|
+
.. code-block:: bash
|
|
91
|
+
|
|
92
|
+
simplint check --fix . && ruff check --fix . && ruff format .
|
|
93
|
+
|
|
94
|
+
See the `configuration reference <https://simplint.readthedocs.io/en/latest/configuration.html>`_ for settings and the
|
|
95
|
+
`rules reference <https://simplint.readthedocs.io/en/latest/rules.html>`_ for every rule with examples and fix safety.
|
|
96
|
+
|
|
97
|
+
simplint reads the nearest ``pyproject.toml``. From ``[tool.ruff]`` it takes ``target-version`` (falling back to
|
|
98
|
+
``project.requires-python``, then to Python 3.11), ``exclude`` and ``extend-exclude``. Its own settings live in
|
|
99
|
+
``[tool.simplint]``:
|
|
100
|
+
|
|
101
|
+
.. code-block:: toml
|
|
102
|
+
|
|
103
|
+
[tool.simplint]
|
|
104
|
+
select = ["ALL"] # the default
|
|
105
|
+
extend-select = []
|
|
106
|
+
ignore = ["SMP002"] # codes, prefixes or names
|
|
107
|
+
per-file-ignores = { "tests/*" = ["SMP101"] }
|
|
108
|
+
|
|
109
|
+
From ``[project]`` it reads ``dependencies``, which SMP040 treats as required, and the entry points in ``scripts``,
|
|
110
|
+
``gui-scripts`` and ``entry-points``, which count as imports of the names they reference.
|
|
111
|
+
|
|
112
|
+
Suppress a single line with ``# noqa: SMP010``. Tell Ruff those codes belong to another tool so it does not report them
|
|
113
|
+
as unused:
|
|
114
|
+
|
|
115
|
+
.. code-block:: toml
|
|
116
|
+
|
|
117
|
+
[tool.ruff]
|
|
118
|
+
lint.external = ["SMP"]
|
|
119
|
+
|
|
120
|
+
Pairing with Ruff
|
|
121
|
+
-----------------
|
|
122
|
+
|
|
123
|
+
simplint does not repeat what Ruff already checks. Run Ruff with ``select = ["ALL"]`` and add this configuration to
|
|
124
|
+
cover the rest of the style:
|
|
125
|
+
|
|
126
|
+
.. code-block:: toml
|
|
127
|
+
|
|
128
|
+
[tool.ruff.lint.flake8-tidy-imports]
|
|
129
|
+
ban-relative-imports = "parents"
|
|
130
|
+
|
|
131
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
132
|
+
"typing.Any".msg = "use the precise type"
|
|
133
|
+
"typing.cast".msg = "narrow with isinstance or TypeIs instead"
|
|
134
|
+
|
|
135
|
+
Ruff reads ``banned-api`` per configuration file, so the test-only bans go in a ``ruff.toml`` inside the tests
|
|
136
|
+
directory. It extends the root configuration and repeats the bans above, since a nested table replaces the parent's:
|
|
137
|
+
|
|
138
|
+
.. code-block:: toml
|
|
139
|
+
|
|
140
|
+
extend = "../pyproject.toml"
|
|
141
|
+
|
|
142
|
+
[lint.flake8-tidy-imports.banned-api]
|
|
143
|
+
"typing.Any".msg = "use the precise type"
|
|
144
|
+
"typing.cast".msg = "narrow with isinstance or TypeIs instead"
|
|
145
|
+
"unittest.mock".msg = "mock through pytest-mock's mocker"
|
|
146
|
+
"time.sleep".msg = "wait on an event the mock sets"
|
|
147
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
simplint-0.1.0.data/scripts/simplint.exe,sha256=SF8q0rhYX7giikfo23hE2uLaCpK5ffomA0sC9xmbU20,5207552
|
|
2
|
+
simplint-0.1.0.dist-info/METADATA,sha256=jX-wMc-1m6QI7VGyroYbTz4sao_bf2M2HEQSeQn5hT0,6204
|
|
3
|
+
simplint-0.1.0.dist-info/WHEEL,sha256=8Aej0W0a6Cz6apA3IzJrTnxLRVLAt-w0Oh8SA3Con_c,94
|
|
4
|
+
simplint-0.1.0.dist-info/licenses/LICENSE.txt,sha256=vOxHGaCaxBpCypg8AG7-s7tzNPEx-MqOSxGt6fWRjKQ,1071
|
|
5
|
+
simplint-0.1.0.dist-info/sboms/simplint.cyclonedx.json,sha256=B_qV0ZU83AQoivjey49jtdwswt8uiPYOoDFaravyUHU,154700
|
|
6
|
+
simplint-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bernát Gábor
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|