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

{,x-pack/}{auditbeat,packetbeat,winlogbeat,filebeat/input/httpjson}: fix lint and silence linters #31008

Merged
merged 3 commits into from
Mar 29, 2022

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Mar 27, 2022

What does this PR do?

Fixes lint or suppresses linter complaints depending on issue.

Why is it important?

This will remove the need to include irrelevant diff noise in future PRs forced by the linter.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
    - [ ] I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@efd6 efd6 added cleanup Team:Security-External Integrations backport-skip Skip notification from the automated backport with mergify 8.2-candidate labels Mar 27, 2022
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Mar 27, 2022
@efd6 efd6 changed the title {,x-pack/}{auditbeat,packetbeat,winlogbeat,filebeat/input/httpjson}: … {,x-pack/}{auditbeat,packetbeat,winlogbeat,filebeat/input/httpjson}: fix lint and silence linters Mar 27, 2022
@mergify mergify bot assigned efd6 Mar 27, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 28, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-03-28T23:01:55.843+0000

  • Duration: 74 min 40 sec

Test stats 🧪

Test Results
Failed 0
Passed 4552
Skipped 264
Total 4816

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@efd6 efd6 marked this pull request as ready for review March 28, 2022 01:27
@efd6 efd6 requested a review from a team as a code owner March 28, 2022 01:27
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

x-pack/filebeat/input/httpjson/config_request.go Outdated Show resolved Hide resolved
@@ -146,7 +146,7 @@ func decodeAsCSV(p []byte, dst *response) error {
// values to keys in the event
header, err := r.Read()
if err != nil {
if err == io.EOF {
if err == io.EOF { //nolint:errorlint // csv.Reader never wraps io.EOF.
Copy link
Member

Choose a reason for hiding this comment

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

While this is true, maybe we should go ahead and change these two over to to errors.Is() anyways?

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'm not convinced. Errors is requires at least one call to reflectlite in all cases in order to check whether the error value is comparable. I think that if we know that the error is always unwrapped (for example it comes from a stdlib function that always did, like in the case of all uses of io.EOF) then it would be better to use the old convention; also for readability (though this is harmed by nolint spam).

I am happy to go over and change them all if you feel strongly about it though.

Copy link
Member

Choose a reason for hiding this comment

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

I don't feel strongly about. I just haven't accepted that we'll have so many of these//nolint statements 😄.

Copy link
Contributor Author

@efd6 efd6 Mar 28, 2022

Choose a reason for hiding this comment

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

I just haven't accepted that we'll have so many of these//nolint statements 😄.

Indeed. This is a consequence of the approach that golangci-lint takes to linting; it tries to cover too much and it does so with sometimes less than careful linters.

The nolint directives will help with the follow up to the linting process though; if we see many unuseful lint complaints from a particular linter we can argue to have it removed.

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
@efd6 efd6 merged commit a64fbe9 into elastic:main Mar 29, 2022
@efd6 efd6 deleted the delint branch March 29, 2022 00:20
kush-elastic pushed a commit to kush-elastic/beats that referenced this pull request May 2, 2022
…fix lint and silence linters (elastic#31008)

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
…fix lint and silence linters (#31008)

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.2-candidate backport-skip Skip notification from the automated backport with mergify cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants