-
Notifications
You must be signed in to change notification settings - Fork 22
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
[ENH] add new UI #313
[ENH] add new UI #313
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.
Hey @Remi-Gau - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 8 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 6 issues found
- 🟡 Complexity: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
"CogPOID": "", | ||
"InstitutionName": "", | ||
"InstitutionAddress": "", | ||
"InstitutionalDepartmentName": "" |
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.
suggestion: Empty string values
Consider removing keys with empty string values or providing meaningful default values.
"InstitutionalDepartmentName": "" | |
{ | |
"CogPOID": "", | |
"InstitutionName": "", | |
"InstitutionAddress": "", | |
"InstitutionalDepartmentName": null | |
} |
ui/ecobidas_ui/app.py
Outdated
from ecobidas_ui._version import version | ||
from ecobidas_ui.extensions import bootstrap, csrf_protect | ||
|
||
# from ecobidas_ui.extensions import cache, debug_toolbar |
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.
suggestion: Remove commented-out import statements
Commented-out import statements can be removed to keep the code clean and maintainable. If these imports are not needed, consider removing them.
# from ecobidas_ui.extensions import cache, debug_toolbar | |
from ecobidas_ui._version import version | |
from ecobidas_ui.extensions import bootstrap, csrf_protect | |
from ecobidas_ui.initializers.assets import init_assets | |
from flask import Flask, flash, render_template |
ui/ecobidas_ui/generate/views.py
Outdated
blueprint = Blueprint("generate", __name__, url_prefix="/generate") | ||
|
||
|
||
def dummmy_data(): |
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.
issue (typo): Typo in function name 'dummmy_data'
The function name 'dummmy_data' contains a typo. Consider renaming it to 'dummy_data' for clarity and correctness.
ui/ecobidas_ui/protocols/forms.py
Outdated
submit_bold_json = SubmitField("Upload") | ||
|
||
|
||
def generate_form(items=None, prefix=None, obj=None) -> FlaskForm: |
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.
issue (code-quality): Low code quality found in generate_form - 17% (low-code-quality
)
Explanation
The quality score for this function is below the quality threshold of 25%.This score is a combination of the method length, cognitive complexity and working memory.
How can you solve this?
It might be worth refactoring this function to make it shorter and more readable.
- Reduce the function length by extracting pieces of functionality out into
their own functions. This is the most important thing you can do - ideally a
function should be less than 10 lines. - Reduce nesting, perhaps by introducing guard clauses to return early.
- Ensure that variables are tightly scoped, so that code using related concepts
sits together within the function rather than being scattered.
ui/ecobidas_ui/protocols/views.py
Outdated
|
||
|
||
@blueprint.post("/<protocol_name>/<activity_name>") | ||
def activity_post(protocol_name, activity_name) -> str: |
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.
issue (code-quality): Low code quality found in activity_post - 14% (low-code-quality
)
Explanation
The quality score for this function is below the quality threshold of 25%.This score is a combination of the method length, cognitive complexity and working memory.
How can you solve this?
It might be worth refactoring this function to make it shorter and more readable.
- Reduce the function length by extracting pieces of functionality out into
their own functions. This is the most important thing you can do - ideally a
function should be less than 10 lines. - Reduce nesting, perhaps by introducing guard clauses to return early.
- Ensure that variables are tightly scoped, so that code using related concepts
sits together within the function rather than being scattered.
ui/ecobidas_ui/protocols/views.py
Outdated
message = f"2 files must be uploaded. Received: {nb_files_uploaded}" | ||
return message | ||
|
||
participants_json_uploaded = any(file.filename == "participants.json" for file in data) | ||
if not participants_json_uploaded: | ||
message = "No 'participants.json' was uploaded." | ||
return message | ||
|
||
participants_tsv_uploaded = any(file.filename == "participants.tsv" for file in data) | ||
if not participants_tsv_uploaded: | ||
message = "No 'participants.tsv' was uploaded." |
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.
issue (code-quality): Inline variable that is immediately returned [×3] (inline-immediately-returned-variable
)
No description provided.