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

chore: lint: update linter settings, fix lint errors #11968

Merged
merged 3 commits into from
May 13, 2024
Merged

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented May 7, 2024

Ref: #11967

This isn't complete, I just banged through a few iterations of it to see the kinds of changes we're being asked to make. I think a better approach here is to add some exclusion error regexes. Most of the issues fall into two categories:

  1. Named but unused parameters
  2. Acronym capitalisation - Api -> API, Http -> HTTP, Url -> URL, Id -> ID

The latter suck in particular because a lot of them are on API methods. I've started adding explicit exclusions for those in here, but we could opt for a global exclusion (minimal might be something like var-naming: var [A-Z].+ should be to capture public variables).

Or we could just hammer it with exclusions to minimise the diff in this PR in particular, even turn off var-naming entirely.

storage/paths/db_index.go Outdated Show resolved Hide resolved
@magik6k
Copy link
Contributor

magik6k commented May 7, 2024

Acronym capitalisation - Api -> API, Http -> HTTP, Url -> URL, Id -> ID

When we were setting up the initial linters we very explicitly disabled all linters which were based on pure opinion and weren't providing any value other than aesthetics based on the linters author taste.

Linters which complain "oh no your variable should be ABC instead of Abc" are purely annoying, often wrong, and just slow down development, where often you'd just push a commit, now you have to push a commit, pray that the linter passes with no annoynig-positives, and possibly/likely go back to the PR to push some fixes which don't fix anything important

Tldr most opinion-based linters imo don't make sense unless most of your team is junior devs

@rvagg
Copy link
Member Author

rvagg commented May 7, 2024

I think I agree, I was getting slightly angry at it telling me that HttpServer must be HTTPServer. I'll work on some exclusions, maybe turn off var-naming entirely.

@ZenGround0
Copy link
Contributor

but we could opt for a global exclusion (minimal might be something like var-naming: var [A-Z].+ should be to capture public variables).

I like the sound of a global exclusion for this

@snadrus
Copy link
Collaborator

snadrus commented May 7, 2024

I'm alright turning off both of these things. Because these are not actual problems, but style matters

@rvagg rvagg force-pushed the rvagg/linter-update branch 2 times, most recently from c90a099 to 72070ce Compare May 9, 2024 03:42
@rvagg
Copy link
Member Author

rvagg commented May 9, 2024

I re-did this PR from scratch, and revisited the whole config. Here's the choices I've made:

  • Removed the deprecated linters golint, varcheck, deadcode and scopelint, replacing with their equivalents exportloopref and revive
  • Removed golint specific path exclusions
  • Remove goconst - it had two separate exclusions that meant it wasn't being used anyway, I think we're experienced enough to not need this
  • All message exclusions are more explicit regexes now, they're harder to find ways around (harder to subvert) and it's much clearer in the config the exclusion decisions we're making
  • I decided to ditch all exclusions to unchecked errors except for 3 explicit ones in node/repo/fsrepo.go and 2 in paychmgr/simple.go. This mostly required adding _ = in place of the explicit exclusions and logger.SetLogLevel had a bunch of unchecked but we have far more _ = in the repo so I'm just making that consistent.
  • A bunch of minor changes that are obvious in the diff
  • I decided not to exclude most of the new empty-block errors, but instead I ended up rewriting some logic. I get why some people like empty blocks for comments, but I don't believe they ultimately aid in clarity. Reviewers please pay careful attention to my changes to make sure I didn't change any logic; some are non-trivial.

@rvagg rvagg marked this pull request as ready for review May 9, 2024 03:47
rvagg added 2 commits May 9, 2024 14:22
* remove and replace some linters
* remove some exclusions
* make all exclusions more explicit matches
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only looked at the SP side of things, but looks good to me

itests/kit/client.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@ribasushi ribasushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through the diff - everything seems correct functionally.

Left 2 comments where things were most jarring.

node/impl/full/eth_utils.go Outdated Show resolved Hide resolved
node/impl/full/eth_utils.go Outdated Show resolved Hide resolved
@rvagg rvagg enabled auto-merge (rebase) May 13, 2024 04:51
@rvagg rvagg merged commit 1882525 into master May 13, 2024
186 checks passed
@rvagg rvagg deleted the rvagg/linter-update branch May 13, 2024 04:52
@@ -410,7 +411,6 @@ func lookupEthAddress(addr address.Address, st *state.StateTree) (ethtypes.EthAd
return ethAddr, nil
}

// Otherwise, use the masked address.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rvagg in the final diff-set this comment got lost
Unsure how important for understanding the rest of the stuff, this is your-ish area

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I'd rather not lose it, #12007

@rjan90 rjan90 mentioned this pull request May 16, 2024
8 tasks
rvagg added a commit that referenced this pull request May 17, 2024
rvagg added a commit that referenced this pull request May 17, 2024
rjan90 pushed a commit that referenced this pull request May 24, 2024
rjan90 added a commit that referenced this pull request Jun 10, 2024
* release: v1.26.3 (#11908) (#11915)

* deps: update dependencies to address migration memory bloat

to address memory concerns during a heavy migration

Ref: filecoin-project/go-state-types#260
Ref: whyrusleeping/cbor-gen#96
Ref: filecoin-project/go-amt-ipld#90

* release: prep v1.26.3 patch

Prep v1.26.3 patch release:
- Update changelog, version and make gen + make docsgen-cli

* deps: update cbor-gen to tagged version

deps: update cbor-gen to tagged version

* deps: update go-state-types to tagged version

deps: update go-state-types to tagged version v0.13.2

* chore: deps: update go-state-types to v0.13.3

Fixes a panic when we have fewer than 1k proposals.

---------

Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>

* build: release: v1.27.0-rc1 (#11947)

* chore: Set version as v1.27.0-rc1

Set version as v1.27.0-rc1, run make gen & make docsgen-cli

* Update changelog

Update changelog

* Update changelog

Update changelog based on feedback

* Bump pubsub-dep

Bump pubsub-dep

* Prep v1.27.0-rc2

Prep v1.27.0-rc2

* Typo fixes, and more changelog updates

Typo fixes, and more changelog updates

* chore: remove unmaintained bootstrappers (#11983)

* chore: remove unmaintained bootstrappers

chore: remove unmaintained bootstrappers

* Update mainnet.pi fixing typoed domain

fixing typo for 1475.io 'bootstarp' -> 'bootstrap'

* Update mainnet.pi

apparently the actual hostname is typoed. so bootstarp it is.

---------

Co-authored-by: smagdali <[email protected]>

* chore: update go-data-transfer and go-graphsync

* add ETH addrs API to Gateway (#11979)

* fix: copy Flags field from SectorOnChainInfo

Fixes: #11962

* feat: libp2p: Lotus stream cleanup (#11993)

* set stream deadlines in Lotus

* reduce timeout

* whitelist bootstrappers

* fix tests

* Update changelog and version

Update changelog and version

* ci: deprecate circle ci in favour of github actions (#11786)

* Update changelog

Update changelog with the deprecate circle-ci

* chore: update drand (#12021)

* Update changelog / make docsgen

Update changelog / make docsgen

* chore: lint: update golangci lint config

* remove and replace some linters
* remove some exclusions
* make all exclusions more explicit matches

* chore: lint: fix lint errors with new linting config

Ref: #11967

* chore: lint: address feedback from reviews

* doc: eth: restore comment lost in linter cleanup

Ref: #11968

* chore: libp2p: update to v0.34.1 (#12027)

* update libp2p to v0.34.0

* fix libp2p err

* fix imports

* update go mod

* update go mod

* Update changelog

Update changelog

* go mod tidy

go mod tidy

* revert go version change (#12050)

* Update changelog

Update changelog

* chore: backport #12054 to release/v1.27.0 branch (#12056)

* chore: pin golanglint-ci to v1.58.2 (#12054)

Fixes: #12044

* Add backport to changelog

Add backport to changelog

---------

Co-authored-by: Rod Vagg <[email protected]>

* Fix where #12054 is placed in changelog

Fix where #12054 is placed in changelog

* Add trailing line in Makefile

Add trailing line in Makefile

* Go mod tidy

Go mod tidy

---------

Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>
Co-authored-by: smagdali <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>
Co-authored-by: Piotr Galar <[email protected]>
jennijuju added a commit that referenced this pull request Jun 25, 2024
* release: v1.26.3 (#11908) (#11915)

* deps: update dependencies to address migration memory bloat

to address memory concerns during a heavy migration

Ref: filecoin-project/go-state-types#260
Ref: whyrusleeping/cbor-gen#96
Ref: filecoin-project/go-amt-ipld#90

* release: prep v1.26.3 patch

Prep v1.26.3 patch release:
- Update changelog, version and make gen + make docsgen-cli

* deps: update cbor-gen to tagged version

deps: update cbor-gen to tagged version

* deps: update go-state-types to tagged version

deps: update go-state-types to tagged version v0.13.2

* chore: deps: update go-state-types to v0.13.3

Fixes a panic when we have fewer than 1k proposals.

---------

Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>

* build: release: v1.27.0-rc1 (#11947)

* chore: Set version as v1.27.0-rc1

Set version as v1.27.0-rc1, run make gen & make docsgen-cli

* Update changelog

Update changelog

* Update changelog

Update changelog based on feedback

* Bump pubsub-dep

Bump pubsub-dep

* Prep v1.27.0-rc2

Prep v1.27.0-rc2

* Typo fixes, and more changelog updates

Typo fixes, and more changelog updates

* chore: remove unmaintained bootstrappers (#11983)

* chore: remove unmaintained bootstrappers

chore: remove unmaintained bootstrappers

* Update mainnet.pi fixing typoed domain

fixing typo for 1475.io 'bootstarp' -> 'bootstrap'

* Update mainnet.pi

apparently the actual hostname is typoed. so bootstarp it is.

---------

Co-authored-by: smagdali <[email protected]>

* chore: update go-data-transfer and go-graphsync

* add ETH addrs API to Gateway (#11979)

* fix: copy Flags field from SectorOnChainInfo

Fixes: #11962

* feat: libp2p: Lotus stream cleanup (#11993)

* set stream deadlines in Lotus

* reduce timeout

* whitelist bootstrappers

* fix tests

* Update changelog and version

Update changelog and version

* ci: deprecate circle ci in favour of github actions (#11786)

* Update changelog

Update changelog with the deprecate circle-ci

* chore: update drand (#12021)

* Update changelog / make docsgen

Update changelog / make docsgen

* chore: lint: update golangci lint config

* remove and replace some linters
* remove some exclusions
* make all exclusions more explicit matches

* chore: lint: fix lint errors with new linting config

Ref: #11967

* chore: lint: address feedback from reviews

* doc: eth: restore comment lost in linter cleanup

Ref: #11968

* chore: libp2p: update to v0.34.1 (#12027)

* update libp2p to v0.34.0

* fix libp2p err

* fix imports

* update go mod

* update go mod

* Update changelog

Update changelog

* go mod tidy

go mod tidy

* revert go version change (#12050)

* Update changelog

Update changelog

* chore: backport #12054 to release/v1.27.0 branch (#12056)

* chore: pin golanglint-ci to v1.58.2 (#12054)

Fixes: #12044

* Add backport to changelog

Add backport to changelog

---------

Co-authored-by: Rod Vagg <[email protected]>

* Bump version - make gen/make docsgen

Bump version - make gen/make docsgen

* Update changelog

Update changelog

* Bump NodeBuildVersion to v1.27.1-rc1

Bump NodeBuildVersion to v1.27.1-rc1

* Add Lotus-Miner / Curio related changes

Add Lotus-Miner / Curio related changes

* Update date and upgrade warnings

Update date and upgrade warnings

* fix: ci: do not use deprecated --debug goreleaser flag (#12086)

* chore: deals: remove forgotten graphsync references (#12084)

* chore: types: remove more items forgotten after markets (#12095)

* chore: cleanup: remove more items forgotten after markets

* .gz somehow reappeared after #11625

* fix: ETH RPC API: ETH Call should use the parent state root of the subsequent tipset (#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>

* Update changelog to RC2

Update changelog to RC2

* Make gen / make docsgen-cli

Make gen / make docsgen-cli

* chore: api: the Net API/CLI now remains only on daemon

The only part of this repository that does lp2p is now lotus-daemon

Remove the CommonNet type, used exclusively bu the CLI stack

Adjust the rest of struct-memebership to match what went where

End result best seen in diff of `documentation/en/api-v0-methods-miner.md`

* Update changelog

Update changelog

* fix: events: sqlite db improvements (#12090)

* fix: events: sqlite db improvements

* fix unclosed multi-row query
* tune options to limit wal growth

Ref: #12089

* fix: events: use correct context for CollectEvents transaction

* fix: events: close prepared read statement

* fix: events: close initial query; handle lint failures

* Update CHANGELOG.md

* build: release: v1.27.1-rc2 (#12101)

* fix: ci: do not use deprecated --debug goreleaser flag (#12086)

* chore: deals: remove forgotten graphsync references (#12084)

* chore: types: remove more items forgotten after markets (#12095)

* chore: cleanup: remove more items forgotten after markets

* .gz somehow reappeared after #11625

* fix: ETH RPC API: ETH Call should use the parent state root of the subsequent tipset (#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>

* Update changelog to RC2

Update changelog to RC2

* Make gen / make docsgen-cli

Make gen / make docsgen-cli

* chore: api: the Net API/CLI now remains only on daemon

The only part of this repository that does lp2p is now lotus-daemon

Remove the CommonNet type, used exclusively bu the CLI stack

Adjust the rest of struct-memebership to match what went where

End result best seen in diff of `documentation/en/api-v0-methods-miner.md`

* Update changelog

Update changelog

* fix: events: sqlite db improvements (#12090)

* fix: events: sqlite db improvements

* fix unclosed multi-row query
* tune options to limit wal growth

Ref: #12089

* fix: events: use correct context for CollectEvents transaction

* fix: events: close prepared read statement

* fix: events: close initial query; handle lint failures

* Update CHANGELOG.md

---------

Co-authored-by: Piotr Galar <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>

* small fix in changelog

* fix: release: update goreleaser config file

Fixes: #12120

* fix go releaser and test with rc3

* Update CHANGELOG.md

* lotus v1.27.1 prep

* address review
- resolve one more conflicts
- revert 2 new line added

* doc: events: note events db migration impact

---------

Co-authored-by: Phi-rjan <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>
Co-authored-by: smagdali <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>
Co-authored-by: Piotr Galar <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecated Linters Causing failed checks golinter using deprecated packages
5 participants