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

Attributes with blankspaces lead to syntax error or unexpected generated code #213

Open
mgv99 opened this issue Feb 6, 2025 · 1 comment · Fixed by #232
Open

Attributes with blankspaces lead to syntax error or unexpected generated code #213

mgv99 opened this issue Feb 6, 2025 · 1 comment · Fixed by #232
Labels
bug Something isn't working good first issue Good for newcomers web modeling editor Linked to the Web Modeling Editor

Comments

@mgv99
Copy link
Collaborator

mgv99 commented Feb 6, 2025

Describe the bug

We are "allowed" to use blankspaces in attribute names, but when generating python classes, it only keeps the first word. For instance, an attribute called "task name: str" would generate an attribute:

self.task = task

Expected behaviour: create an attr called:
task_name: str

To fix it: replace blankspaces by underscores?

Image

With Enum classes, the behaviour is different: it keeps all the words but syntax is still incorrect (spaces should be replaced by underscores):

class TaskStatus(Enum):
	Not started = "Not started"
	
	Done = "Done"
	
	In Progress = "In Progress"

If blankspaces are not allowed, there should be some compilation error, or at least some warning.

@mgv99 mgv99 added bug Something isn't working web modeling editor Linked to the Web Modeling Editor labels Feb 6, 2025
@ivan-alfonso ivan-alfonso added the good first issue Good for newcomers label Feb 14, 2025
@jcabot
Copy link
Collaborator

jcabot commented Feb 17, 2025

We're adding a rule in BUML to raise an exception if an attribute name has a blank space as, like in this case, this generates many issues that are not worth dealing with just for the very few cases where a user would like to have a blank space in the name of an attribute

ivan-alfonso added a commit that referenced this issue Feb 17, 2025
Results of the AI session

Fix #56
Fix #228
Fix #226
Fix #213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers web modeling editor Linked to the Web Modeling Editor
Development

Successfully merging a pull request may close this issue.

3 participants