validate_actions.globals.fixer

Fixer module for applying changes to YAML workflow files.

Classes

BaseFixer(file_path)

Default fixer that batches edits and applies them on flush.

Fixer()

Abstract base for applying fixes to YAML workflow files.

NoFixer()

A fixer that does nothing.

class validate_actions.globals.fixer.Fixer[source]

Bases: ABC

Abstract base for applying fixes to YAML workflow files.

abstractmethod edit_yaml_at_position(idx, old_text, new_text, problem, new_problem_desc)[source]

Queue an edit to replace text at a specific character position.

Parameters:
  • idx (int) – Character index where replacement starts

  • old_text (str) – Text to be replaced (for validation)

  • new_text (str) – Replacement text

  • problem (Problem) – Problem instance to update

  • new_problem_desc (str) – New description for the fixed problem

Returns:

Updated problem instance

Return type:

Problem

abstractmethod flush()[source]

Apply all queued edits to the file.

Return type:

None

class validate_actions.globals.fixer.BaseFixer(file_path)[source]

Bases: Fixer

Default fixer that batches edits and applies them on flush.

Parameters:

file_path (Path)

edit_yaml_at_position(idx, old_text, new_text, problem, new_problem_desc)[source]

Queue an edit for later application and mark problem as fixed.

Parameters:
  • idx (int) – Character index where replacement starts

  • old_text (str) – Text to be replaced (for validation)

  • new_text (str) – Replacement text

  • problem (Problem) – Problem instance to update

  • new_problem_desc (str) – New description for the fixed problem

Returns:

Updated problem instance with NON level

Return type:

Problem

flush()[source]

Apply all pending edits to the file in descending position order.

Return type:

None

class validate_actions.globals.fixer.NoFixer[source]

Bases: Fixer

A fixer that does nothing. Used when no fixes are needed.

edit_yaml_at_position(idx, old_text, new_text, problem, new_problem_desc)[source]

No-op implementation that returns the problem unchanged.

Parameters:
  • idx (int) – Character index (ignored)

  • old_text (str) – Text to be replaced (ignored)

  • new_text (str) – Replacement text (ignored)

  • problem (Problem) – Problem instance to return

  • new_problem_desc (str) – New description (ignored)

Returns:

Unmodified problem instance

Return type:

Problem

flush()[source]

No-op implementation with no effects.

Return type:

None