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

Code quality #176

Closed
wants to merge 7 commits into from
Closed

Code quality #176

wants to merge 7 commits into from

Conversation

kamushadenes
Copy link
Contributor

Several fixes that shouldn't affect any functionality, but that greatly improve code quality and readability.

Also, added golangci-lint config and workflow to prevent future issues, as well as SCA security checks.

Changes

  • Replaced deprecated code
  • Removed unused code
  • Avoid lots of unnecessary allocations by using more direct methods
  • Avoid lots of unnecessary conversions / casts of the same type
  • Added missing body closures
  • Added explicit tags to some structs that where YAML / JSON marshaled
  • Overall makes the code more idiomatic

Signed-off-by: Henrique Goncalves <hgoncalves@altinity.com>
Signed-off-by: Henrique Goncalves <hgoncalves@altinity.com>
Signed-off-by: Henrique Goncalves <hgoncalves@altinity.com>
Signed-off-by: Henrique Goncalves <hgoncalves@altinity.com>
Signed-off-by: Henrique Goncalves <hgoncalves@altinity.com>
Copy link
Contributor

@laskoviymishka laskoviymishka left a comment

Choose a reason for hiding this comment

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

This one is too big to merge, we avoid such monstrous PR-s, having more that 20 files in diff is already very dangerous.
In a meantime there is a lot of nice changes, if you extract them in separate PR-s and keep them narrow in terms of scope - it would be possible to merge relatively easy.

There is couple changes that I would prefer to rollback:

  1. All changes in library/go, this code is semi-owned by a transfer, in a fact it's more like a copy-paste style vendored code.
  2. All changes in comments, no need to all those dot's, see here for rationaly
  3. All json and yaml tags for entities inside pkg/providers, this would make version upgrades much more complicated for no good reason.
  4. Linter and CI-code, this better to make under chore: Setup linter inside CI #177 epic, there is already some linting in place, but it's not automated in CI.

tok = AND
} else if ttU == "OR" {
case "OR":
Copy link
Contributor

Choose a reason for hiding this comment

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

nice impr, better to extract in separate PR.

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.

2 participants