-
Notifications
You must be signed in to change notification settings - Fork 167
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 recommendation for code formatting (and apply it) #4221
Conversation
Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo
Outdated
Show resolved
Hide resolved
Modelica/Electrical/Machines/Examples/DCMachines/DCPM_CurrentControlled.mo
Outdated
Show resolved
Hide resolved
Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo
Outdated
Show resolved
Hide resolved
Modelica/Electrical/Analog/Examples/Utilities/DirectCapacitor.mo
Outdated
Show resolved
Hide resolved
@HansOlsson I miss a notice how to indentate multi-line declarations. |
I tried to add both of them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor with this suggestion.
Even if we could go farther similar to Python's PEP8 - Indentation it would be probably too restrictive for now.
@casella as new MAP-Lib leader I hope you approve of this. |
@casella @henrikt-ma can you review it - so that it can be merged before release-branch on Friday January 12th? |
I believe that the previous formatting in Digitial is due to someone having protected A protected B protected C (which would be another style). Then the subsequent protected were lost, and first protected formatted on a separate line.
(Additional changes would be good.)
Co-authored-by: Henrik Tidefelt <[email protected]> Apply suggestions from code review Minor formatting changes in html code
Co-authored-by: tobolar <[email protected]>
Give example. Rename to be slightly better. Quoting! Type Modelica keywords in bold and remove trailing whitespaces ;-)
d4cb1d4
to
0b277be
Compare
I have now rebased it on master and removed three new cases of trailing white-space. It would be good if this could be approved and merged, @casella @henrikt-ma |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conventions look sensible, and I can't spot anything obviously wrong with the included changes.
What I'd like to avoid however, is the risk of styling conventions for the Modelica Standard Library to be taken as conventions that should apply to all Modelica code. To avoid this, I suggest changing this sentence:
ModelicaStandardLibrary/Modelica/package.mo
Line 2281 in 0e0f5d3
<p>A Modelica main package should be compliant with the UsersGuide stated in this documentation:</p> |
Something like this would make more sense to me:
<p>A Modelica main package of the Modelica Standard Library should be compliant with the UsersGuide stated in this documentation:</p>
By the way, I had never heard of a Modelica main package until I saw this line – is it a generally recognized term? Does it mean the same as what I'd refer to as an MSL sub-library?
Please avoid rebasing, as it breaks GitHub conversations linked to commits. For example, I was unable to find my previous review comments in order to see if and how they had been addressed. |
Rebasing is unfortunately needed to ensure easier merging - as the status was too messy, but that's why it should only be done after addressing the comments. |
That line wasn't changed; and the UsersGuide already contained recommendations that could get into that problem. So, once more: don't block PRs based on other existing issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, the potential risk of these guidelines being misinterpreted as applying to all Modelica code (not just in the MSL) isn't new and will be reported separately.
Add some description of how we want code to be formatted, and apply the rules.
Some minor items to clean up.