Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on improving code maintainability by eliminating dead code. It removes an identified unused configuration variable and its associated logic from the application's configuration and data retention processing, along with updating the relevant unit tests. This cleanup streamlines the codebase by removing unnecessary components. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request simplifies data retention by removing the MASU_RETAIN_NUM_MONTHS_LINE_ITEM_ONLY configuration and its associated logic from koku/masu/config.py and koku/masu/processor/expired_data_remover.py. The related test cases in koku/masu/test/processor/test_expired_data_remover.py have been updated. A suggestion was made to consolidate the now identical test_initializer_ocp and test_initializer_azure tests into a single parameterized test for better maintainability.
| def test_initializer_ocp(self): | ||
| """Test to init for OCP.""" | ||
| remover = ExpiredDataRemover(self.schema, Provider.PROVIDER_OCP) | ||
| self.assertEqual(remover._months_to_keep, Config.MASU_RETAIN_NUM_MONTHS) | ||
| self.assertEqual(remover._line_items_months, Config.MASU_RETAIN_NUM_MONTHS_LINE_ITEM_ONLY) | ||
|
|
||
| def test_initializer_azure(self): | ||
| """Test to init for Azure.""" | ||
| remover = ExpiredDataRemover(self.schema, Provider.PROVIDER_AZURE) | ||
| self.assertEqual(remover._months_to_keep, Config.MASU_RETAIN_NUM_MONTHS) | ||
| self.assertEqual(remover._line_items_months, Config.MASU_RETAIN_NUM_MONTHS_LINE_ITEM_ONLY) | ||
|
|
There was a problem hiding this comment.
Now that the assertions for _line_items_months have been removed, test_initializer_ocp and test_initializer_azure are identical. They can be consolidated into a single parameterized test to reduce code duplication and improve maintainability.
| def test_initializer_ocp(self): | |
| """Test to init for OCP.""" | |
| remover = ExpiredDataRemover(self.schema, Provider.PROVIDER_OCP) | |
| self.assertEqual(remover._months_to_keep, Config.MASU_RETAIN_NUM_MONTHS) | |
| self.assertEqual(remover._line_items_months, Config.MASU_RETAIN_NUM_MONTHS_LINE_ITEM_ONLY) | |
| def test_initializer_azure(self): | |
| """Test to init for Azure.""" | |
| remover = ExpiredDataRemover(self.schema, Provider.PROVIDER_AZURE) | |
| self.assertEqual(remover._months_to_keep, Config.MASU_RETAIN_NUM_MONTHS) | |
| self.assertEqual(remover._line_items_months, Config.MASU_RETAIN_NUM_MONTHS_LINE_ITEM_ONLY) | |
| def test_initializer_providers(self): | |
| """Test to init for OCP and Azure providers.""" | |
| for provider in [Provider.PROVIDER_OCP, Provider.PROVIDER_AZURE]: | |
| with self.subTest(provider=provider): | |
| remover = ExpiredDataRemover(self.schema, provider) | |
| self.assertEqual(remover._months_to_keep, Config.MASU_RETAIN_NUM_MONTHS) | |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5965 +/- ##
=======================================
- Coverage 94.3% 94.3% -0.0%
=======================================
Files 356 356
Lines 31107 31102 -5
Branches 3397 3396 -1
=======================================
- Hits 29345 29337 -8
- Misses 1143 1144 +1
- Partials 619 621 +2 🚀 New features to boost your workflow:
|
Removes unused config var: Remove DEFAULT_MASU_RETAIN_NUM_MONTHS_LINE_ITEM_ONLY (dead code)