Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create lint.yml #164

Merged
merged 6 commits into from
Nov 13, 2020
Merged

Create lint.yml #164

merged 6 commits into from
Nov 13, 2020

Conversation

willscott
Copy link
Contributor

runs golangci-lint on commits.

Note: won't be enforced, but will provide warnings on commits to start us moving in the direction of maintaining a strictly linted codebase

ref: #161

runs golangci-lint on commits.

Note: won't be enforced, but will provide warnings on commits to start us moving in the direction of maintaining a strictly linted codebase
@willscott willscott requested a review from frrist October 28, 2020 15:34
@frrist
Copy link
Member

frrist commented Oct 28, 2020

Can you add a directive to the Makefile that runs linting as well? I'd like to be able to lint code before pushing it up.

@frrist frrist added the kind/chore Technical debt due to be resolved label Oct 28, 2020
@willscott
Copy link
Contributor Author

Can you add a directive to the Makefile that runs linting as well? I'd like to be able to lint code before pushing it up.

golangci-lint generally wants to be installed globally rather than as something that can be run without side effects. Do you imagine make rules for the install, or just that assumes it already exists (make lint runs golangci-lint run ./...)?

@frrist
Copy link
Member

frrist commented Oct 28, 2020

Assuming it already exists for now should be fine, thanks.

@willscott
Copy link
Contributor Author

the errors from the golangci-lint action are now the actual linting errors that currently exist in the code base

@frrist
Copy link
Member

frrist commented Oct 28, 2020

Way less than I was expecting:

  Error: Error return value of `release` is not checked (errcheck)
  Error: Error return value of `cleanup` is not checked (errcheck)
  Error: Error return value of `cleanup` is not checked (errcheck)
  Error: Error return value of `cleanup` is not checked (errcheck)
  Error: Error return value of `scheduler.Add` is not checked (errcheck)
  Error: Error return value of `scheduler.Add` is not checked (errcheck)
  Error: Error return value of `scheduler.Add` is not checked (errcheck)
  Error: Error return value of `w.Write` is not checked (errcheck)
  Error: Error return value of `proven.ForEach` is not checked (errcheck)
  Error: ineffectual assignment to `ctx` (ineffassign)
  Error: `tableName` is unused (structcheck)
  Error: `tableName` is unused (structcheck)
  Error: `tableName` is unused (structcheck)
  Error: S1011: should replace loop with `vmm = append(vmm, msgs.BlsMessages...)` (gosimple)
  Error: S1030: should use buf.String() instead of string(buf.Bytes()) (gosimple)
  Error: S1023: redundant `return` statement (gosimple)
  Error: lostcancel: the cncl function is not used on all paths (possible context leak) (govet)
  Error: lostcancel: this return statement may be reached without using the cncl var defined on line 70 (govet)
  Error: SA4021: x = append(y) is equivalent to x = y (staticcheck)
  Error: SA5008: duplicate struct tag "pg" (staticcheck)
  Error: SA1019: peer.ID is deprecated: use github.com/libp2p/go-libp2p-core/peer.ID instead.  (staticcheck)
  Error: SA1019: package github.com/libp2p/go-libp2p-peer is deprecated: use github.com/libp2p/go-libp2p-core/peer instead.  (staticcheck)
  Error: SA1019: peer.ID is deprecated: use github.com/libp2p/go-libp2p-core/peer.ID instead.  (staticcheck)
  Error: SA1019: package github.com/libp2p/go-libp2p-peer is deprecated: use github.com/libp2p/go-libp2p-core/peer instead.  (staticcheck)
  Error: SA1019: peer.ID is deprecated: use github.com/libp2p/go-libp2p-core/peer.ID instead.  (staticcheck)
  Error: SA1019: package github.com/libp2p/go-libp2p-peer is deprecated: use github.com/libp2p/go-libp2p-core/peer instead.  (staticcheck)

@willscott
Copy link
Contributor Author

it looks like there are actually more lint issues than this, the tool just stop after some point.

We have a couple options here:

  • we can merge this and have the ci check fail on PRs until linting is clean up throughout the code base
  • we can limit which folders we lint, and do a series of PRs linting different components and adding them to lint coverage
  • we can work through all the linting in this PR

preferences?

@placer14
Copy link
Contributor

For CI at least, there's an option which allows only new lint errors after a certain commit to be triggered. This lets you enable the linter for new changes and gradually fix the old ones over time. --new-from-rev REV

@willscott
Copy link
Contributor Author

Rebased to master

@frrist
Copy link
Member

frrist commented Nov 13, 2020

My approval is sticky assuming lint failures do not block merges. :shipit:

@willscott willscott merged commit 4db18f7 into master Nov 13, 2020
@willscott willscott deleted the lint branch November 13, 2020 19:01
placer14 added a commit that referenced this pull request Nov 18, 2020
…ck-not-acquired

* origin/master:
  feat: allow application name to be passed in postgres connection url (#243)
  chore: remove unused tables and views
  fix: multisig actor migration
  fix: lotus chain store is a blockstore
  feat: limit history indexer by height (#234)
  polish: Avoid duplicate work when reading receipts
  fix: missed while closing #201
  fix: gracefully disconnect from postgres on exit
  polish: use new init actor diffing logic
  fix: don't update go modules when running make
  fix: panic in multisig genesis task casting
  feat: extract msig transaction hamt
  Create lint.yml (#164)
  remove null bytes from message params (#208)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/chore Technical debt due to be resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants