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

ci: Add error message format check #901

Merged
merged 3 commits into from
Oct 20, 2022

Conversation

fredcarle
Copy link
Collaborator

Relevant issue(s)

Resolves #161

Description

This PR adds a linter rule that checks for proper formatting of the error message.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

make lint

Specify the platform(s) on which this was tested:

  • MacOS

@fredcarle fredcarle added ci/build This is issue is about the build or CI system, and the administration of it. action/no-benchmark Skips the action that runs the benchmark. labels Oct 16, 2022
@fredcarle fredcarle added this to the DefraDB v0.4 milestone Oct 16, 2022
@fredcarle fredcarle requested a review from a team October 16, 2022 23:18
@fredcarle fredcarle self-assigned this Oct 16, 2022
@codecov
Copy link

codecov bot commented Oct 16, 2022

Codecov Report

Merging #901 (28070ee) into develop (574d853) will not change coverage.
The diff coverage is 12.37%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #901   +/-   ##
========================================
  Coverage    59.79%   59.79%           
========================================
  Files          156      156           
  Lines        17415    17415           
========================================
  Hits         10414    10414           
  Misses        6065     6065           
  Partials       936      936           
Impacted Files Coverage Δ
client/dockey.go 51.16% <0.00%> (ø)
client/document.go 64.25% <0.00%> (ø)
client/errors.go 100.00% <ø> (ø)
core/crdt/composite.go 76.05% <0.00%> (ø)
core/crdt/lwwreg.go 74.39% <0.00%> (ø)
core/key.go 85.24% <0.00%> (ø)
db/base/collection_keys.go 90.90% <0.00%> (ø)
db/collection_delete.go 29.41% <0.00%> (ø)
db/collection_update.go 54.93% <0.00%> (ø)
db/db.go 68.33% <0.00%> (ø)
... and 30 more

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

question: The linter chosen seems fairly ineffective and seems to have allowed many errors to remain capitalised. Does it only check edited lines? If not is there perhaps a better linter we can use?

@orpheuslummis
Copy link
Contributor

What is also strange is that a run with a different linter, staticcheck -checks ST1005 ./..., reports everything, while we clearly do see a lot of remaining capitalized errors.

@fredcarle
Copy link
Collaborator Author

question: The linter chosen seems fairly ineffective and seems to have allowed many errors to remain capitalised. Does it only check edited lines? If not is there perhaps a better linter we can use?

I'll see if I missed something.

@fredcarle fredcarle force-pushed the fredcarle/chore/I161-error-strings branch from 2b1ada0 to ad9ca11 Compare October 18, 2022 18:20
@fredcarle
Copy link
Collaborator Author

I did a few tests and it seems that the linters really suck when not using the stdlib errors package. So as an alternative I opted to check the string format of the first argument of our error creation functions. It seems to work relatively well.

@fredcarle
Copy link
Collaborator Author

@AndrewSisley are you ok with the latest changes?

@AndrewSisley
Copy link
Contributor

@AndrewSisley are you ok with the latest changes?

Looks good to me! Cheers for finding a better linter for this :)

@fredcarle fredcarle force-pushed the fredcarle/chore/I161-error-strings branch from ad9ca11 to 46bc0eb Compare October 19, 2022 18:49
@fredcarle fredcarle force-pushed the fredcarle/chore/I161-error-strings branch from 46bc0eb to 28070ee Compare October 19, 2022 19:14
Copy link
Contributor

@orpheuslummis orpheuslummis left a comment

Choose a reason for hiding this comment

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

LGTM

@fredcarle fredcarle merged commit f96fe72 into develop Oct 20, 2022
@fredcarle fredcarle deleted the fredcarle/chore/I161-error-strings branch October 20, 2022 23:41
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
Relevant issue(s)
Resolves sourcenetwork#161

Description
This PR adds a linter rule that checks for proper formatting of the error message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. ci/build This is issue is about the build or CI system, and the administration of it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go-staticcheck: error strings should not be capitalized (ST1005)
3 participants