CLASPLint 0.3.0__tar.gz → 0.4.1__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.
- CLASPLint-0.4.1/CLASPLint/__init__.py +78 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint/__main__.py +90 -29
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint/comment_checker.py +262 -156
- CLASPLint-0.4.1/CLASPLint/configuration.py +306 -0
- CLASPLint-0.4.1/CLASPLint/configuration.yaml +638 -0
- CLASPLint-0.4.1/CLASPLint/dict_key_checker.py +264 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint/docstring_checker.py +323 -213
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint/function_checker.py +108 -69
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint/log_checker.py +143 -73
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint/naming_utils.py +175 -215
- CLASPLint-0.4.1/CLASPLint/reporter.py +383 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint/runner.py +109 -66
- CLASPLint-0.4.1/CLASPLint/variable_checker.py +626 -0
- CLASPLint-0.4.1/CLASPLint.egg-info/PKG-INFO +361 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint.egg-info/SOURCES.txt +4 -2
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/LICENSE +1 -1
- CLASPLint-0.4.1/MANIFEST.in +4 -0
- CLASPLint-0.4.1/PKG-INFO +361 -0
- CLASPLint-0.4.1/README.md +332 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/pyproject.toml +6 -3
- CLASPLint-0.4.1/setup.py +156 -0
- CLASPLint-0.3.0/CLASPLint/__init__.py +0 -35
- CLASPLint-0.3.0/CLASPLint/dict_key_checker.py +0 -184
- CLASPLint-0.3.0/CLASPLint/reporter.py +0 -190
- CLASPLint-0.3.0/CLASPLint/variable_checker.py +0 -340
- CLASPLint-0.3.0/CLASPLint.egg-info/PKG-INFO +0 -273
- CLASPLint-0.3.0/MANIFEST.in +0 -3
- CLASPLint-0.3.0/PKG-INFO +0 -273
- CLASPLint-0.3.0/README.md +0 -245
- CLASPLint-0.3.0/setup.py +0 -38
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint.egg-info/dependency_links.txt +0 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint.egg-info/entry_points.txt +0 -0
- /CLASPLint-0.3.0/CLASPLint.egg-info/zip-safe → /CLASPLint-0.4.1/CLASPLint.egg-info/not-zip-safe +0 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/CLASPLint.egg-info/top_level.txt +0 -0
- {CLASPLint-0.3.0 → CLASPLint-0.4.1}/setup.cfg +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
THIS FILE IS CORE PART OF CLASPLINT BY MATT BELFAST BROWN.
|
|
4
|
+
|
|
5
|
+
===============================================================================
|
|
6
|
+
|
|
7
|
+
MODULE : CLASPLint.__init__
|
|
8
|
+
|
|
9
|
+
TYPE : Python Script
|
|
10
|
+
|
|
11
|
+
DESCRIPTION :
|
|
12
|
+
Package entry point and public API surface. Exposes the runner and reporter
|
|
13
|
+
modules as the primary public interface for programmatic use of the CLASP
|
|
14
|
+
3.2 / PEP 2606 static analysis engine.
|
|
15
|
+
|
|
16
|
+
AUTHOR : Matt Belfast Brown
|
|
17
|
+
|
|
18
|
+
CONTACT : thedayofthedo@gmail.com
|
|
19
|
+
|
|
20
|
+
MAINTAINER :
|
|
21
|
+
Matt Belfast Brown (thedayofthedo@gmail.com)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
PROJECT CREATE DATE : 2026-06-17
|
|
25
|
+
|
|
26
|
+
PROJECT VERSION DATE : 2026-07-06
|
|
27
|
+
|
|
28
|
+
PROJECT VERSION : 0.4.1
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
FILE CREATE DATE : 2026-06-17
|
|
32
|
+
|
|
33
|
+
FILE VERSION DATE : 2026-07-06
|
|
34
|
+
|
|
35
|
+
FILE VERSION : 0.4.1
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
STATUS : Stable
|
|
39
|
+
|
|
40
|
+
PYTHON : >=3.8
|
|
41
|
+
|
|
42
|
+
LICENSE : GPL-3.0-only
|
|
43
|
+
|
|
44
|
+
SPDX ID : GPL-3.0-only
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
USAGE :
|
|
48
|
+
import CLASPLint
|
|
49
|
+
|
|
50
|
+
report = CLASPLint.runner.run(["path/to/code/"])
|
|
51
|
+
print(report.summary())
|
|
52
|
+
|
|
53
|
+
===============================================================================
|
|
54
|
+
|
|
55
|
+
THIS PROGRAM IS LICENSED UNDER GPL-3.0-only LICENSE.
|
|
56
|
+
YOU SHOULD HAVE RECEIVED A COPY OF GPL-3.0-only LICENSE.
|
|
57
|
+
|
|
58
|
+
Copyright (C) 2026 Matt Belfast Brown.
|
|
59
|
+
|
|
60
|
+
Sort License:
|
|
61
|
+
|
|
62
|
+
CLASPLint is free software: you can redistribute it and/or modify
|
|
63
|
+
it under the terms of the GNU General Public License as published by
|
|
64
|
+
the Free Software Foundation, version 3 of the License.
|
|
65
|
+
|
|
66
|
+
CLASPLint is distributed in the hope that it will be useful,
|
|
67
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
68
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
69
|
+
GNU General Public License for more details.
|
|
70
|
+
|
|
71
|
+
You should have received a copy of the GNU General Public License
|
|
72
|
+
along with CLASPLint. If not, see <https://www.gnu.org/licenses/>.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
# Define the package version string.
|
|
76
|
+
__version__ = "0.4.1"
|
|
77
|
+
# Expose the runner and reporter modules as the public API.
|
|
78
|
+
__all__ = ["runner", "reporter"]
|
|
@@ -1,29 +1,74 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
"""
|
|
3
|
-
THIS FILE IS PART OF CLASPLINT BY MATT BELFAST BROWN
|
|
4
|
-
CLASPLint.__main__ -- command-line entry point for the CLASP 3.1.1 static analysis tool.
|
|
3
|
+
THIS FILE IS CORE PART OF CLASPLINT BY MATT BELFAST BROWN.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
Create Date: 2026-06-17
|
|
8
|
-
Version Date: 2026-07-01
|
|
9
|
-
Version: 0.3.0
|
|
5
|
+
===============================================================================
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
YOU SHOULD HAVE RECEIVED A COPY OF GPL-3.0 LICENSE.
|
|
7
|
+
MODULE : CLASPLint.__main__
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
TYPE : Python Script
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
the Free Software Foundation, version 3 of the License.
|
|
11
|
+
DESCRIPTION :
|
|
12
|
+
Command-line entry point for the CLASP 3.2 / PEP 2606 static analysis tool.
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
22
|
-
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
-
GNU General Public License for more details.
|
|
14
|
+
AUTHOR : Matt Belfast Brown
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
CONTACT : thedayofthedo@gmail.com
|
|
17
|
+
|
|
18
|
+
MAINTAINER :
|
|
19
|
+
Matt Belfast Brown (thedayofthedo@gmail.com)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
PROJECT CREATE DATE : 2026-06-17
|
|
23
|
+
|
|
24
|
+
PROJECT VERSION DATE : 2026-07-06
|
|
25
|
+
|
|
26
|
+
PROJECT VERSION : 0.4.1
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
FILE CREATE DATE : 2026-06-17
|
|
30
|
+
|
|
31
|
+
FILE VERSION DATE : 2026-07-06
|
|
32
|
+
|
|
33
|
+
FILE VERSION : 0.4.1
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
STATUS : Stable
|
|
37
|
+
|
|
38
|
+
PYTHON : >=3.8
|
|
39
|
+
|
|
40
|
+
LICENSE : GPL-3.0-only
|
|
41
|
+
|
|
42
|
+
SPDX ID : GPL-3.0-only
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
USAGE :
|
|
46
|
+
CLASPLint path/to/file.py
|
|
47
|
+
|
|
48
|
+
CLASPLint --quiet src/
|
|
49
|
+
|
|
50
|
+
CLASPLint --category variable src/
|
|
51
|
+
|
|
52
|
+
===============================================================================
|
|
53
|
+
|
|
54
|
+
THIS PROGRAM IS LICENSED UNDER GPL-3.0-only LICENSE.
|
|
55
|
+
YOU SHOULD HAVE RECEIVED A COPY OF GPL-3.0-only LICENSE.
|
|
56
|
+
|
|
57
|
+
Copyright (C) 2026 Matt Belfast Brown.
|
|
58
|
+
|
|
59
|
+
Sort License:
|
|
60
|
+
|
|
61
|
+
CLASPLint is free software: you can redistribute it and/or modify
|
|
62
|
+
it under the terms of the GNU General Public License as published by
|
|
63
|
+
the Free Software Foundation, version 3 of the License.
|
|
64
|
+
|
|
65
|
+
CLASPLint is distributed in the hope that it will be useful,
|
|
66
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
67
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
68
|
+
GNU General Public License for more details.
|
|
69
|
+
|
|
70
|
+
You should have received a copy of the GNU General Public License
|
|
71
|
+
along with CLASPLint. If not, see <https://www.gnu.org/licenses/>.
|
|
27
72
|
"""
|
|
28
73
|
|
|
29
74
|
import argparse
|
|
@@ -36,13 +81,20 @@ from . import __version__
|
|
|
36
81
|
|
|
37
82
|
|
|
38
83
|
def _init_build_parser_function_() -> argparse.ArgumentParser:
|
|
39
|
-
"""Construct the argument parser for the CLASPLint
|
|
84
|
+
"""Construct the argument parser for the CLASPLint command-line interface.
|
|
85
|
+
|
|
86
|
+
Registers positional paths, --version, --no-recursive, --quiet,
|
|
87
|
+
and --category arguments on a new ArgumentParser instance.
|
|
88
|
+
|
|
89
|
+
:return: A configured ArgumentParser ready for parse_args.
|
|
90
|
+
:rtype: argparse.ArgumentParser
|
|
91
|
+
"""
|
|
40
92
|
# Create the top-level argument parser with a description.
|
|
41
93
|
parser_result = argparse.ArgumentParser(
|
|
42
94
|
# Set the program name displayed in help text.
|
|
43
95
|
prog="CLASPLint",
|
|
44
96
|
# Provide a description of what the tool does.
|
|
45
|
-
description="CLASP 3.
|
|
97
|
+
description="CLASP 3.2 / PEP 2606 static analysis tool. "
|
|
46
98
|
# Continue the description across multiple lines for readability.
|
|
47
99
|
"Checks variable, dict key, function, class naming "
|
|
48
100
|
# Complete the tool description with comment and log conventions.
|
|
@@ -96,15 +148,24 @@ def _init_build_parser_function_() -> argparse.ArgumentParser:
|
|
|
96
148
|
|
|
97
149
|
|
|
98
150
|
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
99
|
-
"""Execute the CLASPLint analysis and return an exit code
|
|
151
|
+
"""Execute the CLASPLint analysis and return an exit code.
|
|
152
|
+
|
|
153
|
+
Parses command-line arguments, resolves input paths, dispatches
|
|
154
|
+
to the runner, applies category filters, and prints the report.
|
|
155
|
+
|
|
156
|
+
:param argv: Optional list of command-line argument strings.
|
|
157
|
+
:type argv: Optional[Sequence[str]]
|
|
158
|
+
:return: Exit code 0 when no violations are found, 1 otherwise.
|
|
159
|
+
:rtype: int
|
|
160
|
+
"""
|
|
100
161
|
# Build and parse command-line arguments.
|
|
101
|
-
|
|
162
|
+
command_parser = _init_build_parser_function_()
|
|
102
163
|
# Parse the provided arguments or default to sys.argv.
|
|
103
|
-
|
|
164
|
+
parsed_options = command_parser.parse_args(argv)
|
|
104
165
|
# Resolve all input paths to absolute paths for consistent processing.
|
|
105
166
|
list_resolved = []
|
|
106
167
|
# Iterate over each provided path argument.
|
|
107
|
-
for string_path in
|
|
168
|
+
for string_path in parsed_options.paths:
|
|
108
169
|
# Convert the path to an absolute path.
|
|
109
170
|
string_absolute = os.path.abspath(string_path)
|
|
110
171
|
# Only include paths that exist on the filesystem.
|
|
@@ -118,23 +179,23 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
|
118
179
|
# Return exit code 2 for usage errors.
|
|
119
180
|
return 2
|
|
120
181
|
# Determine whether to recurse into subdirectories.
|
|
121
|
-
bool_recursive = not
|
|
182
|
+
bool_recursive = not parsed_options.no_recursive
|
|
122
183
|
# Run all checkers on the resolved paths.
|
|
123
184
|
report_result = run(list_resolved, bool_recursive=bool_recursive)
|
|
124
185
|
# Apply category filter if one was specified.
|
|
125
|
-
if
|
|
186
|
+
if parsed_options.category:
|
|
126
187
|
# Filter violations to only the requested category.
|
|
127
188
|
report_result.list_violations = [
|
|
128
189
|
# Iterate over each violation to check against the filter.
|
|
129
|
-
|
|
190
|
+
violation_item for violation_item in report_result.list_violations
|
|
130
191
|
# Keep only violations matching the requested category filter.
|
|
131
|
-
if
|
|
192
|
+
if violation_item.string_category == parsed_options.category
|
|
132
193
|
# Close the filtered list comprehension.
|
|
133
194
|
]
|
|
134
195
|
# Print the summary line to stdout.
|
|
135
196
|
print(report_result.summary())
|
|
136
197
|
# Print individual violations unless quiet mode is active.
|
|
137
|
-
if report_result.list_violations and not
|
|
198
|
+
if report_result.list_violations and not parsed_options.quiet:
|
|
138
199
|
# Add a blank line before the violation listing.
|
|
139
200
|
print()
|
|
140
201
|
# Print the formatted violation details.
|