generator: add command line argument to override enabled scripts#1609
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🧰 Additional context used🪛 LanguageToolCHANGELOG.md[style] ~47-~47: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym. (ADVERB_REPETITION_PREMIUM) 🪛 Ruff (0.15.13)packages/evolution-generator/src/scripts/generate_survey.py[warning] 70-70: Missing return type annotation for private function (ANN202) [warning] 81-84: Avoid specifying long messages outside the exception class (TRY003) [warning] 90-93: Avoid specifying long messages outside the exception class (TRY003) [warning] 98-98: Missing return type annotation for private function (ANN202) [warning] 106-106: Too many branches (15 > 12) (PLR0912) [warning] 106-106: Too many statements (65 > 50) (PLR0915) 🔇 Additional comments (10)
WalkthroughThis PR adds a Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I tested and it works. There is no tests for this file, and it would need quite a lot of mocking all the scripts. @samuel-duhaime let me know if you insist to get tests, I can see what can be done. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 47: Update the CHANGELOG.md entry to improve clarity: change "Command
line arguments to the generator to generate only a list of scripts instead of
everything" to a bold heading following other generator feature entries (e.g.,
**Generator: ...**), use "command-line" as a compound adjective, explicitly
reference the flag `--only`, and hyphenate compound phrases where appropriate
(e.g., "list-only scripts" or "generate a list-only of scripts") so the entry
reads clearly and consistently with other generator entries.
In `@packages/evolution-generator/src/scripts/generate_survey.py`:
- Around line 69-82: The parsing loop for only_scripts can produce an empty
normalized_scripts set when the user passes only whitespace/commas, silently
disabling all scripts; after the loop that populates normalized_scripts (using
only_scripts and SUPPORTED_SCRIPT_ALIASES) add a check that if
normalized_scripts is empty you raise a ValueError with a clear message like "No
valid scripts specified in --only; supported values are: <list>" (use ",
".join(sorted(SUPPORTED_SCRIPT_ALIASES.keys())) to produce the list) so callers
get an explicit error instead of silently continuing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: d09e2208-4f42-4676-860b-1b690ad7d04b
📒 Files selected for processing (2)
CHANGELOG.mdpackages/evolution-generator/src/scripts/generate_survey.py
📜 Review details
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md
[grammar] ~47-~47: Use a hyphen to join words.
Context: ...bilite/evolution/issues/997)). - Command line arguments to the generator to gener...
(QB_NEW_EN_HYPHEN)
🪛 Ruff (0.15.13)
packages/evolution-generator/src/scripts/generate_survey.py
[warning] 65-65: Missing return type annotation for private function _parse_only_scripts
(ANN202)
[warning] 76-79: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 85-85: Missing return type annotation for private function _override_enabled_scripts
(ANN202)
[warning] 93-93: Too many branches (15 > 12)
(PLR0912)
[warning] 93-93: Too many statements (65 > 50)
(PLR0915)
🔇 Additional comments (6)
packages/evolution-generator/src/scripts/generate_survey.py (6)
28-44: LGTM!
48-62: LGTM!
85-88: LGTM!
93-93: LGTM!Also applies to: 104-107
274-281: LGTM!
284-284: LGTM!Also applies to: 287-287
samuel-duhaime
left a comment
There was a problem hiding this comment.
Je crois qu'il serait important de mettre à jour le README de evolution-generator pour montrer brièvement un exemple de cette commande.
fixes chairemobilite#1601 When developing a questionnaire, we may want to build only part of it, for example the choices, labels or widgets for quick development. Long questionnaire can take a while to generate everything and it is not desirable to do it at all times. This adds the command line argument `--only` that takes a comma-separated list of scripts to generate. For example, to generate only the widget configs, conditional and labels, adding `--only widgets_configs,widgets,conditionals,labels` would generate only those data, ignoring the rest.
fixes #1601
When developing a questionnaire, we may want to build only part of it, for example the choices, labels or widgets for quick development. Long questionnaire can take a while to generate everything and it is not desirable to do it at all times.
This adds the command line argument
--onlythat takes a comma-separated list of scripts to generate. For example, to generate only the widget configs, conditional and labels, adding--only widgets_configs,widgets,conditionals,labelswould generate only those data, ignoring the rest.Summary by CodeRabbit
New Features
Documentation