coalib.results.result_actions package

Submodules

coalib.results.result_actions.ApplyPatchAction module

class coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction[source]

Bases: coalib.results.result_actions.ResultAction.ResultAction

SUCCESS_MESSAGE = 'Patch applied successfully.'
apply(result, original_file_dict, file_diff_dict, no_orig: bool = False)[source]

Apply patch

Parameters:no_orig – Whether or not to create .orig backup files
static is_applicable(result, original_file_dict, file_diff_dict)

coalib.results.result_actions.IgnoreResultAction module

class coalib.results.result_actions.IgnoreResultAction.IgnoreResultAction[source]

Bases: coalib.results.result_actions.ResultAction.ResultAction

SUCCESS_MESSAGE = 'An ignore comment was added to your source code.'
apply(result, original_file_dict, file_diff_dict, language: str, no_orig: bool = False)[source]

Add ignore comment

static is_applicable(result, original_file_dict, file_diff_dict)[source]

For being applicable, the result has to point to a number of files that have to exist i.e. have not been previously deleted.

coalib.results.result_actions.OpenEditorAction module

class coalib.results.result_actions.OpenEditorAction.OpenEditorAction[source]

Bases: coalib.results.result_actions.ResultAction.ResultAction

SUCCESS_MESSAGE = 'Changes saved successfully.'
apply(result, original_file_dict, file_diff_dict, editor: str)[source]

Open file(s)

Parameters:editor – The editor to open the file with.
static is_applicable(result, original_file_dict, file_diff_dict)[source]

For being applicable, the result has to point to a number of files that have to exist i.e. have not been previously deleted.

coalib.results.result_actions.PrintDebugMessageAction module

class coalib.results.result_actions.PrintDebugMessageAction.PrintDebugMessageAction[source]

Bases: coalib.results.result_actions.ResultAction.ResultAction

apply(result, original_file_dict, file_diff_dict)[source]

Print debug message

static is_applicable(result, original_file_dict, file_diff_dict)[source]

coalib.results.result_actions.PrintMoreInfoAction module

class coalib.results.result_actions.PrintMoreInfoAction.PrintMoreInfoAction[source]

Bases: coalib.results.result_actions.ResultAction.ResultAction

apply(result, original_file_dict, file_diff_dict)[source]

Print more info

static is_applicable(result, original_file_dict, file_diff_dict)[source]

coalib.results.result_actions.ResultAction module

A ResultAction is an action that is applicable to at least some results. This file serves the base class for all result actions, thus providing a unified interface for all actions.

class coalib.results.result_actions.ResultAction.ResultAction[source]

Bases: object

SUCCESS_MESSAGE = 'The action was executed successfully.'
apply(result, original_file_dict, file_diff_dict, **kwargs)[source]

No description. Something went wrong.

apply_from_section(result, original_file_dict: dict, file_diff_dict: dict, section: coalib.settings.Section.Section)[source]

Applies this action to the given results with all additional options given as a section. The file dictionaries are needed for differential results.

Parameters:
  • result – The result to apply.
  • original_file_dict – A dictionary containing the files in the state where the result was generated.
  • file_diff_dict – A dictionary containing a diff for every file from the state in the original_file_dict to the current state. This dict will be altered so you do not need to use the return value.
  • section – The section where to retrieve the additional information.
Returns:

The modified file_diff_dict.

classmethod get_metadata()[source]

Retrieves metadata for the apply function. The description may be used to advertise this action to the user. The parameters and their help texts are additional information that are needed from the user. You can create a section out of the inputs from the user and use apply_from_section to apply

:return A FunctionMetadata object.

static is_applicable(result, original_file_dict, file_diff_dict)[source]

Checks whether the Action is valid for the result type.

Returns True by default.

Parameters:
  • result – The result from the coala run to check if an Action is applicable.
  • original_file_dict – A dictionary containing the files in the state where the result was generated.
  • file_diff_dict – A dictionary containing a diff for every file from the state in the original_file_dict to the current state. This dict will be altered so you do not need to use the return value.

coalib.results.result_actions.ShowPatchAction module

class coalib.results.result_actions.ShowPatchAction.ShowPatchAction[source]

Bases: coalib.results.result_actions.ResultAction.ResultAction

SUCCESS_MESSAGE = 'Displayed patch successfully.'
apply(result, original_file_dict, file_diff_dict, colored: bool = True, show_result_on_top: bool = False)[source]

Show patch

Parameters:
  • colored – Whether or not to use colored output.
  • show_result_on_top – Set this to True if you want to show the result info on top. (Useful for e.g. coala_ci.)
static is_applicable(result, original_file_dict, file_diff_dict)[source]
coalib.results.result_actions.ShowPatchAction.format_line(line, real_nr='', sign='|', mod_nr='', symbol='')[source]
coalib.results.result_actions.ShowPatchAction.print_beautified_diff(difflines, printer)[source]
coalib.results.result_actions.ShowPatchAction.print_from_name(printer, line)[source]
coalib.results.result_actions.ShowPatchAction.print_to_name(printer, line)[source]

Module contents

The result_actions package holds objects deriving from ResultAction. A ResultAction represents an action that an be applied to a result.