-
Notifications
You must be signed in to change notification settings - Fork 18
[COST-6915] - Remove invalid characters from Azure subscription aliases #595
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
Conversation
|
|
Summary of ChangesHello @esebesto, 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 addresses an issue where generated Azure subscription aliases might contain invalid characters, such as commas and spaces, by implementing a sanitization step. The change ensures that the Highlights
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to sanitize Azure subscription aliases by removing commas and replacing spaces with underscores. While the change correctly sanitizes the company_name for the alias, it introduces a side-effect bug where the company_email is generated with an invalid domain name containing underscores. I've added a comment with a suggested fix to address this issue by reordering the operations and improving the code.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to sanitize Azure subscription aliases by removing invalid characters like spaces and commas from the company name. The implementation correctly replaces spaces with underscores but introduces a critical bug when attempting to remove commas. The replace() method is called with only one argument, which will result in a TypeError. I've provided a suggestion to fix this issue. The rest of the changes correctly apply the sanitized name.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses the issue of invalid characters (commas and spaces) in Azure subscription aliases by introducing a sanitized company name. The changes are clear and well-targeted. I have one suggestion to use a potentially more efficient method for string sanitization.
| """Return Azure subscription, billing, and usage account info.""" | ||
| fake = Faker() | ||
| company_name = fake.company() | ||
| company_name_sanitized = company_name.replace(" ", "_").replace(",", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sanitizing the company name, you can use str.translate() which can be more efficient and concise when dealing with multiple character replacements or deletions. It performs all transformations in a single pass over the string.
| company_name_sanitized = company_name.replace(" ", "_").replace(",", "") | |
| company_name_sanitized = company_name.translate(str.maketrans(" ", "_", ",")) |
|
/retest |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #595 +/- ##
=======================================
+ Coverage 93.5% 93.6% +0.1%
=======================================
Files 56 56
Lines 4730 4731 +1
Branches 663 663
=======================================
+ Hits 4422 4426 +4
+ Misses 165 164 -1
+ Partials 143 141 -2 🚀 New features to boost your workflow:
|
This PR updates the Azure subscription alias generation logic to exclude invalid characters - specifically commas and spaces.