-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add rules for function and parameter to have the closing parenthesis on its own line #1103
Comments
I will try to raise a PR for this. At the moment I am planning a "simple solution" of a rule each for functions and procedures that enforces the new line. I suppose it would be disabled by default to maintain the current default behaviour. However, this does not allow enforcement of the inverse, i.e. no newline before the closing parenthesis. In order to have that configurability, I think it might be better to just roll the structure rules for functions and procedure together into a procedure_call_003 style structure rule. I would probably need some guidance before trying that, so unless I hear otherwise, I'll just stick with the simple solution. Update: I've had another look and I have managed to put together a more general rule for subprogram specification structure, similar to procedure_call_003, so I think that this will be a nice, tidy solution. Just working on cleanup, testing and documentation now. |
I have raised PR #1108 for this issue. |
In addition to the closing parenthesis, the new rules also enforce the newlines around the opening parenthesis, interface list semcolons and interface elements. There are not indentation rules for all of these yet, but that PR is already quite large (and much larger than I originally intended), so I think that the missing indentation rules should be implemented as a separate issue/when someone requests it. |
Morning @JHertz5 ,
I agree. The current indent rules will cover the most likely structural styles. The pull request looks really good. I appreciate the documentation and the tests you added to cover the new rules. I just had several minor comments in the PR. When we address those I will merge this to master. How did you find the process of adding these rules? Anything I can do to make it easier or less confusing? Regards, --Jeremy |
Thanks very much!
Perfect, thanks. I'll address any comments as soon as I get a chance, should be on the weekend at the latest. I can't see any comments on the PR at the moment. Have they not been submitted yet?
I found it to be straightforward now that I've built some familiarity with your codebase. My strategy was to find existing rules that were similar to what I wanted to implement, and use those as a template for the new rule, using bin/vsg_parser to identify the tokens within the snippet of VHDL that I used to test the new rule. So, for myself, I don't think there is anything that caused confusion or difficulty. If you'd like my opinion on the experience for a new contributor, I have a couple of thoughts. Things like using bin/vsg_parser to identify tokens and using bin/vsg_rule_doc_gen to update the documentation are extremely useful for a contributor but are not obvious or easy to discover without your guidance. I've seen some extremely helpful comments that you've very kindly written to individuals (including myself), describing how to create a new rule, set up tests, etc. but this information isn't easy to find. I think it would be useful to have something like a broad step-by-step guide to producing a rule, or just a "useful tips for contributors" page? |
Morning @JHertz5 ,
The comments show up in the conversion tab of the PR. If you scroll towards the bottom you will see the three comments I made. Thank you for the feedback on the contributing experience, it is obviously a blind spot for me. I really should document the process of adding a new rule. That would bring out all the tools available. I could also describe the patterns you see in creating tests, etc... I will create a ticket to improve what little documentation I have. Thanks, --Jeremy |
Evening @JHertz5 ,
I just submitted the review, so I hope you can see the comments now. --Jeremy |
Thanks very much @jeremiah-c-leary! I can see those comments now. I have actioned/responded to each and requested your re-review. |
Is your feature request related to a problem? Please describe.
procedure_006 and function_300 can both enforce indentation of the closing parenthesis if it is on its own line. However, I can't find any rule to enforce that closing parenthesis being on its own line.
Describe the solution you'd like
I would like to be able to enforce the closing parenthesis of a function/procedure to be on its own line. For example, I'd like the code:
to be formatted to
The text was updated successfully, but these errors were encountered: