statick_tool package¶
Module Contents¶
Making code quality easier.
Subpackages¶
- statick_tool.plugins package
- Module contents
- Subpackages
- statick_tool.plugins.discovery package
- Module contents
- Submodules
- statick_tool.plugins.discovery.c_discovery_plugin module
- statick_tool.plugins.discovery.cmake_discovery_plugin module
- statick_tool.plugins.discovery.groovy_discovery_plugin module
- statick_tool.plugins.discovery.java_discovery_plugin module
- statick_tool.plugins.discovery.maven_discovery_plugin module
- statick_tool.plugins.discovery.perl_discovery_plugin module
- statick_tool.plugins.discovery.python_discovery_plugin module
- statick_tool.plugins.discovery.ros_discovery_plugin module
- statick_tool.plugins.discovery.shell_discovery_plugin module
- statick_tool.plugins.discovery.xml_discovery_plugin module
- statick_tool.plugins.discovery.yaml_discovery_plugin module
- statick_tool.plugins.reporting package
- Module contents
- Submodules
- statick_tool.plugins.reporting.code_climate_reporting_plugin module
- statick_tool.plugins.reporting.do_nothing_reporting_plugin module
- statick_tool.plugins.reporting.json_reporting_plugin module
- statick_tool.plugins.reporting.print_to_console_reporting_plugin module
- statick_tool.plugins.reporting.write_jenkins_warnings_ng_reporting_plugin module
- statick_tool.plugins.tool package
- Module contents
- Submodules
- statick_tool.plugins.tool.bandit_tool_plugin module
- statick_tool.plugins.tool.black_tool_plugin module
- statick_tool.plugins.tool.catkin_lint_tool_plugin module
- statick_tool.plugins.tool.cccc_tool_plugin module
- statick_tool.plugins.tool.clang_format_tool_plugin module
- statick_tool.plugins.tool.clang_tidy_tool_plugin module
- statick_tool.plugins.tool.cmakelint_tool_plugin module
- statick_tool.plugins.tool.cppcheck_tool_plugin module
- statick_tool.plugins.tool.cpplint_tool_plugin module
- statick_tool.plugins.tool.docformatter_tool_plugin module
- statick_tool.plugins.tool.do_nothing_tool_plugin module
- statick_tool.plugins.tool.flawfinder_tool_plugin module
- statick_tool.plugins.tool.groovylint_tool_plugin module
- statick_tool.plugins.tool.isort_tool_plugin module
- statick_tool.plugins.tool.lizard_tool_plugin module
- statick_tool.plugins.tool.make_tool_plugin module
- statick_tool.plugins.tool.mypy_tool_plugin module
- statick_tool.plugins.tool.perlcritic_tool_plugin module
- statick_tool.plugins.tool.pycodestyle_tool_plugin module
- statick_tool.plugins.tool.pydocstyle_tool_plugin module
- statick_tool.plugins.tool.pyflakes_tool_plugin module
- statick_tool.plugins.tool.pylint_tool_plugin module
- statick_tool.plugins.tool.ruff_tool_plugin module
- statick_tool.plugins.tool.shellcheck_tool_plugin module
- statick_tool.plugins.tool.shellcheck_tool_plugin module
- statick_tool.plugins.tool.spotbugs_tool_plugin module
- statick_tool.plugins.tool.uncrustify_tool_plugin module
- statick_tool.plugins.tool.xmllint_tool_plugin module
- statick_tool.plugins.tool.yamllint_tool_plugin module
- statick_tool.plugins.discovery package
Submodules¶
statick_tool.args module¶
Custom argument handling.
Enable usage of user-paths argument before parsing other arguments.
statick_tool.config module¶
Manages which plugins are run for each statick scan level.
Sets what flags are used for each plugin at those levels.
-
class
statick_tool.config.
Config
(base_file: Optional[str], user_file: Optional[str] = '', default_level: Optional[str] = 'default')[source]¶ Bases:
object
Manages which plugins are run for each statick scan level.
Sets what flags are used for each plugin at those levels.
-
get_discovery_config
(plugin: str, level: str, key: str, default: Optional[str] = None) → Optional[str][source]¶ Get discovery flags to use for a plugin at a certain level.
-
get_enabled_discovery_plugins
(level: str) → List[str][source]¶ Get what discovery plugins are enabled for a certain level.
-
get_enabled_plugins
(level: str, plugin_type: str) → List[str][source]¶ Get what plugins are enabled for a certain level.
-
get_enabled_reporting_plugins
(level: str) → List[str][source]¶ Get what reporting plugins are enabled for a certain level.
-
get_enabled_tool_plugins
(level: str) → List[str][source]¶ Get what tool plugins are enabled for a certain level.
-
get_plugin_config
(plugin_type: str, plugin: str, level: str, key: str, default: Optional[str] = None) → Union[str, Any, None][source]¶ Get flags to use for a plugin at a certain level.
-
get_reporting_config
(plugin: str, level: str, key: str, default: Optional[str] = None) → Optional[str][source]¶ Get reporting flags to use for a plugin at a certain level.
-
get_tool_config
(plugin: str, level: str, key: str, default: Optional[str] = None) → Optional[str][source]¶ Get tool flags to use for a plugin at a certain level.
-
statick_tool.discovery_plugin module¶
Discovery plugin.
-
class
statick_tool.discovery_plugin.
DiscoveryPlugin
[source]¶ Bases:
yapsy.IPlugin.IPlugin
Default implementation of discovery plugin.
-
static
file_command_exists
() → bool[source]¶ Return whether the ‘file’ command is available on $PATH.
-
find_files
(package: statick_tool.package.Package) → None[source]¶ Walk the package path exactly once to discover files for analysis.
-
classmethod
get_discovery_dependencies
() → List[str][source]¶ Get a list of discovery plugins that must run before this one.
-
get_file_cmd_output
(full_path: str) → str[source]¶ Run the file command (if it exists) on the supplied path.
The output from the file command is converted to lowercase. There are two recommended ways to check it: 1. When searching for a single string just use the python “in” operator:
if “search string” in file_dict[“file_cmd_out”]:When searching for multiple different strings, use the any() function:
expected_output = (“output_1”, “output_2”) if any(item in file_dict[“file_cmd_out”] for item in expected_output):
-
plugin_context
= None¶
-
static
statick_tool.exceptions module¶
Exceptions interface.
Exceptions allow for ignoring detected issues. This is commonly done to suppress false positives or to ignore issues that a group has no intention of addressing.
The two types of exceptions are a list of filenames or regular expressions. If using filename matching for the exception it is required that the reported issue contain the absolute path to the file containing the issue to be ignored. The path for the issue is set in the tool plugin that generates the issues.
-
class
statick_tool.exceptions.
Exceptions
(filename: Optional[str])[source]¶ Bases:
object
Interface for applying exceptions.
-
filter_file_exceptions
(package: statick_tool.package.Package, exceptions: List[Any], issues: Dict[str, List[statick_tool.issue.Issue]]) → Dict[str, List[statick_tool.issue.Issue]][source]¶ Filter issues based on file pattern exceptions list.
-
filter_file_exceptions_early
(package: statick_tool.package.Package, file_list: List[str]) → List[str][source]¶ Filter files based on file pattern exceptions list.
Only filters files which have tools=all, intended for use after the discovery plugins have been run (so that Statick doesn’t run the tool plugins against files which will be ignored anyway).
-
filter_issues
(package: statick_tool.package.Package, issues: Dict[str, List[statick_tool.issue.Issue]]) → Dict[str, List[statick_tool.issue.Issue]][source]¶ Filter issues based on exceptions list.
-
filter_nolint
(issues: Dict[str, List[statick_tool.issue.Issue]]) → Dict[str, List[statick_tool.issue.Issue]][source]¶ Filter out lines that have an explicit NOLINT on them.
Sometimes the tools themselves don’t properly filter these out if there is a complex macro or something.
-
classmethod
filter_regex_exceptions
(exceptions: List[Any], issues: Dict[str, List[statick_tool.issue.Issue]]) → Dict[str, List[statick_tool.issue.Issue]][source]¶ Filter issues based on message regex exceptions list.
-
statick_tool.issue module¶
Issue interface.
-
class
statick_tool.issue.
Issue
(filename, line_number, tool, issue_type, severity, message, cert_reference)¶ Bases:
tuple
-
cert_reference
¶ Alias for field number 6
-
filename
¶ Alias for field number 0
-
issue_type
¶ Alias for field number 3
-
line_number
¶ Alias for field number 1
-
message
¶ Alias for field number 5
-
severity
¶ Alias for field number 4
-
tool
¶ Alias for field number 2
-
statick_tool.package module¶
Package interface.
statick_tool.plugin_context module¶
Plugin context interface.
statick_tool.profile module¶
Manages which scan levels are run for packages.
statick_tool.resources module¶
Manages plugin and file lookup chaining.
Handles chaining user directories and the default statick resource directory.
-
class
statick_tool.resources.
Resources
(paths: List[str])[source]¶ Bases:
object
Manages plugin and file lookup chaining.
Handles chaining user directories and the default statick resource directory.
statick_tool.statick module¶
Code analysis front-end.
-
class
statick_tool.statick.
Statick
(user_paths: List[str])[source]¶ Bases:
object
Code analysis front-end.
-
add_timing
(package: str, name: str, plugin_type: str, duration: str) → None[source]¶ Add an entry to the timings list.
-
get_level
(path: str, args: argparse.Namespace) → Optional[str][source]¶ Get level to scan package at.
-
get_timings
() → List[statick_tool.timing.Timing][source]¶ Return list of timings for each component.
-
run
(path: str, args: argparse.Namespace, start_time: Optional[float] = None) → Tuple[Optional[Dict[str, List[statick_tool.issue.Issue]]], bool][source]¶ Run scan tools against targets on path.
-
run_workspace
(parsed_args: argparse.Namespace, start_time: Optional[float] = None) → Tuple[Optional[Dict[str, List[statick_tool.issue.Issue]]], bool][source]¶ Run statick on a workspace.
-
statick_tool.tool_plugin module¶
Tool plugin.
-
class
statick_tool.tool_plugin.
ToolPlugin
[source]¶ Bases:
yapsy.IPlugin.IPlugin
Default implementation of tool plugin.
-
static
command_exists
(command: str) → bool[source]¶ Return whether a particular command is available on $PATH.
-
classmethod
get_tool_dependencies
() → List[str][source]¶ Get a list of tools that must run before this one.
-
get_user_flags
(level: str, name: Optional[str] = None) → List[str][source]¶ Get the user-defined extra flags for a specific tool/level combination.
-
static
is_valid_executable
(path: str) → bool[source]¶ Return whether a provided command exists and is executable.
If the provided path has an extension on it, don’t change it, otherwise try adding common extensions.
-
parse_output
(total_output: List[str], package: Optional[statick_tool.package.Package] = None) → List[statick_tool.issue.Issue][source]¶ Parse tool output and report issues.
-
plugin_context
= None¶
-
process_files
(package: statick_tool.package.Package, level: str, files: List[str], user_flags: List[str]) → Optional[List[str]][source]¶ Run tool and gather output.
-
static