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

Address code smells in DataGenerator #1076

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

peternied
Copy link
Member

Description

Address code smells in DataGenerator

  • Defined constants for reused literals
  • Mark unmodified fields final
  • Add a private constructor to hide the implicit public constructor

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

- Defined constants for reused literals
- Mark unmodified fields final
- Add a private constructor to hide the implicit public constructor

Signed-off-by: Peter Nied <[email protected]>
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.19%. Comparing base (d0a0b6f) to head (b110bd8).
Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1076   +/-   ##
=========================================
  Coverage     80.19%   80.19%           
- Complexity     2863     2866    +3     
=========================================
  Files           383      383           
  Lines         14333    14337    +4     
  Branches        988      988           
=========================================
+ Hits          11494    11498    +4     
  Misses         2245     2245           
  Partials        594      594           
Flag Coverage Δ
gradle-test 78.22% <100.00%> (+<0.01%) ⬆️
python-test 90.24% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@gregschohn gregschohn left a comment

Choose a reason for hiding this comment

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

UtilityClass is one annotation I'd rather us not use. It's value is marginal and it requires me to review the entire class/file, which is especially scary when looking at a diff since a reviewer won't see the whole file by default.

@peternied
Copy link
Member Author

UtilityClass is one annotation I'd rather us not use. It's value is marginal and it requires me to review the entire class/file, which is especially scary when looking at a diff since a reviewer won't see the whole file by default.

Thanks for the review, I have addressed this comment.

Comment on lines +12 to +14
import static org.opensearch.migrations.data.FieldBuilders.GEO_POINT;
import static org.opensearch.migrations.data.FieldBuilders.INTEGER;
import static org.opensearch.migrations.data.FieldBuilders.LONG;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's continue to not allow static imports outside of test code (this is in src, not testFixture)
Adding the classname will give names like "INTEGER" some more context and clarity

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the feedback, I don't agree with the style preference. I would prefer to merge this change as is.

I've created MIGRATIONS-2141 [1] to automate enforcement of style issues, lets use tooling to align our preferences.

@peternied peternied merged commit d90a448 into opensearch-project:main Oct 24, 2024
14 checks passed
@peternied peternied deleted the data-gen-smells branch October 24, 2024 12:45
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.

3 participants