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

new rule: imports, globals and persistent before code #120

Open
niklasnylen opened this issue Feb 24, 2020 · 2 comments
Open

new rule: imports, globals and persistent before code #120

niklasnylen opened this issue Feb 24, 2020 · 2 comments
Labels
tool: mh_style Affects the style checker tool

Comments

@niklasnylen
Copy link

What kind of feature is this?

  • New feature in MISS_HIT

MISS_HIT component affected

  • Style checker

Describe the solution you'd like
Global and persistent variables shall be declared first in functions.

@florianschanda florianschanda added the tool: mh_style Affects the style checker tool label Feb 24, 2020
@florianschanda
Copy link
Owner

However they need to be after any argument validation blocks, so a function should be ordered like this:

  1. Argument validation blocks (only in matlab 2019b)
  2. imports
  3. global
  4. persistent
  5. function body
  6. nested functions

@florianschanda florianschanda changed the title Declare global and persistent variables first new rule: imports, globals and persistent before code Feb 25, 2020
@florianschanda florianschanda added the difficulty: high This change will be tricky or large label Oct 7, 2020
@florianschanda
Copy link
Owner

@niklasnylen an update this ticket (and similar ones that would do code re-structuring beyond adding whitespace and deleting stuff).

I plan to create another tool mh_reformat that is a much more advanced code reformatting tool. It does not produce messages like mh_style; but instead just pretty prints code.

I suspect I will also remove the autofixing from mh_style once this works. In the future mh_style will only complain :)

The reason for this is largely technical / and developer (i.e. me) sanity. The code that does the fixing has become so complicated that adding new functionality is just not practical any more. :/

@florianschanda florianschanda added the tool: mh_reformat Affects the (future) advanced pretty printer label Dec 4, 2020
@florianschanda florianschanda removed the tool: mh_style Affects the style checker tool label Dec 24, 2020
@florianschanda florianschanda added tool: mh_style Affects the style checker tool and removed difficulty: high This change will be tricky or large tool: mh_reformat Affects the (future) advanced pretty printer labels Apr 6, 2021
@florianschanda florianschanda removed this from the release-0.9.23 milestone Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool: mh_style Affects the style checker tool
Projects
None yet
Development

No branches or pull requests

2 participants