CLASPLint 0.1.0__tar.gz → 0.3.0__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.3.0/CLASPLint/__init__.py +35 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/CLASPLint/__main__.py +55 -4
- CLASPLint-0.3.0/CLASPLint/comment_checker.py +702 -0
- CLASPLint-0.3.0/CLASPLint/dict_key_checker.py +184 -0
- CLASPLint-0.3.0/CLASPLint/docstring_checker.py +803 -0
- CLASPLint-0.3.0/CLASPLint/function_checker.py +278 -0
- CLASPLint-0.3.0/CLASPLint/log_checker.py +445 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/CLASPLint/naming_utils.py +179 -26
- CLASPLint-0.3.0/CLASPLint/reporter.py +190 -0
- CLASPLint-0.3.0/CLASPLint/runner.py +242 -0
- CLASPLint-0.3.0/CLASPLint/variable_checker.py +340 -0
- CLASPLint-0.3.0/CLASPLint.egg-info/PKG-INFO +273 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/CLASPLint.egg-info/SOURCES.txt +2 -0
- CLASPLint-0.3.0/LICENSE +688 -0
- CLASPLint-0.3.0/MANIFEST.in +3 -0
- CLASPLint-0.3.0/PKG-INFO +273 -0
- CLASPLint-0.3.0/README.md +245 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/pyproject.toml +3 -4
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/setup.py +2 -3
- CLASPLint-0.1.0/CLASPLint/__init__.py +0 -6
- CLASPLint-0.1.0/CLASPLint/comment_checker.py +0 -227
- CLASPLint-0.1.0/CLASPLint/dict_key_checker.py +0 -87
- CLASPLint-0.1.0/CLASPLint/function_checker.py +0 -95
- CLASPLint-0.1.0/CLASPLint/log_checker.py +0 -177
- CLASPLint-0.1.0/CLASPLint/reporter.py +0 -90
- CLASPLint-0.1.0/CLASPLint/runner.py +0 -159
- CLASPLint-0.1.0/CLASPLint/variable_checker.py +0 -159
- CLASPLint-0.1.0/CLASPLint.egg-info/PKG-INFO +0 -238
- CLASPLint-0.1.0/LICENSE +0 -15
- CLASPLint-0.1.0/PKG-INFO +0 -238
- CLASPLint-0.1.0/README.md +0 -209
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/CLASPLint.egg-info/dependency_links.txt +0 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/CLASPLint.egg-info/entry_points.txt +0 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/CLASPLint.egg-info/top_level.txt +0 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/CLASPLint.egg-info/zip-safe +0 -0
- {CLASPLint-0.1.0 → CLASPLint-0.3.0}/setup.cfg +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
THIS FILE IS PART OF CLASPLINT BY MATT BELFAST BROWN
|
|
4
|
+
CLASPLint.__init__ -- Package entry point and public API surface.
|
|
5
|
+
|
|
6
|
+
Exposes the runner and reporter modules as the primary public interface for
|
|
7
|
+
programmatic use of the CLASP 3.1.1 / PEP 2606 static analysis engine.
|
|
8
|
+
|
|
9
|
+
Author: Matt Belfast Brown
|
|
10
|
+
Create Date: 2026-06-17
|
|
11
|
+
Version Date: 2026-07-01
|
|
12
|
+
Version: 0.3.0
|
|
13
|
+
|
|
14
|
+
THIS PROGRAM IS LICENSED UNDER GPL-3.0
|
|
15
|
+
YOU SHOULD HAVE RECEIVED A COPY OF GPL-3.0 LICENSE.
|
|
16
|
+
|
|
17
|
+
Copyright (C) 2026 Matt Belfast Brown
|
|
18
|
+
|
|
19
|
+
CLASPLint is free software: you can redistribute it and/or modify
|
|
20
|
+
it under the terms of the GNU General Public License as published by
|
|
21
|
+
the Free Software Foundation, version 3 of the License.
|
|
22
|
+
|
|
23
|
+
CLASPLint is distributed in the hope that it will be useful,
|
|
24
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
25
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
26
|
+
GNU General Public License for more details.
|
|
27
|
+
|
|
28
|
+
You should have received a copy of the GNU General Public License
|
|
29
|
+
along with CLASPLint. If not, see <https://www.gnu.org/licenses/>.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
# Define the package version string.
|
|
33
|
+
__version__ = "0.3.0"
|
|
34
|
+
# Expose the runner and reporter modules as the public API.
|
|
35
|
+
__all__ = ["runner", "reporter"]
|
|
@@ -1,8 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
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.
|
|
5
|
+
|
|
6
|
+
Author: Matt Belfast Brown
|
|
7
|
+
Create Date: 2026-06-17
|
|
8
|
+
Version Date: 2026-07-01
|
|
9
|
+
Version: 0.3.0
|
|
10
|
+
|
|
11
|
+
THIS PROGRAM IS LICENSED UNDER GPL-3.0
|
|
12
|
+
YOU SHOULD HAVE RECEIVED A COPY OF GPL-3.0 LICENSE.
|
|
13
|
+
|
|
14
|
+
Copyright (C) 2026 Matt Belfast Brown
|
|
15
|
+
|
|
16
|
+
CLASPLint is free software: you can redistribute it and/or modify
|
|
17
|
+
it under the terms of the GNU General Public License as published by
|
|
18
|
+
the Free Software Foundation, version 3 of the License.
|
|
19
|
+
|
|
20
|
+
CLASPLint is distributed in the hope that it will be useful,
|
|
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.
|
|
24
|
+
|
|
25
|
+
You should have received a copy of the GNU General Public License
|
|
26
|
+
along with CLASPLint. If not, see <https://www.gnu.org/licenses/>.
|
|
27
|
+
"""
|
|
2
28
|
|
|
3
29
|
import argparse
|
|
4
30
|
import sys
|
|
5
31
|
import os
|
|
32
|
+
from typing import Optional, Sequence
|
|
6
33
|
|
|
7
34
|
from .runner import run
|
|
8
35
|
from . import __version__
|
|
@@ -12,42 +39,63 @@ def _init_build_parser_function_() -> argparse.ArgumentParser:
|
|
|
12
39
|
"""Construct the argument parser for the CLASPLint CLI."""
|
|
13
40
|
# Create the top-level argument parser with a description.
|
|
14
41
|
parser_result = argparse.ArgumentParser(
|
|
42
|
+
# Set the program name displayed in help text.
|
|
15
43
|
prog="CLASPLint",
|
|
16
|
-
|
|
44
|
+
# Provide a description of what the tool does.
|
|
45
|
+
description="CLASP 3.1.1 / PEP 2606 static analysis tool. "
|
|
46
|
+
# Continue the description across multiple lines for readability.
|
|
17
47
|
"Checks variable, dict key, function, class naming "
|
|
48
|
+
# Complete the tool description with comment and log conventions.
|
|
18
49
|
"and comment/log conventions.",
|
|
50
|
+
# Close the ArgumentParser constructor call.
|
|
19
51
|
)
|
|
20
52
|
# Accept one or more file or directory paths as positional arguments.
|
|
21
53
|
parser_result.add_argument(
|
|
54
|
+
# Accept zero or more path strings as positional arguments.
|
|
22
55
|
"paths", nargs="*", default=["."],
|
|
56
|
+
# Provide the help text for the paths' argument.
|
|
23
57
|
help="Python files or directories to check (default: current directory).",
|
|
58
|
+
# Close the first add_argument call.
|
|
24
59
|
)
|
|
25
60
|
# Provide a --version flag to display the tool version.
|
|
26
61
|
parser_result.add_argument(
|
|
62
|
+
# Use the version action to print the version string and exit.
|
|
27
63
|
"--version", action="version",
|
|
64
|
+
# Construct the version message from the package version.
|
|
28
65
|
version=f"CLASPLint {__version__}",
|
|
66
|
+
# Close the second add_argument call.
|
|
29
67
|
)
|
|
30
68
|
# Provide a flag to disable recursive directory traversal.
|
|
31
69
|
parser_result.add_argument(
|
|
70
|
+
# Store True when --no-recursive is passed on the command line.
|
|
32
71
|
"--no-recursive", action="store_true",
|
|
72
|
+
# Provide the help text for the no-recursive flag.
|
|
33
73
|
help="Do not recursively check subdirectories.",
|
|
74
|
+
# Close the third add_argument call.
|
|
34
75
|
)
|
|
35
76
|
# Provide a quiet mode that suppresses per-violation output.
|
|
36
77
|
parser_result.add_argument(
|
|
78
|
+
# Support both --quiet and -q flags for convenience.
|
|
37
79
|
"--quiet", "-q", action="store_true",
|
|
80
|
+
# Provide the help text for the quiet flag.
|
|
38
81
|
help="Suppress individual violation output; show only summary.",
|
|
82
|
+
# Close the fourth add_argument call.
|
|
39
83
|
)
|
|
40
84
|
# Provide a category filter to report only specific violation types.
|
|
41
85
|
parser_result.add_argument(
|
|
86
|
+
# Accept --category or -c with a choice of violation types.
|
|
42
87
|
"--category", "-c",
|
|
43
|
-
|
|
88
|
+
# Restrict the value to the five supported violation categories.
|
|
89
|
+
choices=["variable", "dict_key", "function", "comment", "log", "docstring"],
|
|
90
|
+
# Provide the help text for the category filter.
|
|
44
91
|
help="Only report violations of a specific category.",
|
|
92
|
+
# Close the fifth add_argument call.
|
|
45
93
|
)
|
|
46
94
|
# Return the fully configured argument parser.
|
|
47
95
|
return parser_result
|
|
48
96
|
|
|
49
97
|
|
|
50
|
-
def main(argv:
|
|
98
|
+
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
51
99
|
"""Execute the CLASPLint analysis and return an exit code (0 = clean, 1 = violations)."""
|
|
52
100
|
# Build and parse command-line arguments.
|
|
53
101
|
parser = _init_build_parser_function_()
|
|
@@ -61,6 +109,7 @@ def main(argv: list = None) -> int:
|
|
|
61
109
|
string_absolute = os.path.abspath(string_path)
|
|
62
110
|
# Only include paths that exist on the filesystem.
|
|
63
111
|
if os.path.exists(string_absolute):
|
|
112
|
+
# Add the resolved absolute path to the list.
|
|
64
113
|
list_resolved.append(string_absolute)
|
|
65
114
|
# Report an error if no valid paths were found.
|
|
66
115
|
if not list_resolved:
|
|
@@ -76,9 +125,11 @@ def main(argv: list = None) -> int:
|
|
|
76
125
|
if args.category:
|
|
77
126
|
# Filter violations to only the requested category.
|
|
78
127
|
report_result.list_violations = [
|
|
128
|
+
# Iterate over each violation to check against the filter.
|
|
79
129
|
v for v in report_result.list_violations
|
|
80
130
|
# Keep only violations matching the requested category filter.
|
|
81
131
|
if v.string_category == args.category
|
|
132
|
+
# Close the filtered list comprehension.
|
|
82
133
|
]
|
|
83
134
|
# Print the summary line to stdout.
|
|
84
135
|
print(report_result.summary())
|