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

[MM-57743] Enable errcheck linter #26723

Merged
merged 8 commits into from
Apr 29, 2024
Merged

[MM-57743] Enable errcheck linter #26723

merged 8 commits into from
Apr 29, 2024

Conversation

hanzei
Copy link
Contributor

@hanzei hanzei commented Apr 8, 2024

Summary

The PR enables the errcheck linter, something that was planned for a few years now.

The ignore list is quite broad. We can scope it down more granularly once we have a clear idea of how we do that. (Campain, staff member, don't work on it for now?)

First, I want to fix the issues in the enterprise code, as we can't do that with the community.

Ticket Link

https://mattermost.atlassian.net/browse/MM-57743

Release Note

NONE

@hanzei hanzei added the Work In Progress Not yet ready for review label Apr 8, 2024
@mm-cloud-bot mm-cloud-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Apr 8, 2024
Copy link

github-actions bot commented Apr 8, 2024

⚠️ One or more flaky tests detected ⚠️

Copy link

github-actions bot commented Apr 8, 2024

⚠️ One or more flaky tests detected ⚠️

  • Failing job: github.com/mattermost/mattermost:Postgres
  • Double check your code to ensure you haven't introduced a flaky test.
  • If this seems to be unrelated to your changes, submit a separate pull request to skip the flaky tests (e.g. 23360) and file JIRA ticket (e.g. MM-52743) for later investigation.

Copy link

github-actions bot commented Apr 8, 2024

⚠️ One or more flaky tests detected ⚠️

  • Failing job: github.com/mattermost/mattermost:MySQL
  • Double check your code to ensure you haven't introduced a flaky test.
  • If this seems to be unrelated to your changes, submit a separate pull request to skip the flaky tests (e.g. 23360) and file JIRA ticket (e.g. MM-52743) for later investigation.

@hanzei hanzei force-pushed the MM-57743_errcheck branch 2 times, most recently from f001f8f to 81e8497 Compare April 23, 2024 09:34
@hanzei hanzei marked this pull request as ready for review April 24, 2024 11:44
skip-dirs:
exclude-dirs:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

skip-dirs doesn't exist. Fixing that as part of this PR.

@@ -26,11 +26,10 @@ linters:
- goimports
- makezero
- whitespace
# TODO: enable this later
Copy link
Contributor Author

Choose a reason for hiding this comment

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

4 years later, we can finally remove this

Comment on lines -110 to +111
// FixInvalidLocales checks and corrects the given config for invalid locale-related settings.
//
// Ideally, this function would be completely internal, but it's currently exposed to allow the cli
// to test the config change before allowing the save.
func FixInvalidLocales(cfg *model.Config) bool {
// fixInvalidLocales checks and corrects the given config for invalid locale-related settings.
func fixInvalidLocales(cfg *model.Config) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing the comment while touching the package

Comment on lines +83 to +85
// utils.TranslationsPreInit errors when TestFixInvalidLocales is run as part of testing the package,
// but doesn't error when the test is run individually.
_ = utils.TranslationsPreInit()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't found out why, though.

Copy link
Member

Choose a reason for hiding this comment

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

Do we know the error? Maybe we can create a ticket to track or create a HW issue.

@hanzei hanzei added 2: Dev Review Requires review by a developer and removed Work In Progress Not yet ready for review labels Apr 24, 2024
Copy link
Member

@isacikgoz isacikgoz left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +83 to +85
// utils.TranslationsPreInit errors when TestFixInvalidLocales is run as part of testing the package,
// but doesn't error when the test is run individually.
_ = utils.TranslationsPreInit()
Copy link
Member

Choose a reason for hiding this comment

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

Do we know the error? Maybe we can create a ticket to track or create a HW issue.

@hanzei hanzei added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a developer labels Apr 29, 2024
@hanzei hanzei added this to the v9.9.0 milestone Apr 29, 2024
@hanzei hanzei merged commit 32d93fd into master Apr 29, 2024
42 checks passed
@hanzei hanzei deleted the MM-57743_errcheck branch April 29, 2024 09:23
@amyblais amyblais added the Changelog/Not Needed Does not require a changelog entry label Apr 29, 2024
@amyblais amyblais added the Docs/Not Needed Does not require documentation label Apr 29, 2024
@jwilander jwilander added the kind/refactor Categorizes issue or PR as related to refactor of production code. label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation kind/refactor Categorizes issue or PR as related to refactor of production code. release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants