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

build: upgrade FOCA to 0.13.0 #52

Merged
merged 5 commits into from
Jun 18, 2024

Conversation

jvkersch
Copy link
Contributor

@jvkersch jvkersch commented Jun 10, 2024

Description

Updates FOCA to the latest version, which is 0.13.0 at the time this PR was opened.

Fixes #49

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have not reduced the existing code coverage
  • I have added docstrings following the Python style guidelines of this project to all new modules, classes, methods and functions are documented with docstrings following; I have updated any previously existing docstrings, if applicable
  • I have updated any sections of the app's documentation that are affected by the proposed changes, if applicable

Summary by Sourcery

This pull request updates the FOCA library to version 0.13.0, refactors the code to use the new configuration syntax, and adjusts the test cases accordingly to ensure compatibility and functionality.

  • Bug Fixes:
    • Updated FOCA to version 0.13.0 to fix compatibility issues.
  • Enhancements:
    • Refactored test cases to use the updated FOCA configuration syntax.
  • Tests:
    • Modified test cases to align with the new FOCA configuration structure.

@jvkersch jvkersch requested a review from uniqueg June 10, 2024 13:02
Copy link
Contributor

sourcery-ai bot commented Jun 10, 2024

Reviewer's Guide by Sourcery

This pull request updates the FOCA library to version 0.13.0. The primary change involves updating the way the FOCA configuration is accessed within the application code and tests. Specifically, the configuration is now accessed using app.config.foca instead of app.config['FOCA']. This update addresses issue #49 and ensures compatibility with the latest version of FOCA.

File-Level Changes

Files Changes
tests/ga4gh/drs/test_server.py
tests/ga4gh/drs/endpoints/test_service_info.py
tests/ga4gh/drs/endpoints/test_register_objects.py
Updated FOCA configuration access in multiple test files to use app.config.foca instead of app.config['FOCA'].
drs_filer/ga4gh/drs/endpoints/register_objects.py
drs_filer/ga4gh/drs/server.py
drs_filer/ga4gh/drs/endpoints/service_info.py
Updated FOCA configuration access in multiple endpoint and server files to use current_app.config.foca instead of current_app.config['FOCA'].

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jvkersch - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Avoid using eval for security reasons. (link)
Here's what I looked at during the review
  • 🟡 General issues: 5 issues found
  • 🔴 Security: 1 blocking issue
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

drs_filer/ga4gh/drs/endpoints/register_objects.py Outdated Show resolved Hide resolved
drs_filer/ga4gh/drs/endpoints/register_objects.py Outdated Show resolved Hide resolved
@@ -121,10 +121,10 @@ def __add_access_ids(data: List) -> List:
Access methods metadata complete with unique access identifiers.
"""
id_charset = eval(
current_app.config['FOCA'].endpoints['access_methods']['id_charset']
current_app.config.foca.endpoints['access_methods']['id_charset']
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 issue (security): Avoid using eval for security reasons.

Using eval can introduce security vulnerabilities. Consider using a safer alternative like ast.literal_eval if the input is expected to be a valid Python literal structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flagged as #54.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can address #54 right after this PR, but I prefer not mixing maintenance changes and behavioral changes.

drs_filer/ga4gh/drs/server.py Show resolved Hide resolved
drs_filer/ga4gh/drs/endpoints/service_info.py Show resolved Hide resolved
drs_filer/app.py Show resolved Hide resolved
kushagra189
kushagra189 previously approved these changes Jun 15, 2024
Copy link

@kushagra189 kushagra189 left a comment

Choose a reason for hiding this comment

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

Only one minor comment. We have made some repetitive usages but we can take that up in a separate refactor as well.

@uniqueg uniqueg changed the title Update FOCA to 0.13 build: upgrade FOCA to 0.13.0 Jun 17, 2024
@jvkersch
Copy link
Contributor Author

Thanks @kushagra189, I've done that particular refactor in the module where there were a lot of repeated usages of that object. There was another instance where Sourcery suggested a refactor but that was not applicable (the repeated code was spread out over multiple functions).

The only open issue is the use of eval (#54). I would suggest merging this PR as-is and tackling that issue separately.

Copy link

@kushagra189 kushagra189 left a comment

Choose a reason for hiding this comment

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

Thanks @jvkersch , LGTM.

@kushagra189 kushagra189 merged commit da53984 into elixir-cloud-aai:dev Jun 18, 2024
uniqueg pushed a commit that referenced this pull request Jun 20, 2024
* build: upgrade FOCA version
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.

Upgrade FOCA to latest version
2 participants