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

linter(testifylint): use Len or Empty for arrays testing #7555

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Mar 23, 2024

Please add a summary of your change

Use testifylint to use Len and Empty in tests when possible
This has been done through

testifylint --disable-all --enable=empty,len -fix ./...

It is then ensured through golangci-lint configuration

Does your change fix a particular issue?

No

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

@mateusoliveira43
Copy link
Contributor

@mmorel-35 thanks for your work improving the code quality!

A few comments:

@mmorel-35
Copy link
Contributor Author

@mateusoliveira43,
Thank you for your review on this. I believe it's better to keep this PR narrow. So I think that including the upgrade of golangci is acceptable but extending the linting to every _test.go files is going to lead to more change so it is probably better to let it happen in a future PR.

WDYT ?

@mateusoliveira43
Copy link
Contributor

@mmorel-35 I agree, the more simple the PR, the better!

Just want to warn maintainers that current project's config is not very reliable

@blackpiglet blackpiglet added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Mar 25, 2024
@blackpiglet
Copy link
Contributor

@mmorel-35 I agree, the more simple the PR, the better!

Just want to warn maintainers that current project's config is not very reliable

I agree with your opinion. To enable linter for all test files, would be good, although it doesn't have a high priority.

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.70%. Comparing base (13f4efd) to head (f864c2d).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7555      +/-   ##
==========================================
+ Coverage   61.68%   61.70%   +0.01%     
==========================================
  Files         263      263              
  Lines       28826    28861      +35     
==========================================
+ Hits        17781    17808      +27     
- Misses       9787     9793       +6     
- Partials     1258     1260       +2     

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

@qiuming-best qiuming-best requested review from blackpiglet and removed request for reasonerjt March 25, 2024 06:47
@mmorel-35
Copy link
Contributor Author

mmorel-35 commented Mar 25, 2024

I believe this is ready for CI.
There was two errors related to golangci-lint update one from goconst, the other from nonolint

@mmorel-35
Copy link
Contributor Author

To enable linter for all test files, would be good, although it doesn't have a high priority.

I could give it a try if you are interested ?

@blackpiglet
Copy link
Contributor

@mmorel-35
Sure. Thanks for your contribution.

@mmorel-35
Copy link
Contributor Author

@blackpiglet ,
Anything else to do to merge this ?

@blackpiglet
Copy link
Contributor

@mateusoliveira43
PR needs two maintainers' approval. Involved more maintainers to take a look.

@sseago sseago merged commit 3c704ba into vmware-tanzu:main Mar 27, 2024
66 checks passed
@mmorel-35 mmorel-35 deleted the testifylint/empty+len branch March 27, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-unit-tests kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants