pipes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

func CalcNextWithColor(graph *callgraph.Graph)

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

func EraseNodesWithRemoverColor(graph *callgraph.Graph)

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

func FindRootNodes(graph *callgraph.Graph) callgraph.Nodes

FindRootNodes finds the nodes with the minimum number of input edges and has NextWithColors.

func FunctionsToNodes

func FunctionsToNodes(funcs *symbols.Functions) callgraph.Nodes

FunctionsToNodes is a function that converts passed functions into a set of nodes that represent those functions.

func NodesToGraphs

func NodesToGraphs(nodes callgraph.Nodes) []*callgraph.Graph

NodesToGraphs splits the graph into connectivity components.

Graphs from one node are skipped.

func WriteGraphsAsync

func WriteGraphsAsync(graphs []*callgraph.Graph, graphsCh chan *callgraph.Graph)

WriteGraphsAsync asynchronously writes the given graphs to the transferred channel.

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.

Jump to

Keyboard shortcuts

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