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

Auto formatting #677

Open
1 of 8 tasks
mvanzulli opened this issue Nov 24, 2023 · 10 comments
Open
1 of 8 tasks

Auto formatting #677

mvanzulli opened this issue Nov 24, 2023 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@mvanzulli
Copy link
Member

mvanzulli commented Nov 24, 2023

We plan to integrate [Miss Hit](https://misshit.org/tools.html) 🤟🏼 for static code checks. The steps are as follows:

  • Create a script and .toml file to track dependencies and perform various static checks.
  • Agree on the format style and fix issues
  • Fix errors until no issues remain.
    • docs
    • examples
    • test
    • src (maybe we can split it by folders if helps)
  • Automate static checks in CI or as a pre-commit hook for this package.
@jorgepz
Copy link
Member

jorgepz commented Nov 26, 2023

Thanks Mauricio. Very interesting. Which is the repo you took this code from? I guess the best way would be using pythons equivalent to toml and install the package instead of just copying the code. I think this would be nice if it were possible to automate it in a windows or linux script... Or in the CI... I am tagging it as a potential enhancement.

@jorgepz jorgepz added the enhancement New feature or request label Nov 26, 2023
@mvanzulli
Copy link
Member Author

This is the source: https://github.com/nonnullish/octave-formatter-vscode. This pks is distributed under GPL license, is just a module, not a pkg. We can make this an external Python pkg and install it via pip, but IMHO is an overkill. But we can run the script yes as bash in CI running it recursively. Formatting checks can be addressed as a follow-up using got diff as CI stage. I guess if we are interested in, I can start running it locally and check if ONSAS keep running (syntax error could arise).

@jorgepz
Copy link
Member

jorgepz commented Nov 28, 2023

Very interesting. The format update to all files would be a nice thing to do after for instance, all the 0.3.0 issues are solved. I guess that running the python script as stand alone is enough. I wouldn't duplicate that repo code here. I hope that package/script was converted to a package... IMHO it is an interesting package. @nonnullish have you thought about porting https://github.com/nonnullish/octave-formatter-vscode to a package so that it can be installed and executed?

@nonnullish
Copy link

Hi, I believe this question should be directed towards @affenwiesel, the author of the source formatter (https://github.com/affenwiesel/matlab-formatter-vscode). My fork only has a small change in the VS Code config and I plan to retire it soon.

@jorgepz
Copy link
Member

jorgepz commented Nov 29, 2023

great! thanks @nonnullish! let's wait for @affenwiesel

@affenwiesel
Copy link

Hi, I have no experience with python packages. I also don't have a lot of spare time at the moment so I'm not able to work on this project right now. Maybe some time next year.

@jorgepz
Copy link
Member

jorgepz commented Dec 1, 2023

thanks @affenwiesel . just to be clear, I am referring to this https://packaging.python.org/en/latest/tutorials/packaging-projects/ when I talk about registering the package. Maybe at some point in the near future, me or @mvanzulli can fork and modify your project to ease the registering.
Cheers!

@jorgepz jorgepz closed this as completed May 13, 2024
@jorgepz jorgepz closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
@jorgepz
Copy link
Member

jorgepz commented Dec 9, 2024

thanks to the suggestion from @Remi-Gau we could consider using https://github.com/florianschanda/miss_hit for auto-formatting, since this can be installed as a python package

@jorgepz jorgepz reopened this Dec 9, 2024
@Remi-Gau
Copy link

short version:

  • requires to have python installed
  • install the package
pip install miss_hit
  • I mostly use 3 of its tools:

    • mh_lint: linting to catch eventual bugs
    • mh_metric: metric checking to make sure the code does not get too complex
    • mh_style: forces a consistent style (line length, spaces around operators, function naming...)
  • I usually use pre-commit to enforce style at commit time and to check style in CI when pushing to a branch or opening a pull request

See this part of this blog post for more info: https://remi-gau.github.io/2022/03/31/clean-matlab.html#miss_hit

@jorgepz
Copy link
Member

jorgepz commented Dec 10, 2024

Thank you @Remi-Gau !!

@mvanzulli mvanzulli self-assigned this Dec 15, 2024
mvanzulli added a commit that referenced this issue Dec 15, 2024
jorgepz pushed a commit that referenced this issue Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants