-
Notifications
You must be signed in to change notification settings - Fork 22
Respect SKIP_SETTING_JIRA_FIELDS environment variable #375
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
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 adds support for the SKIP_SETTING_JIRA_FIELDS environment variable to prevent updates to Jira fields, similar to the existing DRY_RUN variable. The implementation is straightforward. My review includes a suggestion to refactor the condition for checking environment variables to improve readability and reduce duplication. I've also noted that a test case for the new functionality is missing and should be added to ensure the change is properly verified.
lbarcziova
left a comment
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.
🙏
Signed-off-by: Nikola Forró <[email protected]>
|
/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 introduces a SKIP_SETTING_JIRA_FIELDS environment variable to bypass updating Jira fields, similar to the existing DRY_RUN functionality. The implementation is straightforward. My review includes a suggestion to make the environment variable check more robust and a recommendation to add test coverage for the new logic branch to ensure correctness.
| flexmock(os).should_receive("getenv").with_args("JIRA_URL").and_return("http://jira") | ||
| flexmock(os).should_receive("getenv").with_args("JIRA_TOKEN").and_return("12345") | ||
| flexmock(os).should_receive("getenv").with_args("DRY_RUN", "False").and_return("false") | ||
| flexmock(os).should_receive("getenv").with_args("SKIP_SETTING_JIRA_FIELDS", "False").and_return("false") |
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.
While this change correctly mocks the new environment variable for existing tests, the new functionality itself is not tested. A new test case should be added to verify that when SKIP_SETTING_JIRA_FIELDS is set to a truthy value, the set_jira_fields function returns the expected skip message and does not attempt to make any API calls to Jira. Untested code paths can introduce regressions in the future.
| """ | ||
| Updates the specified Jira issue, setting only the fields that are currently empty/unset. | ||
| """ | ||
| if os.getenv("SKIP_SETTING_JIRA_FIELDS", "False").lower() == "true": |
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.
Checking for boolean environment variables by comparing to just 'true' can be brittle, as users might intuitively use other truthy values like '1' or 'yes'. It's more robust to check against a set of common truthy string values. This improvement could also be applied to the DRY_RUN check that follows.
| if os.getenv("SKIP_SETTING_JIRA_FIELDS", "False").lower() == "true": | |
| if os.getenv("SKIP_SETTING_JIRA_FIELDS", "False").lower() in ("true", "1", "yes"): |
No description provided.