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 ¶
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.
Types ¶
type ConsolePrinter ¶
type ConsolePrinter struct {
// contains filtered or unexported fields
}