generated from srijan-deepsource/custom-analyzer-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanalyze.py
28 lines (23 loc) · 738 Bytes
/
analyze.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
from helper import (
make_issue,
prepare_result,
publish_results,
get_files,
)
codepath = os.environ.get("CODE_PATH", "/code")
issues = []
for filepath in get_files(codepath):
with open(filepath, 'rb') as file:
for line_number, line in enumerate(file, start=1):
if line.startswith(b'<<<<<<< HEAD'):
issue = make_issue(
issue_code="MC001",
issue_txt="Possible merge conflict in file",
filepath=filepath.replace(codepath + '/', ''),
line=line_number,
col=0,
)
issues.append(issue)
result = prepare_result(issues)
publish_results(result)