Documentation ¶
Index ¶
- func Async(workers int, input chan *callgraph.Graph, output chan []*ColorReport, ...)
- func CalcNextWithColor(graph *callgraph.Graph)
- func EraseNodesWithRemoverColor(graph *callgraph.Graph)
- func FindRootNodes(graph *callgraph.Graph) callgraph.Nodes
- func FunctionsToNodes(funcs *symbols.Functions) callgraph.Nodes
- func NodesToGraphs(nodes callgraph.Nodes) []*callgraph.Graph
- func WriteGraphsAsync(graphs []*callgraph.Graph, graphsCh chan *callgraph.Graph)
- type ColorReport
- type GeneralReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Async ¶
func Async(workers int, input chan *callgraph.Graph, output chan []*ColorReport, cb func(*callgraph.Graph) []*ColorReport)
Async starts the passed number of workers to process the graphs passed to the channel, each of which is processed in the passed callback function.
func CalcNextWithColor ¶
CalcNextWithColor function to calculate node.NextWithColors for every function. We'll use it for perform dfs only for colored nodes of a call graph.
Note: this precalculation is needed, because dfs for a whole call graph is too heavy on a large code base.
func EraseNodesWithRemoverColor ¶
EraseNodesWithRemoverColor is function for drop '@color remover' functions from a call graph.
To perform calculating NextWithColors and checking color rules from the palette, we need to drop '@color remover' functions from a call graph completely, like they don't exist at all, this special color is for manual cutting connectivity rules, allowing to explicitly separate recursively-joint components
func FindRootNodes ¶
FindRootNodes finds the nodes with the minimum number of input edges and has NextWithColors.
func FunctionsToNodes ¶
FunctionsToNodes is a function that converts passed functions into a set of nodes that represent those functions.
func NodesToGraphs ¶
NodesToGraphs splits the graph into connectivity components.
Graphs from one node are skipped.
Types ¶
type ColorReport ¶
type ColorReport struct { Rule *palette.Rule CallChain callgraph.Nodes Message string Palette *palette.Palette }
ColorReport is a structure for storing color mixing error information.
func CheckColorsInGraph ¶
func CheckColorsInGraph(graph *callgraph.Graph, palette *palette.Palette) []*ColorReport
CheckColorsInGraph check all palette rules like "api has-curl" or "messages-module messages-internals".
Start from the root, make dfs expanding NextWithColors and check all rules for each dfs chain.
These chains are left-to-right, e.g. colored f1 -> f2 -> f3, we find and check f1, then f1 -> f2, then f1 -> f2 -> f3.
func ReadReportsSync ¶
func ReadReportsSync(output chan []*ColorReport) []*ColorReport
ReadReportsSync synchronously reads all reports from the channel, blocking the stream until the channel is closed.
type GeneralReport ¶
type GeneralReport struct { Rule string `json:"rule"` CallChain []string `json:"call-chain"` Message string `json:"message"` Context string `json:"context"` File string `json:"file"` Line int `json:"line"` // contains filtered or unexported fields }
func NewGeneralReportFromColorReport ¶
func NewGeneralReportFromColorReport(r *ColorReport) *GeneralReport
func NewGeneralReportFromLinterReport ¶
func NewGeneralReportFromLinterReport(r *linter.Report) *GeneralReport
func (*GeneralReport) String ¶
func (r *GeneralReport) String() string
String returns the string representation of the GeneralReport.