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

Add staticcheck CI with refactor #722

Merged
merged 13 commits into from
Sep 5, 2022
Merged

Add staticcheck CI with refactor #722

merged 13 commits into from
Sep 5, 2022

Conversation

julian-bcw
Copy link
Contributor

@julian-bcw julian-bcw commented Aug 23, 2022

Detailed description:
This PR does two things:

  1. Introduces a static analysis pipeline to help prevent potential bugs and security vulnerabilities in the future.
    Specifically, this will check for things like deprecated packages, dead code, and inefficient/redundant function calls and expressions.
  2. Refactors the existing code to resolve any alarms.
    • Most of these changes are simplifications and dead code elimination, though there was also a deprecated package in the test cases, as well as an inefficient string comparison. Overall, low priority fixes.

A complete list of the checks in this pipeline can be found here, though I have removed the style checks (ST*) as well as a few “code simplifications” (S1002, S1005, S1008, S1023, S1039) that are more like style preferences.

EDIT: I've also removed check U1000 (no unused variables), because it was causing the E2E tests to fail. I suspect that there was a false alarm. Perhaps a struct needs to be in a certain format to be converted to a JSON or something.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated

@julian-bcw julian-bcw changed the title Ci staticcheck Add staticcheck CI with refactor Aug 23, 2022
@codecov
Copy link

codecov bot commented Aug 23, 2022

Codecov Report

Merging #722 (7c3c4f8) into main (63a277b) will not change coverage.
The diff coverage is 37.20%.

@@           Coverage Diff           @@
##             main     #722   +/-   ##
=======================================
  Coverage   63.56%   63.56%           
=======================================
  Files          78       78           
  Lines        5676     5676           
=======================================
  Hits         3608     3608           
  Misses       1896     1896           
  Partials      172      172           
Flag Coverage Δ
unittests 63.56% <37.20%> (ø)

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

Impacted Files Coverage Δ
.../process/handler/read-only/fee-transfer/handler.go 17.10% <0.00%> (ø)
app/process/watcher/transfer/watcher.go 45.78% <0.00%> (ø)
app/services/contracts/service.go 0.00% <0.00%> (ø)
app/services/pricing/service.go 65.03% <12.50%> (ø)
app/services/assets/assets.go 70.43% <28.57%> (ø)
app/process/watcher/evm/watcher.go 35.24% <33.33%> (ø)
app/clients/evm/client.go 47.97% <50.00%> (ø)
app/clients/hedera/mirror-node/client.go 49.36% <50.00%> (ø)
app/helper/big-numbers/helper.go 58.33% <100.00%> (ø)
app/helper/memo/helper.go 100.00% <100.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

rokn
rokn previously approved these changes Aug 30, 2022
@svetlio8 svetlio8 requested review from Psykepro and svetlio8 August 31, 2022 09:37
svetlio8
svetlio8 previously approved these changes Aug 31, 2022
Psykepro
Psykepro previously approved these changes Aug 31, 2022
@svetlio8 svetlio8 self-requested a review September 1, 2022 11:07
Copy link
Collaborator

@svetlio8 svetlio8 left a comment

Choose a reason for hiding this comment

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

Could you please sign your commits? It is part of the checks.

@julian-bcw
Copy link
Contributor Author

@svetlio8 This is strange. All of the commits are signed already. Should I just close this PR and reopen?

@failfmi
Copy link
Collaborator

failfmi commented Sep 2, 2022

@svetlio8 This is strange. All of the commits are signed already. Should I just close this PR and reopen?

@julian-bcw
Sign-offs and signed commits are two different things:
https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification

@julian-bcw
Copy link
Contributor Author

@failfmi Ah, thanks for the explanation! I've signed the commits, and force-pushed.

@Psykepro Psykepro merged commit 09a39de into main Sep 5, 2022
@Psykepro Psykepro deleted the ci-staticcheck branch September 5, 2022 07:06
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.

5 participants