validate_actions.globals.problems

Handles problem management for validate-actions.

Classes

Problem(pos, level, desc, rule)

Represents a single validation problem found in a workflow file.

ProblemLevel(*values)

Enumeration of problem severity levels for workflow validation.

Problems([problems, max_level, n_error, ...])

Collection and management of validation problems.

class validate_actions.globals.problems.ProblemLevel(*values)[source]

Bases: Enum

Enumeration of problem severity levels for workflow validation.

This enum defines the different levels of issues that can be found during workflow validation, ordered by severity.

NON

No problem or informational level (severity 0)

Type:

int

WAR

Warning level - potential issues that don’t break functionality (severity 1)

Type:

int

ERR

Error level - critical issues that need to be fixed (severity 2)

Type:

int

class validate_actions.globals.problems.Problem(pos, level, desc, rule)[source]

Bases: object

Represents a single validation problem found in a workflow file.

This class encapsulates all information about a specific issue discovered during workflow validation, including its location, severity, description, and the rule that detected it.

Parameters:
pos

Position information (line, column, character index) where the problem occurs

Type:

Pos

level

Severity level of the problem (NON, WAR, or ERR)

Type:

ProblemLevel

desc

Human-readable description of the problem

Type:

str

rule

Name/identifier of the validation rule that detected this problem

Type:

str

class validate_actions.globals.problems.Problems(problems=<factory>, max_level=ProblemLevel.NON, n_error=0, n_warning=0)[source]

Bases: object

Collection and management of validation problems.

This class manages a collection of Problem instances, maintains counts by severity level, and tracks the highest severity level encountered. It provides methods for adding, removing, sorting, and merging problems.

Parameters:
problems

List of all problems found during validation

Type:

List[Problem]

max_level

Highest severity level among all problems

Type:

ProblemLevel

n_error

Count of problems with ERROR level

Type:

int

n_warning

Count of problems with WARNING level

Type:

int

append(problem)[source]

Add a new problem to the collection and update counts.

Appends the problem to the internal list, increments the appropriate severity counter, and updates the maximum severity level if necessary.

Parameters:

problem (Problem) – The problem instance to add to the collection

Return type:

None

sort()[source]

Sort problems by their position in the file.

Sorts the problems list in-place by line number first, then by column number. This ensures problems are presented in the order they appear in the source file.

Return type:

None

extend(problems)[source]

Merge another Problems collection into this one.

Extends the current problems list with all problems from another collection, updates all counters, and adjusts the maximum severity level.

Parameters:

problems (Problems) – Another Problems instance to merge into this one

Return type:

None

remove(problem)[source]

Remove a specific problem from the collection.

Removes the problem from the list, decrements the appropriate severity counter, and resets max_level to NON if no problems remain.

Parameters:

problem (Problem) – The specific problem instance to remove

Raises:

ValueError – If the problem is not found in the collection

Return type:

None