coala / coala-bears

Bears for coala
https://coala.io/
GNU Affero General Public License v3.0
296 stars 580 forks source link

Support uncrustify for Cish languages #783

Open jayvdb opened 8 years ago

jayvdb commented 8 years ago

https://github.com/uncrustify/uncrustify is by far the best indentation tool for Cish languages. Very configurable and very actively improved to handle corner cases that most indenter force to be ugly code.

gitmate-bot commented 8 years ago

Thanks for reporting this issue! A coalaian will look at it soon.

sils commented 8 years ago

Nice! Would you be interested in helping us out with this?

jayvdb commented 8 years ago

Yea. I'll give it a shot.

sils commented 8 years ago

I have sent you an invitation to join our community. This is needed so we can coordinate tasks with you and make sure no two persons are working on the same thing. If you can't find the mail, you should be able to join us at http://github.com/coala-analyzer/!

We'd love to be able to help you when problems occur. Just join us on our gitter channel and tell us about them :)

sils commented 8 years ago

We have a tutorial on writing "linter bears" in the docs, tell us if you need any help and keep filing issues :)

jayvdb commented 8 years ago

I was doing some analysis on how to create coala settings that could be mapped to uncrustifys extensive config , and found that uncrustify will strip all trailing whitespace (https://github.com/uncrustify/uncrustify/issues/132) , which would mean that allow_trailing_whitespace = True would be ignored. I found that other linters are also ignoring allow_trailing_whitespace and use_spaces, so I raised #844 about the PEP8 bear.

sils commented 8 years ago

for the moment we could warn the user that the setting will be ignored if it conflicts with the available behaviour. alternatively could readd the whitespace in the bear

jayvdb commented 8 years ago

As uncrustify could have modified lines substantially, it may be impossible to re-add whitespace accurately. White the algorithm would be generic and probably useful for other linters that forcefully strip trailing whitespace, it would be a painful and fruitless exercise to build it.

At least initially, a warning would be the best approach. How does a bear get a user setting which the bear does not support, in order to determine if the value is incompatible?

sils commented 7 years ago

Let's do a warning for now and file an issue upstream maybe.

jayvdb commented 7 years ago

Apparently, there is xcode support: https://github.com/openframeworks/openFrameworks/wiki/openFrameworks-Coding-style-guidelines

jayvdb commented 7 years ago

Note that uncrustify doesnt recursively find files, and doesnt want to (https://github.com/uncrustify/uncrustify/issues/639), so their users would possibly really appreciate a coala wrapper.