fprettify icon indicating copy to clipboard operation
fprettify copied to clipboard

Introduce automatic splitting of long lines

Open pseewald opened this issue 9 years ago • 6 comments
trafficstars

It's a useful feature and should not be too hard to implement

pseewald avatar Sep 01 '16 20:09 pseewald

Hi, at the moment even if the splitting is not done automatically, I would like to stop as an error if the line is too long, and switching this on with a command-line switch. The reason is that I'm using

By looking at the code, the way I would do it is to have a flag that converts WARNING level logs to errors and stop. What do you think? (Another option: if there is any output from the code, then stop) Or is there an easy way to say to pre-commit "if there is output in stderr, please stop"?

giovannipizzi avatar Sep 18 '18 14:09 giovannipizzi

I'd prefer to not introduce such a flag and to stop only for failures. It is not a problem for fprettify to handle long lines. As long as the input code is standard conforming, fprettify should not stop with an error. So I leave it up to you to check the warning message (but I don't know how to do that with pre-commit).

pseewald avatar Sep 19 '18 12:09 pseewald

I see your point, but at the moment the indentation is wrong and until this issue is fixed we get a "wrong" output... a person can easily split and run again fprettify.

I understand you don't want to change the code, but would you accept an extension (optional for users) to the pre-commit file in your repo, that wraps fprettify and exits with a non-zero error code if there is any output? Most people wouldn't notice but I could use it.

giovannipizzi avatar Sep 19 '18 19:09 giovannipizzi

Never mind, I think I found a way to do this directly in my repo: https://github.com/giovannipizzi/wannier90/commit/01d1231e64f6d80a51054bc003fd0cac5fb9d98a

giovannipizzi avatar Sep 19 '18 20:09 giovannipizzi

is line splitting going to be implemented? It would be very helpful for legacy code

varchasgopalaswamy avatar Apr 19 '20 23:04 varchasgopalaswamy

I still agree that this should be a feature, unfortunately I won't have time in the near future to implement this.

pseewald avatar Apr 23 '20 10:04 pseewald