Skip to content

Conversation

@Remi-Gau
Copy link
Contributor

@marcobarilari you were asking for some styling tool that would help you know where to put spaces and so on.

This PR is the results of just typing this in the command line. Many of things this linter is not happy with are automatically fixed. Others throw a warning.

mh_style.py . --fix

From this project: https://florianschanda.github.io/miss_hit/style_checker.html

The main difference vizually is that it indents the functions by default, but the matlab editor can do that too if you set it up that way.

I am tempted to start adding this linter to our matlab projects so we don't have to think about formating.

@CerenB @marcobarilari
What do you think?

@marcobarilari
Copy link
Collaborator

Can I apply it to real life? From a quick view, it looks fantastic. I'll go deeper later but first question a stupid question, can I ask it what changes I would like to do/don't apply?

I see it is placing the ; no matter what, in some cases might be useless and matlab would complain

@Remi-Gau
Copy link
Contributor Author

Can I apply it to real life? From a quick view, it looks fantastic. I'll go deeper later but first question a stupid question, can I ask it what changes I would like to do/don't apply?

It will only fix things automatically if you pass the --fix argument.

I see it is placing the ; no matter what, in some cases might be useless and matlab would complain

You can tweak the rules by creating a miss_hit.cfg config file.

The one i have created contains this to limit the amount of warnings and also capture our camelCase rule for the function names. It cannot check variable names (yet?).

line_length: 100
regex_function_name: "[a-z]+(([A-Z]|[0-9]){1}[a-z]+)*"
suppress_rule: "copyright_notice"

if you want to prevent the auto-fix of semi-colons then add:
suppress_rule: end_of_statements

@Remi-Gau
Copy link
Contributor Author

Unless I hear screams of outrage I will make Miss_Hit the official linter tool for this repo in 24 hours.

Will try to see if I can add to the Travis continuous integration so we get it checked automatically when we open a PR and push.

@Remi-Gau Remi-Gau merged commit ce6de21 into cpp-lln-lab:master Jul 22, 2020
@Remi-Gau Remi-Gau deleted the remi-MISS_HIT_linter branch July 22, 2020 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants