- mythx_cli.analysis package
- mythx_cli.analyze package
- mythx_cli.formatter package
- mythx_cli.group package
- mythx_cli.render package
- mythx_cli.version package
The main runtime of the MythX CLI.
APIErrorCatcherGroup(name=None, commands=None, **attrs)¶
A custom click group to catch API-related errors.
This custom Group implementation catches
MythXAPIErrorexceptions, which get raised when the API returns a non-200 status code. It is used to notify the user about the error that happened instead of triggering an uncaught exception traceback.
It is given to the main CLI entrypoint and propagated to all subcommands.
index_by_filename(issues_list: List[Tuple[mythx_models.response.detected_issues.DetectedIssuesResponse, Optional[mythx_models.response.analysis_input.AnalysisInputResponse]]])¶
Index the given report/input responses by filename.
This will return a simplified, unified representation of the report/input payloads returned by the MythX API. It is a mapping from filename to an iterable of issue objects, which contain the report UUID, SWC ID, SWC title, short and long description, severity, as well as the issue’s line location in the source code.
This representation is meant to be passed on to the respective formatter, which them visualizes the data.
Parameters: issues_list – A list of two-tuples containing report and input responses Returns: A simplified mapping indexing issues by their file path
update_context(context: dict, context_key: str, config: dict, config_key: str, default: Any = None)¶
Update the click context based on a configuration dict.
If the specified key is set in the configuration dict, it will be added/overwrite the respective other key in the click context.
- context – The click context dict to set/overwrite
- context_key – The key in the click context to overwrite
- config – The config to read additional data from
- config_key – The config key to overwrite with
- default – The default value to use if all lookups fail
write_or_print(ctx, data: str, mode='a+') → None¶
Depending on the context, write the given content to stdout or a given file.
- ctx – Click context holding group-level parameters
- data – The data to print or write to a file
- mode – The mode to open the file in (if file output enabled)
Top-level package for MythX CLI.