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

k6/html: lint fixes #3701

Merged
merged 4 commits into from
Apr 25, 2024
Merged

k6/html: lint fixes #3701

merged 4 commits into from
Apr 25, 2024

Conversation

mstoykov
Copy link
Collaborator

@mstoykov mstoykov commented Apr 22, 2024

What?

Fix lint issues inthe whole "k6/html" ... part of it through ignoring lint issues :)

Why?

Part of #769.

Separate commits explained additional reasoning for each change

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

@mstoykov mstoykov added this to the v0.51.0 milestone Apr 22, 2024
@mstoykov mstoykov requested a review from a team as a code owner April 22, 2024 08:52
@mstoykov mstoykov requested review from oleiade and joanlopez and removed request for a team April 22, 2024 08:52
oleiade
oleiade previously approved these changes Apr 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 92.51337% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 73.29%. Comparing base (b866c10) to head (ce9bb6d).

❗ Current head ce9bb6d differs from pull request most recent head 18d4709. Consider uploading reports for the commit 18d4709 to get more accurate results

Files Patch % Lines
js/modules/k6/html/elements_gen.go 92.97% 13 Missing ⚠️
js/modules/k6/html/gen/gen_elements.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3701      +/-   ##
==========================================
+ Coverage   73.28%   73.29%   +0.01%     
==========================================
  Files         278      278              
  Lines       20389    20389              
==========================================
+ Hits        14942    14945       +3     
+ Misses       4497     4494       -3     
  Partials      950      950              
Flag Coverage Δ
ubuntu 73.22% <92.51%> (+<0.01%) ⬆️
windows 73.15% <92.51%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mstoykov mstoykov changed the title k6/html: ignore force type asserts in tests k6/html: lint fixes Apr 22, 2024
@mstoykov mstoykov requested a review from oleiade April 22, 2024 09:49
@@ -210,8 +210,8 @@ func TestElement(t *testing.T) {

assert.True(t, ok)
assert.Equal(t, 9, len(nodes))
assert.Contains(t, nodes[0].Export().(Element).TextContent(), "innerfirst")
assert.Contains(t, nodes[8].Export().(Element).TextContent(), "innerlast")
assert.Contains(t, nodes[0].Export().(Element).TextContent(), "innerfirst") //nolint:forcetypeassert
Copy link
Contributor

@joanlopez joanlopez Apr 22, 2024

Choose a reason for hiding this comment

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

Could make sense to disable forcetypeassert linter for all the test files? While I completely see the value of that linter for production Go code, I don't fully see it for tests (as in the worst case, the test would fail?).

I've seen many annotations (+20) like this and most of them are in test files, and I started to feel like ol' good times in Java with annotations everywhere 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not really against this, and it might be easier to do it 🤷

cc @grafana/k6-core anyone against it?

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Joan, in the context of tests, I always assume the person writing these kind of checks know what they're doing and why, so 👍🏻 on my side 🙇🏻

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mstoykov mstoykov changed the base branch from master to dropForceTypeAssertForTests April 22, 2024 12:56
joanlopez
joanlopez previously approved these changes Apr 23, 2024
@mstoykov mstoykov force-pushed the dropForceTypeAssertForTests branch from d5be7db to 64e4aac Compare April 23, 2024 14:17
oleiade
oleiade previously approved these changes Apr 23, 2024
Base automatically changed from dropForceTypeAssertForTests to master April 23, 2024 16:12
@mstoykov mstoykov dismissed stale reviews from oleiade and joanlopez April 23, 2024 16:12

The base branch was changed.

While nice to have it it mostly gives lint errors for not documenting
every export method.

As we haven't fixed those in 6 years I don't think we will ever do it
for the 100+ methods. As such it seems better to just ignore it and
lower the golangci-lint noise.

Unfortunately using "//revive:disable:exported" in the file itself did
not work with golangci-lint.
@mstoykov mstoykov merged commit 65a15c5 into master Apr 25, 2024
22 checks passed
@mstoykov mstoykov deleted the fixHTMLModuleLintIssues branch April 25, 2024 07:45
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.

None yet

4 participants