Skip to content

Commit

Permalink
Implement binary output and merge mode
Browse files Browse the repository at this point in the history
We implement a merge mode, which takes the results of multiple runs
and merges them. On an analysis-by-analysis basis we decide whether a
diagnostic has to occur in all runs to be merged. In addition, we take
into consideration whether a file was part of a run in the first
place, to avoid incorrectly dropping diagnostics.

We add a new output format called "binary", which writes diagnostics
and metadata using gob. This data is the input to the merge mode.

Currently, the metadata includes a list of all files that were
checked. In the future, we might change to amore finegrained data,
such as which lines of code were reachable in the IR.

Updates gh-938
  • Loading branch information
dominikh committed Nov 19, 2021
1 parent cfd4421 commit 5a97b5d
Show file tree
Hide file tree
Showing 6 changed files with 502 additions and 209 deletions.
10 changes: 10 additions & 0 deletions analysis/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ const (
SeverityHint
)

type MergeStrategy int

const (
MergeIfAny MergeStrategy = iota
MergeIfAll
)

type RawDocumentation struct {
Title string
Text string
Expand All @@ -64,6 +71,7 @@ type RawDocumentation struct {
NonDefault bool
Options []string
Severity Severity
MergeIf MergeStrategy
}

type Documentation struct {
Expand All @@ -79,6 +87,7 @@ type Documentation struct {
NonDefault bool
Options []string
Severity Severity
MergeIf MergeStrategy
}

func Markdownify(m map[string]*RawDocumentation) map[string]*Documentation {
Expand All @@ -97,6 +106,7 @@ func Markdownify(m map[string]*RawDocumentation) map[string]*Documentation {
NonDefault: v.NonDefault,
Options: v.Options,
Severity: v.Severity,
MergeIf: v.MergeIf,
}
}
return out
Expand Down
Loading

0 comments on commit 5a97b5d

Please sign in to comment.