codesnake 1.2.1__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.
- codesnake/__init__.py +77 -0
- codesnake/__main__.py +5 -0
- codesnake/_version.py +3 -0
- codesnake/banner.py +76 -0
- codesnake/checker.py +2755 -0
- codesnake/cli.py +168 -0
- codesnake-1.2.1.dist-info/METADATA +377 -0
- codesnake-1.2.1.dist-info/RECORD +12 -0
- codesnake-1.2.1.dist-info/WHEEL +5 -0
- codesnake-1.2.1.dist-info/entry_points.txt +2 -0
- codesnake-1.2.1.dist-info/licenses/LICENSE +21 -0
- codesnake-1.2.1.dist-info/top_level.txt +1 -0
codesnake/__init__.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CodeSnake - Semantic Code Checker for Python 3
|
|
3
|
+
|
|
4
|
+
A static analysis tool that detects security vulnerabilities, code smells,
|
|
5
|
+
anti-patterns, and potential bugs through AST-based semantic analysis.
|
|
6
|
+
|
|
7
|
+
🐍 Strikes at code problems before they bite!
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from ._version import __version__
|
|
11
|
+
from .checker import (
|
|
12
|
+
CheckerConfig,
|
|
13
|
+
ConfigError,
|
|
14
|
+
analyze_files,
|
|
15
|
+
discover_config_file,
|
|
16
|
+
find_repo_root,
|
|
17
|
+
issue_fingerprints,
|
|
18
|
+
normalize_issue_message,
|
|
19
|
+
resolve_jobs,
|
|
20
|
+
EnhancedSemanticChecker,
|
|
21
|
+
Issue,
|
|
22
|
+
SemanticChecker,
|
|
23
|
+
check_file,
|
|
24
|
+
collect_bandit_issues,
|
|
25
|
+
collect_module_exports,
|
|
26
|
+
expand_python_targets,
|
|
27
|
+
filter_issues,
|
|
28
|
+
format_github_report,
|
|
29
|
+
format_issue,
|
|
30
|
+
format_json_report,
|
|
31
|
+
format_sarif_report,
|
|
32
|
+
git_staged_python_files,
|
|
33
|
+
issue_fingerprint,
|
|
34
|
+
issue_ignored_by_pragma,
|
|
35
|
+
load_baseline,
|
|
36
|
+
load_config,
|
|
37
|
+
read_python_source,
|
|
38
|
+
run_check,
|
|
39
|
+
write_baseline,
|
|
40
|
+
)
|
|
41
|
+
from .cli import main
|
|
42
|
+
|
|
43
|
+
__author__ = "CodeSnake Contributors"
|
|
44
|
+
__license__ = "MIT"
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
'__version__',
|
|
48
|
+
'CheckerConfig',
|
|
49
|
+
'ConfigError',
|
|
50
|
+
'analyze_files',
|
|
51
|
+
'discover_config_file',
|
|
52
|
+
'find_repo_root',
|
|
53
|
+
'issue_fingerprints',
|
|
54
|
+
'normalize_issue_message',
|
|
55
|
+
'resolve_jobs',
|
|
56
|
+
'EnhancedSemanticChecker',
|
|
57
|
+
'Issue',
|
|
58
|
+
'SemanticChecker',
|
|
59
|
+
'check_file',
|
|
60
|
+
'collect_bandit_issues',
|
|
61
|
+
'collect_module_exports',
|
|
62
|
+
'expand_python_targets',
|
|
63
|
+
'filter_issues',
|
|
64
|
+
'format_github_report',
|
|
65
|
+
'format_issue',
|
|
66
|
+
'format_json_report',
|
|
67
|
+
'format_sarif_report',
|
|
68
|
+
'git_staged_python_files',
|
|
69
|
+
'issue_fingerprint',
|
|
70
|
+
'issue_ignored_by_pragma',
|
|
71
|
+
'load_baseline',
|
|
72
|
+
'load_config',
|
|
73
|
+
'main',
|
|
74
|
+
'read_python_source',
|
|
75
|
+
'run_check',
|
|
76
|
+
'write_baseline',
|
|
77
|
+
]
|
codesnake/__main__.py
ADDED
codesnake/_version.py
ADDED
codesnake/banner.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CodeSnake ASCII Art and Branding
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from ._version import __version__
|
|
6
|
+
|
|
7
|
+
def print_snake_banner(use_color: bool = True):
|
|
8
|
+
"""Print the CodeSnake ASCII banner, colored unless ``use_color`` is false."""
|
|
9
|
+
# ANSI Color Codes
|
|
10
|
+
GREEN = "\033[92m" if use_color else ""
|
|
11
|
+
DARK_GREEN = "\033[32m" if use_color else ""
|
|
12
|
+
YELLOW = "\033[93m" if use_color else ""
|
|
13
|
+
CYAN = "\033[96m" if use_color else ""
|
|
14
|
+
RESET = "\033[0m" if use_color else ""
|
|
15
|
+
|
|
16
|
+
# The banner split into lines
|
|
17
|
+
lines = [
|
|
18
|
+
r" ____ _ ____ _ ",
|
|
19
|
+
r" / ___|___ __| | ___ / ___| _ __ __ _| | _____ ",
|
|
20
|
+
r"| | / _ \ / _` |/ _ \\___ \| '_ \ / _` | |/ / _ \ ",
|
|
21
|
+
r"| |__| (_) | (_| | __/___) | | | | (_| | < __/ ",
|
|
22
|
+
r" \____\___/ \__,_|\___|____/|_| |_|\__,_|_|\_\___| "
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
# Map colors to each line for a gradient effect
|
|
26
|
+
colors = [CYAN, GREEN, GREEN, DARK_GREEN, YELLOW]
|
|
27
|
+
|
|
28
|
+
print()
|
|
29
|
+
for color, text in zip(colors, lines):
|
|
30
|
+
print(f"{color}{text}{RESET}")
|
|
31
|
+
print(f"{GREEN}{'':^55}🐍 Strikes at code problems before they bite!{RESET}")
|
|
32
|
+
print()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
BANNER = """
|
|
36
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
37
|
+
║ ║
|
|
38
|
+
║ ██████╗ ██████╗ ██████╗ ███████╗███████╗███╗ ██╗ █████╗ ║
|
|
39
|
+
║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔════╝████╗ ██║██╔══██╗ ║
|
|
40
|
+
║ ██║ ██║ ██║██║ ██║█████╗ ███████╗██╔██╗ ██║███████║ ║
|
|
41
|
+
║ ██║ ██║ ██║██║ ██║██╔══╝ ╚════██║██║╚██╗██║██╔══██║ ║
|
|
42
|
+
║ ╚██████╗╚██████╔╝██████╔╝███████╗███████║██║ ╚████║██║ ██║ ║
|
|
43
|
+
║ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝ ║
|
|
44
|
+
║ ║
|
|
45
|
+
║ 🐍 Strikes at code problems before they bite! ║
|
|
46
|
+
║ ║
|
|
47
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
SNAKE_SMALL = r"""
|
|
51
|
+
/^\/^\
|
|
52
|
+
/ o o \ CodeSnake is watching your code...
|
|
53
|
+
( = ^ = )
|
|
54
|
+
) (
|
|
55
|
+
( )
|
|
56
|
+
( ( ) ( ) )
|
|
57
|
+
(__(__)___(__)__)
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
SNAKE_TINY = "🐍 CodeSnake"
|
|
61
|
+
|
|
62
|
+
VERSION = __version__
|
|
63
|
+
TAGLINE = "Semantic Code Checker for Python 3"
|
|
64
|
+
|
|
65
|
+
def print_banner():
|
|
66
|
+
"""Print the CodeSnake banner."""
|
|
67
|
+
print(BANNER)
|
|
68
|
+
|
|
69
|
+
def print_snake():
|
|
70
|
+
"""Print the small snake."""
|
|
71
|
+
print(SNAKE_SMALL)
|
|
72
|
+
|
|
73
|
+
def print_version():
|
|
74
|
+
"""Print version information."""
|
|
75
|
+
print(f"{SNAKE_TINY} v{VERSION}")
|
|
76
|
+
print(TAGLINE)
|