rustc-dev-guide icon indicating copy to clipboard operation
rustc-dev-guide copied to clipboard

add tool to "enforce" semantic line breaks

Open tshepang opened this issue 3 years ago • 5 comments

See #1132

Run it so:

cd ci/semantic-line-breaks
cargo run --- ../../src [--overwrite]

Diff is large, so maybe should be automated.

tshepang avatar Oct 18 '22 05:10 tshepang

I don't have an objection to enforcing sembr but the implementation does look fragile, e.g. there's no tokenizer. Have you considered using an existing tool like https://github.com/bobheadxi/readable?

JohnTitor avatar Oct 20 '22 10:10 JohnTitor

I have not... thanks for the suggestion, will have a look.

tshepang avatar Oct 20 '22 16:10 tshepang

I have tried using readable to have a GitHub action that runs check, and format all the existing code, but the tool is immature, it gave errors for some files saying Cannot take length of multi-line node '[object Object]' (https://github.com/bobheadxi/readable/issues/18) and for others the aforementioned issue is there, it does the wrong thing when it encounters e.g.(https://github.com/bobheadxi/readable/issues/17). I am not sure what should be done here, make readable better or create another tool?

m-spitfire avatar Jan 23 '23 16:01 m-spitfire

This tool of mine handles both issues without choking. I intend to get back to making it more fancy... I keep postponing.

tshepang avatar Jan 23 '23 20:01 tshepang