omdev 0.0.0.dev446__py3-none-any.whl → 0.0.0.dev448__py3-none-any.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.
- omdev/precheck/blanklines.py +66 -0
- omdev/precheck/main.py +2 -0
- {omdev-0.0.0.dev446.dist-info → omdev-0.0.0.dev448.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev446.dist-info → omdev-0.0.0.dev448.dist-info}/RECORD +8 -7
- {omdev-0.0.0.dev446.dist-info → omdev-0.0.0.dev448.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev446.dist-info → omdev-0.0.0.dev448.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev446.dist-info → omdev-0.0.0.dev448.dist-info}/licenses/LICENSE +0 -0
- {omdev-0.0.0.dev446.dist-info → omdev-0.0.0.dev448.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
import dataclasses as dc
|
2
|
+
import os
|
3
|
+
import typing as ta
|
4
|
+
|
5
|
+
from omlish.text.filecache import TextFileCache
|
6
|
+
|
7
|
+
from .base import Precheck
|
8
|
+
from .base import PrecheckContext
|
9
|
+
from .caches import DirWalkCache
|
10
|
+
from .caches import HeadersCache
|
11
|
+
|
12
|
+
|
13
|
+
##
|
14
|
+
|
15
|
+
|
16
|
+
class BlankLinesPrecheck(Precheck['BlankLinesPrecheck.Config']):
|
17
|
+
@dc.dataclass(frozen=True)
|
18
|
+
class Config(Precheck.Config):
|
19
|
+
DEFAULT_FILE_EXTENSIONS: ta.ClassVar[ta.AbstractSet[str]] = frozenset([
|
20
|
+
'py',
|
21
|
+
|
22
|
+
'c',
|
23
|
+
'cc',
|
24
|
+
'cu',
|
25
|
+
'h',
|
26
|
+
'hh',
|
27
|
+
])
|
28
|
+
|
29
|
+
file_extensions: ta.AbstractSet[str] = DEFAULT_FILE_EXTENSIONS
|
30
|
+
|
31
|
+
def __init__(
|
32
|
+
self,
|
33
|
+
context: PrecheckContext,
|
34
|
+
config: Config = Config(),
|
35
|
+
*,
|
36
|
+
dir_walk_cache: DirWalkCache,
|
37
|
+
text_file_cache: TextFileCache,
|
38
|
+
headers_cache: HeadersCache,
|
39
|
+
) -> None:
|
40
|
+
super().__init__(config)
|
41
|
+
|
42
|
+
self._context = context
|
43
|
+
|
44
|
+
self._dir_walk_cache = dir_walk_cache
|
45
|
+
self._text_file_cache = text_file_cache
|
46
|
+
self._headers_cache = headers_cache
|
47
|
+
|
48
|
+
async def _run_file(self, file: str) -> ta.AsyncGenerator[Precheck.Violation]:
|
49
|
+
src = self._text_file_cache.get_entry(file).text()
|
50
|
+
|
51
|
+
if src and not src.splitlines()[0]:
|
52
|
+
yield Precheck.Violation(self, f'source file {file} starts with blank line')
|
53
|
+
|
54
|
+
async def run(self) -> ta.AsyncGenerator[Precheck.Violation]:
|
55
|
+
files = [
|
56
|
+
os.path.join(e.root, f)
|
57
|
+
for src_root in self._context.src_roots
|
58
|
+
for e in self._dir_walk_cache.list_dir(src_root)
|
59
|
+
for f in e.files
|
60
|
+
if '.' in f
|
61
|
+
and any(f.endswith('.' + ext) for ext in self._config.file_extensions)
|
62
|
+
]
|
63
|
+
|
64
|
+
for file in sorted(files):
|
65
|
+
async for v in self._run_file(file):
|
66
|
+
yield v
|
omdev/precheck/main.py
CHANGED
@@ -29,6 +29,7 @@ from omlish.logs import all as logs
|
|
29
29
|
|
30
30
|
from .base import Precheck
|
31
31
|
from .base import PrecheckContext
|
32
|
+
from .blanklines import BlankLinesPrecheck
|
32
33
|
from .caches import AstCache
|
33
34
|
from .caches import DirWalkCache
|
34
35
|
from .caches import HeadersCache
|
@@ -87,6 +88,7 @@ def _check_cmd(args) -> None:
|
|
87
88
|
)
|
88
89
|
|
89
90
|
pc_cfgs: list[Precheck.Config] = [
|
91
|
+
BlankLinesPrecheck.Config(),
|
90
92
|
GitBlacklistPrecheck.Config(),
|
91
93
|
LitePython8Precheck.Config(),
|
92
94
|
ManifestsPrecheck.Config(),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: omdev
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev448
|
4
4
|
Summary: omdev
|
5
5
|
Author: wrmsr
|
6
6
|
License-Expression: BSD-3-Clause
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
14
14
|
Requires-Python: >=3.13
|
15
15
|
Description-Content-Type: text/markdown
|
16
16
|
License-File: LICENSE
|
17
|
-
Requires-Dist: omlish==0.0.0.
|
17
|
+
Requires-Dist: omlish==0.0.0.dev448
|
18
18
|
Provides-Extra: all
|
19
19
|
Requires-Dist: black~=25.1; extra == "all"
|
20
20
|
Requires-Dist: pycparser~=2.23; extra == "all"
|
@@ -216,11 +216,12 @@ omdev/packaging/wheelfile.py,sha256=xv-VpLwhgj1UKounbawAOtkJENRvkJJaHSjD4_zZz_o,
|
|
216
216
|
omdev/precheck/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
217
217
|
omdev/precheck/__main__.py,sha256=UEuS4z5-heIrwTtB-ONe1KeXJdqj8tYXMqWMpuO10so,165
|
218
218
|
omdev/precheck/base.py,sha256=fKdrfakq2u1UU1_JZFnl-non9bIAZMsSkVY1SMYn8xQ,662
|
219
|
+
omdev/precheck/blanklines.py,sha256=VG06NTcFoJjUBn46OXlx4qf5u3vx5l02XiNANBeuQBY,1882
|
219
220
|
omdev/precheck/caches.py,sha256=OZKP20DIj6OpUzdNwrjCufv1GzndEbsc7tLD-qHNv9g,1736
|
220
221
|
omdev/precheck/git.py,sha256=O8rNQZ_vlHec0pOFbK6LOkbly5ZIUYT_HXRMqQX8GaI,774
|
221
222
|
omdev/precheck/imports.py,sha256=3loQxHMrpI0ce4-le77NCSxutLac_5vDW4UDX7KWWg8,2565
|
222
223
|
omdev/precheck/lite.py,sha256=sseaKHMZgMhIEuifZvPJm0-wuRqRUrnyySJfHBMItOM,4737
|
223
|
-
omdev/precheck/main.py,sha256=
|
224
|
+
omdev/precheck/main.py,sha256=hbCouy3Lh1hFmQxktQz-_-LhlT3fnXXFoJhzT_rKX9M,4445
|
224
225
|
omdev/precheck/manifests.py,sha256=dxl7GSJHKjQrR6mbwvj6j92XDGHOpxxEEQ6smJkBEe4,810
|
225
226
|
omdev/precheck/scripts.py,sha256=6nb_lDgyX7u9kdF_BU6ubY01q_jGk96VH9q9gpOieng,1753
|
226
227
|
omdev/precheck/unicode.py,sha256=vMxGb4Kqg1NhFlw1kbgsPtXOnswjREH0ZPZExrrTwCU,3260
|
@@ -323,9 +324,9 @@ omdev/tools/jsonview/resources/jsonview.js,sha256=faDvXDOXKvEvjOuIlz4D3F2ReQXb_b
|
|
323
324
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
324
325
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
325
326
|
omdev/tools/pawk/pawk.py,sha256=ao5mdrpiSU4AZ8mBozoEaV3UVlmVTnRG9wD9XP70MZE,11429
|
326
|
-
omdev-0.0.0.
|
327
|
-
omdev-0.0.0.
|
328
|
-
omdev-0.0.0.
|
329
|
-
omdev-0.0.0.
|
330
|
-
omdev-0.0.0.
|
331
|
-
omdev-0.0.0.
|
327
|
+
omdev-0.0.0.dev448.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
328
|
+
omdev-0.0.0.dev448.dist-info/METADATA,sha256=6e3-_r0f9K4397HETQjkLrJWG5ll0sEc5pKKHh7pWZE,5100
|
329
|
+
omdev-0.0.0.dev448.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
330
|
+
omdev-0.0.0.dev448.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
331
|
+
omdev-0.0.0.dev448.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
332
|
+
omdev-0.0.0.dev448.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|