comment

package
v0.0.0-...-7ef1c60 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

comment is a library that provides a generalized way to provide feedback to the user about the state of their code and our ability to instrument it. It does this primarily by adding comments in the diff file that either provide information or warnings to the user. It also provides a way to print this information to the console if the user enables debug mode.

Index

Constants

View Source
const (
	InfoHeader        string = "NR INFO"
	InfoConsoleHeader string = "Info"

	WarnHeader        string = "NR WARN"
	WarnConsoleHeader string = "Warn"
)

Variables

This section is empty.

Functions

func EnableConsolePrinter

func EnableConsolePrinter(applicationPath string)

func Info

func Info(pkg *decorator.Package, commentNode dst.Node, positionNode dst.Node, message string, additionalInfo ...string)

Info appends a comment to a node that alerts a user to a non-critical issue in their code. It also adds the comment to the console printer if it is enabled.

The message is the main comment, and additionalInfo is a list of optional new lines that will be added to the comment. The positionNode is the node where the issue is occurring. The commentNode is the node where the comment will be added, for readability purposes, these may not be the same node.

func Warn

func Warn(pkg *decorator.Package, commentNode dst.Node, positionNode dst.Node, message string, additionalInfo ...string)

Warn appends a comment to a node that alerts a user to an important issue in their code. It also adds the comment to the console printer if it is enabled.

The message is the main comment, and additionalInfo is a list of optional new lines that will be added to the comment. The positionNode is the node where the issue is occurring. The commentNode is the node where the comment will be added, for readability purposes, these may not be the same node.

func WriteAll

func WriteAll()

Types

type ConsolePrinter

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

Jump to

Keyboard shortcuts

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