Skip to content

Commit

Permalink
fix: typecheck issues should never be ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jul 10, 2024
1 parent ee37ef3 commit 191b8d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pkg/result/processors/autogenerated_exclude.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ func (p *AutogeneratedExclude) Process(issues []result.Issue) ([]result.Issue, e
func (*AutogeneratedExclude) Finish() {}

func (p *AutogeneratedExclude) shouldPassIssue(issue *result.Issue) (bool, error) {
if issue.FromLinter == typeCheckName {
// don't hide typechecking errors in generated files: users expect to see why the project isn't compiling
return true, nil
}

if filepath.Base(issue.FilePath()) == "go.mod" {
return true, nil
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/result/processors/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import (
func filterIssues(issues []result.Issue, filter func(issue *result.Issue) bool) []result.Issue {
retIssues := make([]result.Issue, 0, len(issues))
for i := range issues {
if issues[i].FromLinter == typeCheckName {
// don't hide typechecking errors in generated files: users expect to see why the project isn't compiling
retIssues = append(retIssues, issues[i])
continue
}

if filter(&issues[i]) {
retIssues = append(retIssues, issues[i])
}
Expand All @@ -20,6 +26,12 @@ func filterIssues(issues []result.Issue, filter func(issue *result.Issue) bool)
func filterIssuesErr(issues []result.Issue, filter func(issue *result.Issue) (bool, error)) ([]result.Issue, error) {
retIssues := make([]result.Issue, 0, len(issues))
for i := range issues {
if issues[i].FromLinter == typeCheckName {
// don't hide typechecking errors in generated files: users expect to see why the project isn't compiling
retIssues = append(retIssues, issues[i])
continue
}

ok, err := filter(&issues[i])
if err != nil {
return nil, fmt.Errorf("can't filter issue %#v: %w", issues[i], err)
Expand Down

0 comments on commit 191b8d0

Please sign in to comment.