Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: Remove varnamelen linter#854

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 2 commits intomainfromstevenmasley/varnamelen
Apr 4, 2022
Merged

Conversation

Emyrk
Copy link
Member

Golang prefers short var names in local scope. I think this is not idiomatic and excessive. I'd only assert this when the var exceeds local scope, but that is not supported.

https://github.com/golang/go/wiki/CodeReviewComments#variable-names

@Emyrk
Copy link
MemberAuthor

Emyrk commentedApr 4, 2022
edited
Loading

Also the linter doesn't say where the lint failure is"

  Error: variable name 'ui' is too short for the scope of its usage (varnamelen)  Error: variable name 's' is too short for the scope of its usage (varnamelen)  Error: variable name 'a' is too short for the scope of its usage (varnamelen)  Error: variable name 'j' is too short for the scope of its usage (varnamelen)

https://github.com/coder/coder/runs/5818950685?check_suite_focus=true

@codecov
Copy link

codecovbot commentedApr 4, 2022
edited
Loading

Codecov Report

Merging#854 (25956e8) intomain (f2a2126) willdecrease coverage by0.20%.
The diff coverage isn/a.

@@            Coverage Diff             @@##             main     #854      +/-   ##==========================================- Coverage   66.08%   65.87%   -0.21%==========================================  Files         202      202                Lines       13209    13209                Branches       87       87              ==========================================- Hits         8729     8702      -27- Misses       3597     3619      +22- Partials      883      888       +5
FlagCoverage Δ
unittest-go-65.21% <ø> (-0.29%)⬇️
unittest-go-macos-latest52.57% <ø> (+0.10%)⬆️
unittest-go-ubuntu-latest55.00% <ø> (ø)
unittest-go-windows-202251.71% <ø> (ø)
unittest-js62.63% <ø> (ø)
Impacted FilesCoverage Δ
codersdk/provisionerdaemons.go58.46% <0.00%> (-6.16%)⬇️
coderd/parameter/compute.go74.07% <0.00%> (-4.45%)⬇️
coderd/provisionerdaemons.go58.51% <0.00%> (-4.05%)⬇️
provisionerd/provisionerd.go80.17% <0.00%> (-0.89%)⬇️
coderd/database/queries.sql.go83.30% <0.00%> (-0.23%)⬇️
coderd/workspaceresources.go62.19% <0.00%> (+1.62%)⬆️
peer/conn.go81.47% <0.00%> (+2.28%)⬆️
provisionersdk/transport.go85.10% <0.00%> (+6.38%)⬆️

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatef2a2126...25956e8. Read thecomment docs.

Copy link
Contributor

@f0sself0ssel left a comment

Choose a reason for hiding this comment

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

I've never felt like our variable names in v1 were too short in my opinion.

I've had this bite me a few times, I think it's too sensitive. I agree with it in theory but it wouldn't let me use a single character variable for a 4 line middleware function. Idiomatic Go would say that is totally fine as long as it's not a super long function and doesn't leave scope.

I generally don't love using # of lines as the metric for this.

@johnstcn
Copy link
Member

I'd prefer for us organic life forms to make the decision on this sort of thing.

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

I've personally found this to be quite helpful in producing readable code. I think that edge-case of specific types matched with specific names can be helpful to declare.

It's an arbitrary position, but I'd rather have consistency withrw http.ResponseWriter over a mix ofw andrw than the shorter name.

@kylecarbs
Copy link
Member

My comment doesn't need to block merge. Mostly everyone agrees, so if it becomes a problem we can add it back.

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

Didn't realize my request for change would block merge. Since everyone on the team seems to agree with this, I shall approve too.

@EmyrkEmyrk merged commit4dd3c57 intomainApr 4, 2022
@EmyrkEmyrk deleted the stevenmasley/varnamelen branchApril 4, 2022 16:17
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@kylecarbskylecarbskylecarbs approved these changes

@deansheatherdeansheatherdeansheather approved these changes

@f0sself0sself0ssel approved these changes

+1 more reviewer

@coadlercoadlercoadler approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

V2 Beta

Development

Successfully merging this pull request may close these issues.

7 participants

@Emyrk@johnstcn@kylecarbs@coadler@deansheather@f0ssel@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp