7
7
log = logging .getLogger ("socket-external-tool" )
8
8
log .addHandler (logging .NullHandler ())
9
9
10
- __all__ = [
11
- "marker" ,
12
- "__version__" ,
13
- "__author__" ,
14
- "log" ,
15
- "base_github"
16
- ]
17
-
18
- __version__ = "1.0.15"
10
+ __all__ = ["marker" , "__version__" , "__author__" , "log" , "base_github" ]
11
+
12
+ __version__ = "1.0.16"
19
13
__author__ = "socket.dev"
20
14
base_github = "https://github.com"
21
15
22
- marker = f "<!--Socket External Tool Runner: REPLACE_ME -->"
16
+ marker = "<!--Socket External Tool Runner: REPLACE_ME -->"
23
17
24
18
25
19
class BaseTool :
@@ -29,12 +23,7 @@ class BaseTool:
29
23
@classmethod
30
24
def process_output (cls , data : dict , cwd : str , plugin_name : str = "" ) -> dict :
31
25
results = data .get (cls .result_key , [])
32
- metrics = {
33
- "tests" : {},
34
- "severities" : {},
35
- "output" : [],
36
- "events" : []
37
- }
26
+ metrics = {"tests" : {}, "severities" : {}, "output" : [], "events" : []}
38
27
39
28
for test in results :
40
29
test_result = cls .result_class (** test , cwd = cwd )
@@ -67,8 +56,9 @@ def get_test_name(test_result):
67
56
return "test_result"
68
57
69
58
@classmethod
70
- def create_output (cls , data : dict , marker : str , repo : str , commit : str , cwd : str , show_unverified = None ) -> (
71
- Union [str , None ], dict ):
59
+ def create_output (
60
+ cls , data : dict , marker : str , repo : str , commit : str , cwd : str , show_unverified = None
61
+ ) -> (Union [str , None ], dict ):
72
62
"""Formats output as properly structured Markdown."""
73
63
74
64
# Determine if the connector supports the show_verified argument
@@ -93,7 +83,8 @@ def create_output(cls, data: dict, marker: str, repo: str, commit: str, cwd: str
93
83
for output in result ["output" ]:
94
84
file_link = (
95
85
f"[{ output .file } ]({ output .url .replace ('REPO_REPLACE' , repo ).replace ('COMMIT_REPLACE' , commit )} )"
96
- if hasattr (output , "url" ) else f"`{ output .file } `"
86
+ if hasattr (output , "url" )
87
+ else f"`{ output .file } `"
97
88
)
98
89
has_first_line = output .__dict__ .get ("has_first_line" , False )
99
90
if has_first_line and not set_first_line :
@@ -105,7 +96,7 @@ def create_output(cls, data: dict, marker: str, repo: str, commit: str, cwd: str
105
96
md .new_line (f"**Severity**: `{ output .__dict__ .get ('severity' , 'N/A' )} `" )
106
97
md .new_line (f"**Filename:** { file_link } " )
107
98
else :
108
- source = output .__dict__ .get (' issue_text' , '' ).replace (' REPLACE_FILE_LINK' , file_link )
99
+ source = output .__dict__ .get (" issue_text" , "" ).replace (" REPLACE_FILE_LINK" , file_link )
109
100
issue_text = f"{ source .replace ('REPO_REPLACE' , repo ).replace ('COMMIT_REPLACE' , commit )} "
110
101
md .new_line (issue_text )
111
102
@@ -120,4 +111,3 @@ def create_output(cls, data: dict, marker: str, repo: str, commit: str, cwd: str
120
111
output_str = md .file_data_text .lstrip ()
121
112
122
113
return result , output_str
123
-
0 commit comments