Skip to content

Generate valid variable names when using originalCase naming convention#881

Merged
tefra merged 1 commit intotefra:mainfrom
SrirachaHorse:fix-880
Dec 16, 2023
Merged

Generate valid variable names when using originalCase naming convention#881
tefra merged 1 commit intotefra:mainfrom
SrirachaHorse:fix-880

Conversation

@SrirachaHorse
Copy link
Contributor

@SrirachaHorse SrirachaHorse commented Dec 14, 2023

📒 Description

When using originalCase naming syntax for classes or fields where the names have been generated by the library, ensure that only valid characters are used for the variable in the generated Python code.

Resolves #880

🔗 What I've Done

Implements a new method in the utils.text library named variable(), which will use some simple regex matching to strip out anything except alphanumeric characters and underscores from the variable name. It will also ensure that a variable name does not start with a digit character.

This resolves both of the examples listed in #880.

💬 Comments

None

🛫 Checklist

@codecov
Copy link

codecov bot commented Dec 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (db9c34b) 99.89% compared to head (9332942) 99.89%.
Report is 2 commits behind head on main.

❗ Current head 9332942 differs from pull request most recent head 7474d76. Consider uploading reports for the commit 7474d76 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #881      +/-   ##
==========================================
- Coverage   99.89%   99.89%   -0.01%     
==========================================
  Files         105      105              
  Lines        9308     9307       -1     
  Branches     2080     2079       -1     
==========================================
- Hits         9298     9297       -1     
  Misses          3        3              
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@tefra tefra left a comment

Choose a reason for hiding this comment

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

Thank you!

@tefra tefra merged commit c6a1c66 into tefra:main Dec 16, 2023
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

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.

originalCase naming convention can lead to invalid Python syntax

2 participants