Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ linters:
- lll
- misspell
- nestif
- nolintlint
- recvcheck
- revive
- staticcheck
Expand Down Expand Up @@ -97,6 +98,9 @@ linters:
nestif:
# TODO: consider reducing this value.
min-complexity: 12
nolintlint:
allow-unused: false
require-specific: true
revive:
rules:
- name: package-comments
Expand All @@ -115,6 +119,8 @@ linters:
exclusions:
warn-unused: true # Log a warning if an exclusion path is unused.
rules:
- path: (.*\.go)
text: "directive `// nolint:.*` should be written without leading space"
- path: (sys/.*/init.*|sys/targets/common.go)
text: "don't use ALL_CAPS in Go names|should not use ALL_CAPS in Go names"
- path: (prog/.*)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestAccessConfig(t *testing.T) {
}

// TestAccess checks that all UIs respect access levels.
// nolint: funlen, goconst, gocyclo
// nolint: funlen, gocyclo
func TestAccess(t *testing.T) {
c := NewCtx(t)
defer c.Close()
Expand Down
1 change: 0 additions & 1 deletion dashboard/app/email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,6 @@ func TestBugFromSubjectInference(t *testing.T) {
c.expectEQ(strings.Contains(email.Body, "This crash does not have a reproducer"), true)
}

// nolint: funlen
func TestEmailLinks(t *testing.T) {
c := NewCtx(t)
defer c.Close()
Expand Down
4 changes: 0 additions & 4 deletions dashboard/app/graphs.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ type uiMultiInput struct {
Vals []string
}

// nolint: dupl
func handleKernelHealthGraph(c context.Context, w http.ResponseWriter, r *http.Request) error {
hdr, err := commonHeader(c, r, w, "")
if err != nil {
Expand All @@ -139,7 +138,6 @@ func handleKernelHealthGraph(c context.Context, w http.ResponseWriter, r *http.R
return serveTemplate(w, "graph_bugs.html", data)
}

// nolint: dupl
func handleGraphLifetimes(c context.Context, w http.ResponseWriter, r *http.Request) error {
hdr, err := commonHeader(c, r, w, "")
if err != nil {
Expand Down Expand Up @@ -172,7 +170,6 @@ func handleGraphLifetimes(c context.Context, w http.ResponseWriter, r *http.Requ
return serveTemplate(w, "graph_lifetimes.html", data)
}

// nolint: dupl
func handleFoundBugsGraph(c context.Context, w http.ResponseWriter, r *http.Request) error {
hdr, err := commonHeader(c, r, w, "")
if err != nil {
Expand Down Expand Up @@ -352,7 +349,6 @@ func createFoundBugs(c context.Context, bugs []*Bug) *uiGraph {
const projected = "projected"
// This is linux-specific at the moment, potentially can move to pkg/report/crash
// and extend to other OSes.
// nolint: lll
types := []struct {
name string
color string
Expand Down
1 change: 0 additions & 1 deletion dashboard/app/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,6 @@ func resetJobs(c context.Context, req *dashapi.JobResetReq) error {
}

// doneJob is called by syz-ci to mark completion of a job.
// nolint: gocyclo
func doneJob(c context.Context, req *dashapi.JobDoneReq) error {
jobID := req.ID
jobKey, err := jobID2Key(c, req.ID)
Expand Down
4 changes: 1 addition & 3 deletions dashboard/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ func handleAdmin(c context.Context, w http.ResponseWriter, r *http.Request) erro
}

// handleBug serves page about a single bug (which is passed in id argument).
// nolint: funlen, gocyclo
// nolint: gocyclo
func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error {
bug, err := findBugByID(c, r)
if err != nil {
Expand Down Expand Up @@ -1185,13 +1185,11 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
// - no fix bisections have been performed on the bug
// - fix bisection was performed but resulted in a crash on HEAD
// - there have been infrastructure problems during the job execution
// nolint: dupl
if len(bugDetails.BisectFixJobs) > 1 || len(bugDetails.BisectFixJobs) > 0 && bugDetails.BisectFixJob == nil {
data.Sections = append(data.Sections, makeCollapsibleBugJobs(
"Fix bisection attempts", bugDetails.BisectFixJobs))
}
// Similarly, a cause bisection can be repeated if there were infrastructure problems.
// nolint: dupl
if len(bugDetails.BisectCauseJobs) > 1 || len(bugDetails.BisectCauseJobs) > 0 && bugDetails.BisectCauseJob == nil {
data.Sections = append(data.Sections, makeCollapsibleBugJobs(
"Cause bisection attempts", bugDetails.BisectCauseJobs))
Expand Down
1 change: 0 additions & 1 deletion dashboard/app/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,6 @@ func reproStr(level dashapi.ReproLevel) string {
}
}

// nolint: gocyclo
func createBugReport(c context.Context, bug *Bug, crash *Crash, crashKey *db.Key,
bugReporting *BugReporting, reporting *Reporting) (*dashapi.BugReport, error) {
var job *Job
Expand Down
1 change: 0 additions & 1 deletion dashboard/app/reporting_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ func processInboxEmail(c context.Context, msg *email.Email, inbox *PerInboxConfi
return forwardEmail(c, msg, missing, []string{cc, msg.Author}, "", msg.MessageID)
}

// nolint: gocyclo
func processIncomingEmail(c context.Context, msg *email.Email) error {
// Ignore any incoming emails from syzbot itself.
if ownEmail(c) == msg.Author {
Expand Down
4 changes: 0 additions & 4 deletions dashboard/app/subsystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ func TestNoUserSubsystemOverwrite(t *testing.T) {
expectLabels(t, client, extID, "subsystems:subsystemA")
}

// nolint: goconst
func TestPeriodicSubsystemReminders(t *testing.T) {
c := NewCtx(t)
defer c.Close()
Expand Down Expand Up @@ -722,7 +721,6 @@ func TestSubsystemRemindersNoReport(t *testing.T) {
client.expectNoEmail()
}

// nolint: goconst
func TestNoRemindersWithDiscussions(t *testing.T) {
c := NewCtx(t)
defer c.Close()
Expand Down Expand Up @@ -827,7 +825,6 @@ You may send multiple commands in a single email message.
`, bugToExtID["WARNING: a first"], bugToExtID["WARNING: a third"]))
}

// nolint: goconst
func TestSkipSubsystemReminders(t *testing.T) {
c := NewCtx(t)
defer c.Close()
Expand Down Expand Up @@ -999,7 +996,6 @@ You may send multiple commands in a single email message.
`, bugToExtID["WARNING: a first"], bugToExtID["WARNING: a second"]))
}

// nolint: goconst
func TestRemindersPriority(t *testing.T) {
c := NewCtx(t)
defer c.Close()
Expand Down
1 change: 0 additions & 1 deletion executor/gen_linux_amd64.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

// nolint: lll
//go:generate bash -c "gcc -Wa,--noexecstack -DGOARCH_$GOARCH=1 kvm_gen.cc kvm_amd64.S -o kvm_gen && ./kvm_gen > kvm_amd64.S.h && rm ./kvm_gen"

package executor
1 change: 0 additions & 1 deletion pkg/build/fuchsia.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func syzRoot() (string, error) {
return filepath.Abs(filepath.Join(filepath.Dir(selfPath), "../.."))
}

// nolint: goconst // to ignore "out/"
func (fu fuchsia) build(params Params) (ImageDetails, error) {
syzDir, err := syzRoot()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cover/cover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestMergeDiff(t *testing.T) {
func TestPerLineCoverage(t *testing.T) {
const End = backend.LineEnd
// Start line:col - end line:col.
// nolint
// nolint: govet
covered := []backend.Range{
// Just covered.
{1, 2, 1, 10},
Expand All @@ -88,7 +88,7 @@ func TestPerLineCoverage(t *testing.T) {
{42, 20, 42, 30},
{42, 10, 42, 25},
}
// nolint
// nolint:govet
uncovered := []backend.Range{
{10, 20, 10, 30},
{11, 0, 11, 20},
Expand Down
2 changes: 1 addition & 1 deletion pkg/csource/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestParseOptions(t *testing.T) {
func TestParseOptionsCanned(t *testing.T) {
// Dashboard stores csource options with syzkaller reproducers,
// so we need to be able to parse old formats.
// nolint: lll, dupl
// nolint: lll
canned := map[string]Options{
`{"threaded":true,"collide":true,"repeat":true,"procs":10,"sandbox":"namespace",
"fault":true,"fault_call":1,"fault_nth":2,"tun":true,"tmpdir":true,"cgroups":true,
Expand Down
2 changes: 1 addition & 1 deletion pkg/ifuzz/x86/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (err errSkip) Error() string {
return string(err)
}

// nolint: gocyclo, gocognit, funlen
// nolint: gocyclo, funlen
func parsePattern(insn *x86.Insn, vals []string) error {
if insn.Opcode != nil {
return fmt.Errorf("PATTERN is already parsed for the instruction")
Expand Down
1 change: 0 additions & 1 deletion pkg/report/freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func (ctx *freebsd) Symbolize(rep *Report) error {

var freebsdStackParams = &stackParams{}

// nolint: goconst
var freebsdOopses = append([]*oops{
{
[]byte("Fatal trap"),
Expand Down
2 changes: 1 addition & 1 deletion pkg/report/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (ctx *linux) reportMinLines(oopsLine []byte) int {
}

// Yes, it is complex, but all state and logic are tightly coupled. It's unclear how to simplify it.
// nolint: gocyclo, gocognit
// nolint: gocyclo
func (ctx *linux) findReport(output []byte, oops *oops, startPos int, context string, useQuestionable bool) (
endPos, reportEnd int, report []byte, prefix [][]byte) {
// Prepend 5 lines preceding start of the report,
Expand Down
2 changes: 1 addition & 1 deletion pkg/stat/sample/pvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package sample

// TODO: I didn't find the substitution as of Feb 2023. Let's keep it as is while it works.
import "golang.org/x/perf/benchstat" // nolint:all
import "golang.org/x/perf/benchstat" // nolint:staticcheck

// Mann-Whitney U test.
func UTest(old, new *Sample) (pval float64, err error) {
Expand Down
1 change: 0 additions & 1 deletion pkg/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ func (upd *Updater) pollAndBuild(lastCommit string) string {
return commit.Hash
}

// nolint: goconst // "GOPATH=" looks good here, ignore
func (upd *Updater) build(commit *vcs.Commit) error {
// syzkaller testing may be slowed down by concurrent kernel builds too much
// and cause timeout failures, so we serialize it with other builds:
Expand Down
2 changes: 0 additions & 2 deletions pkg/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func TestIsCommitHash(t *testing.T) {
validator.CommitHash("!311c1b497e51a628aa89e7cb954481e5f9dced2", "valName").Err.Error())
}

// nolint: dupl
func TestIsNamespaceName(t *testing.T) {
assert.True(t, validator.NamespaceName("upstream").Ok)
assert.False(t, validator.NamespaceName("up").Ok)
Expand Down Expand Up @@ -65,7 +64,6 @@ func TestIsDashboardClientKey(t *testing.T) {
validator.DashClientKey("clKey", "clientKey").Err.Error())
}

// nolint: dupl
func TestIsKernelFilePath(t *testing.T) {
assert.True(t, validator.KernelFilePath("io_uring/advise.c").Ok)
assert.True(t, validator.KernelFilePath("io-uring/advise.c").Ok)
Expand Down
2 changes: 0 additions & 2 deletions pkg/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ func runSandboxed(dir, command string, args ...string) ([]byte, error) {
}

var (
// nolint: lll
gitLocalRepoRe = regexp.MustCompile(`^file:///[a-zA-Z0-9-_./~]+(/)?$`)
// nolint: lll
gitRemoteRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps|sso)://[a-zA-Z0-9-_.]+(:[0-9]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`)
Expand Down Expand Up @@ -382,7 +381,6 @@ func FileLink(url, hash, file string, line int) string {
return link(url, hash, file, line, 3)
}

// nolint: goconst
func link(url, hash, file string, line, typ int) string {
if url == "" || hash == "" {
return ""
Expand Down
2 changes: 0 additions & 2 deletions pkg/vcs/vcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,11 @@ func TestFileLink(t *testing.T) {
}

func TestParse(t *testing.T) {
// nolint: lll
test1 := []byte(`Foo Bar <a@email.com> (maintainer:KERNEL)
Foo Bar<b@email.com> (reviewer:KERNEL)
<somelist@list.com> (open list:FOO)
"Supporter Foo" <c@email.com> (supporter:KERNEL)
linux-kernel@vger.kernel.org (open list)`)
// nolint: lll
test2 := []byte(`Foo Bar <a@email.com> (maintainer:KERNEL)
Foo Bar<b@email.com> (reviewer:KERNEL)
"Supporter Foo" <c@email.com> (supporter:KERNEL)
Expand Down
1 change: 0 additions & 1 deletion prog/encodingexec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func TestSerializeForExecRandom(t *testing.T) {
}
}

// nolint: funlen
func TestSerializeForExec(t *testing.T) {
target := initTargetTest(t, "test", "64")
var (
Expand Down
2 changes: 1 addition & 1 deletion prog/kfuzztest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func createPrefix() []byte {
return prefix.Bytes()
}

//nolint:all
// nolint:dupl,lll
func TestMarshallKFuzzTestArg(t *testing.T) {
testCases := []testCase{
// This test case validates the encoding of the following structure:
Expand Down
1 change: 0 additions & 1 deletion sys/targets/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ func GetEx(OS, arch string, clang bool) *Target {
return target.other
}

// nolint: lll
var List = map[string]map[string]*Target{
TestOS: {
TestArch64: {
Expand Down
1 change: 0 additions & 1 deletion syz-cluster/dashboard/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ func (h *dashboardHandler) patchContent(w http.ResponseWriter, r *http.Request)
return h.streamBlob(w, patch.BodyURI)
}

// nolint:dupl
func (h *dashboardHandler) allPatches(w http.ResponseWriter, r *http.Request) error {
ctx := r.Context()
series, err := h.seriesRepo.GetByID(ctx, r.PathValue("id"))
Expand Down
1 change: 0 additions & 1 deletion syz-cluster/pkg/db/finding_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func (repo *FindingRepository) mustStore(ctx context.Context, finding *Finding)
})
}

// nolint: dupl
func (repo *FindingRepository) ListForSession(ctx context.Context, sessionID string, limit int) ([]*Finding, error) {
stmt := spanner.Statement{
SQL: "SELECT * FROM `Findings` WHERE `SessionID` = @session ORDER BY `TestName`, `Title`",
Expand Down
1 change: 0 additions & 1 deletion syz-cluster/pkg/db/report_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func (repo *ReportRepository) Insert(ctx context.Context, rep *SessionReport) er
return fmt.Errorf("failed to pick a non-existing report ID")
}

// nolint: dupl
func (repo *ReportRepository) ListNotReported(ctx context.Context, reporter string,
limit int) ([]*SessionReport, error) {
stmt := spanner.Statement{
Expand Down
3 changes: 0 additions & 3 deletions syz-cluster/pkg/db/series_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ func NewSeriesRepository(client *spanner.Client) *SeriesRepository {
}

// TODO: move to SeriesPatchesRepository?
// nolint:dupl
func (repo *SeriesRepository) PatchByID(ctx context.Context, id string) (*Patch, error) {
return readEntity[Patch](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM Patches WHERE ID=@id",
Params: map[string]any{"id": id},
})
}

// nolint:dupl
func (repo *SeriesRepository) GetByExtID(ctx context.Context, extID string) (*Series, error) {
return readEntity[Series](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM Series WHERE ExtID=@extID",
Expand Down Expand Up @@ -279,7 +277,6 @@ func (repo *SeriesRepository) queryFindingCounts(ctx context.Context, ro *spanne
}

// golint sees too much similarity with SessionRepository's ListForSeries, but in reality there's not.
// nolint:dupl
func (repo *SeriesRepository) ListPatches(ctx context.Context, series *Series) ([]*Patch, error) {
return readEntities[Patch](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM `Patches` WHERE `SeriesID` = @seriesID ORDER BY `Seq`",
Expand Down
1 change: 0 additions & 1 deletion syz-cluster/pkg/db/session_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func (repo *SessionRepository) ListWaiting(ctx context.Context, from *NextSessio
}

// golint sees too much similarity with SeriesRepository's ListPatches, but in reality there's not.
// nolint:dupl
func (repo *SessionRepository) ListForSeries(ctx context.Context, series *Series) ([]*Session, error) {
return repo.readEntities(ctx, spanner.Statement{
SQL: "SELECT * FROM `Sessions` WHERE `SeriesID` = @series ORDER BY CreatedAt DESC",
Expand Down
1 change: 0 additions & 1 deletion syz-cluster/pkg/reporter/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func (s *APIServer) Mux() *http.ServeMux {
return mux
}

// nolint: dupl
func (s *APIServer) upstreamReport(w http.ResponseWriter, r *http.Request) {
req := api.ParseJSON[api.UpstreamReportReq](w, r)
if req == nil {
Expand Down
4 changes: 2 additions & 2 deletions tools/syz-check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ type nlaPolicy struct {
_ int32
}

// nolint
// nolint:staticcheck
const (
NLA_UNSPEC = iota
NLA_U8
Expand All @@ -780,7 +780,7 @@ const (
NLA_MIN_LEN
)

// nolint
// nolint:staticcheck
const (
_ = iota
NLA_VALIDATE_RANGE
Expand Down
Loading
Loading