issue

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package issue provides types to describe issues in linting reports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	// contains filtered or unexported fields
}

Issue represents a linting issue with a message and a type.

It is used to encapsulate the details of an issue found during the linting process. The Issue struct contains a message that describes the issue and a type that indicates its severity.

func NewCritical

func NewCritical(msg string) Issue

NewCritical creates a new Issue with type Critical.

It is a convenience function to create a critical issue. This function is used to create issues that indicate critical problems that need to be solved immediately.

func NewInfo

func NewInfo(msg string) Issue

NewInfo creates a new Issue with type Info.

It is a convenience function to create an informational issue. This function is used to create issues that provide additional information that does not require immediate action.

func NewIssue

func NewIssue(typ Type, msg string) Issue

NewIssue creates a new Issue instance with the specified message and type.

func NewWarning

func NewWarning(msg string) Issue

NewWarning creates a new Issue with type Warning.

It is a convenience function to create a warning issue. This function is used to create issues that indicate potential problems that should be reviewed but are not critical.

func (Issue) Message

func (i Issue) Message() string

Message returns the message of the issue.

It provides a human-readable description of the issue. This function is used to retrieve the message associated with the issue, which can be displayed to the user or logged for debugging purposes.

func (Issue) Type

func (i Issue) Type() Type

Type returns the type of the issue.

This function is used to categorize the issue based on its severity, allowing the linting process to handle different types of issues appropriately.

type Type

type Type int8

Type represents the severity of an issue in the linting process and is used to categorize issues found during linting.

It indicates the severity of the issue (critical, warning, info), allowing the linting process to handle different types of issues appropriately.

const (
	// Critical indicates a critical issue that needs to be solved immediately.
	//
	// It is used to represent issues that prevent the application from functioning correctly.
	// This type of issue should be addressed as a priority.
	// It is typically used for issues that indicate a failure in the linting process
	// or a violation of essential rules that must be corrected.
	Critical Type = 1

	// Warning indicates a potential issue that should be reviewed but is not critical.
	//
	// It is used to represent issues that may not prevent the application from functioning,
	// but could lead to problems if not addressed.
	// This type of issue is typically used for linting rules that are not strictly enforced
	// but are recommended for best practices.
	Warning Type = 2

	// Info indicates informational messages that do not require action.
	//
	// It is used to provide additional context or information about the linting process.
	// This type of issue is typically used for messages that provide insights
	// or details about the linting process, such as configuration settings or
	// general information that may be useful for the user but does not indicate a problem.
	Info Type = 3
)

func Parse

func Parse(s string) Type

Parse parses the provided string into an issue type.

Returns unspecifed one for empty input and unknown one for unknown strings. Note that these types are represented as predicates and cannot be declared as package constants to prevent its usage.

func (Type) In

func (t Type) In(typs ...Type) bool

In defines whether the type exists in provided list of types.

func (Type) String

func (t Type) String() string

String returns a string representation of the Type.

func (Type) Unknown

func (t Type) Unknown() bool

Unknown defines whether the type is unknown.

func (Type) Unspecified

func (t Type) Unspecified() bool

Unspecified defines whether the type is unspecified.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL