Repository navigation
bug: generate a valid class name when the project name starts with a digit - #674
Open
Amadeus-22 wants to merge 1 commit into
Open
Amadeus-22 wants to merge 1 commit into
Amadeus-22 wants to merge 1 commit into
Conversation
…digit convert_to_class_name only removed non-alphanumeric characters, so a project called '2024 Momentum' got 'class 2024Momentum', which does not compile. Prefix the name with an underscore when it is empty or starts with a digit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #673.
lean project-create --language python "2024 Momentum"wroteclass 2024Momentum(QCAlgorithm):, which is a syntax error; the same happens for C#. The command still exited with code 0.convert_to_class_namenow prefixes the name with an underscore when it is empty or starts with a digit (_2024Momentum). Other names are unchanged. The same helper is used bylean research.main.py. It fails on master and passes with the fix.pytest tests/commands/test_create_project.py tests/commands/test_research.pypasses (30 tests, Python 3.12) andpython static_analysis.pyis clean.🤖 Generated with Claude Code