Skip to content

Commit

Permalink
Check for a valid plugin context before accessing plugin context vari…
Browse files Browse the repository at this point in the history
…ables related to showing tool output. (sscpac#325)
  • Loading branch information
tdenewiler authored Jan 12, 2021
1 parent 6f0644b commit 481a187
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion statick_tool/plugins/tool/cccc_tool_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def scan( # pylint: disable=too-many-branches
print("Couldn't find cccc executable! ({})".format(ex))
return None

if self.plugin_context.args.show_tool_output:
if self.plugin_context and self.plugin_context.args.show_tool_output:
print("{}".format(log_output)) # type: ignore

if self.plugin_context and self.plugin_context.args.output_directory:
Expand Down
2 changes: 1 addition & 1 deletion statick_tool/plugins/tool/clang_tidy_tool_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def scan(self, package: Package, level: str) -> Optional[List[Issue]]:
print("Couldn't find {}! ({})".format(clang_tidy_bin, ex))
return None

if self.plugin_context.args.show_tool_output:
if self.plugin_context and self.plugin_context.args.show_tool_output:
print("{}".format(output))

if self.plugin_context and self.plugin_context.args.output_directory:
Expand Down
2 changes: 1 addition & 1 deletion statick_tool/plugins/tool/cppcheck_tool_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def scan(self, package: Package, level: str) -> Optional[List[Issue]]:
print("{}".format(ex.output))
return None

if self.plugin_context.args.show_tool_output:
if self.plugin_context and self.plugin_context.args.show_tool_output:
print("{}".format(output))

if self.plugin_context and self.plugin_context.args.output_directory:
Expand Down
2 changes: 1 addition & 1 deletion statick_tool/plugins/tool/spotbugs_tool_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def scan(self, package: Package, level: str) -> Optional[List[Issue]]:
print("Couldn't find maven! ({})".format(ex))
return None

if self.plugin_context.args.show_tool_output:
if self.plugin_context and self.plugin_context.args.show_tool_output:
print("{}".format(output))
total_output += output

Expand Down
2 changes: 1 addition & 1 deletion statick_tool/plugins/tool/uncrustify_tool_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def scan( # pylint: disable=too-many-locals, too-many-branches
print("Couldn't find uncrustify executable! ({})".format(ex))
return None

if self.plugin_context.args.show_tool_output:
if self.plugin_context and self.plugin_context.args.show_tool_output:
for output in total_output:
print("{}".format(output))

Expand Down

0 comments on commit 481a187

Please sign in to comment.