Skip to content

Commit ec47516

Browse files
authored
Merge pull request #98 from inyeongjang/feat/language-python
Feat/language python : 분석 언어 변경
2 parents 1658981 + c7a0e53 commit ec47516

6 files changed

Lines changed: 10 additions & 17 deletions

File tree

.env.example

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,5 @@ DISCORD_WEBHOOK_URL=your-discord-webhook
66
SLACK_WEBHOOK_URL=your-slack-webhook
77
SNYK_TOKEN=your_token_here
88

9-
# File Extensions to collect from Github
10-
GITHUB_EXTENSIONS=.js,.mjs,.jsx,.ts
11-
12-
# Semgrep Rule (default : JavaScript)
13-
SEMGREP_RULE=p/javascript
14-
159
# Server URL
16-
LOG_API_URL=https://autofic-core-kmw6.onrender.com/
10+
LOG_API_URL=https://autofic-core-kmw6.onrender.com/

src/autofic_core/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self, returncode, stdout=None, stderr=None):
5555

5656
class SnykCodeErrorMessages:
5757
TOKEN_MISSING = "[ ERROR ] SNYK_TOKEN environment variable not set."
58-
NO_JS_FILES_FOUND = "[ ERROR ] No JavaScript/TypeScript files found to analyze."
58+
NO_PY_FILES_FOUND = "[ ERROR ] No Python files found to analyze."
5959
CLI_NOT_FOUND = "[ ERROR ] Unable to locate Snyk CLI. Please install or set SNYK_CMD_PATH."
6060

6161
# prompt_generator.py

src/autofic_core/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def run(self):
8282
task = progress.add_task(description, total=100)
8383

8484
start = time.time()
85-
runner = SemgrepRunner(repo_path=str(self.repo_path), rule="p/javascript")
85+
runner = SemgrepRunner(repo_path=str(self.repo_path), rule="p/python")
8686
result = runner.run_semgrep()
8787
end = time.time()
8888

src/autofic_core/sast/codeql/runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ class CodeQLRunner:
3434
3535
Attributes:
3636
repo_path (Path): Path to the cloned repository.
37-
language (str): Programming language to analyze (default: "javascript").
38-
query_pack (str): Query pack path (e.g., "codeql/javascript-queries").
37+
language (str): Programming language to analyze (default: "python").
38+
query_pack (str): Query pack path (e.g., "codeql/python-queries").
3939
db_path (Path): Path to the CodeQL database.
4040
result_dir (Path): Directory for storing analysis results.
4141
output_path (Path): Path to the generated SARIF report.
4242
log_path (Path): Path to the log file for subprocess outputs.
4343
"""
4444

45-
def __init__(self, repo_path: Path, language: str = "javascript"):
45+
def __init__(self, repo_path: Path, language: str = "python"):
4646
self.repo_path = Path(repo_path).resolve()
4747
self.language = language.lower()
4848
self.query_pack = f"codeql/{self.language}-queries"

src/autofic_core/sast/semgrep/runner.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ def run_semgrep(self) -> SemgrepResult:
3131
"semgrep",
3232
"--config", self.rule,
3333
"--json",
34-
"--include", "*.js",
35-
"--include", "*.jsx",
36-
"--include", "*.mjs",
34+
"--include", "*.pyi",
35+
"--include", "*.py",
3736
self.repo_path
3837
]
3938

src/autofic_core/sast/snykcode/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def run_snykcode(self) -> SnykCodeResult:
7676
# Simulate `snyk auth`
7777
self._ensure_authenticated(snyk_cmd, env)
7878

79-
valid_exts = {".js", ".jsx", ".ts", ".mjs"}
79+
valid_exts = {".py", ".pyi"}
8080
target_files = [
8181
p for p in self.repo_path.rglob("*")
8282
if p.suffix in valid_exts and p.is_file()
@@ -85,7 +85,7 @@ def run_snykcode(self) -> SnykCodeResult:
8585
if not target_files:
8686
return SnykCodeResult(
8787
stdout="",
88-
stderr=SnykCodeErrorMessages.NO_JS_FILES_FOUND,
88+
stderr=SnykCodeErrorMessages.NO_PY_FILES_FOUND,
8989
returncode=1
9090
)
9191

0 commit comments

Comments
 (0)