Rule to enforce consistent indentation style

Hi,
would it be possible to enforce consistent indentation style such as space vs tabs, line length, wrapping, breaks etc? Is there any plan to implement an indentation style ruleset?

Thank you,

Ilaria

2 Likes

Hi Ilaria, thanks for suggesting this, it’s a great point.

Although it might sound super trivial, unfortunately, this is would be quite a difficult change for us to make. Our rule engine is designed to look at the ‘architecture’ of the code: all spaces/ comments, etc are discarded at parsing time before we can apply any rules.

In our team, we decided that style rules are non-prescriptive: we do have a guideline, but we don’t consider indentation or other style-related remarks, as review-blockers. If you want to be rigorous, this can probably be achieved by preprocessing all commits with pretty-printers and git hooks, however, it might just be a bit too complex to justify the effort.

I hope it makes sense. Sorry I cannot help more at this time, please let me know if you have any further comment.

Lorenzo

I can suggest this tool: https://prettier.io/
I haven’t used it, but it looks like what you are searching for!

You can solve this by using the same IDE and using the same auto-formatting configuration. Often you can save a config file in a shared location and tell your developers to apply it to their IDE.

It doesn’t eliminate the problem, but it may get you closer.

1 Like