whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Suggestion: Add .clang-format file

Open asmaloney opened this issue 2 years ago • 4 comments

It would be useful when making larger changes (like this) if it could be properly formatted using clang-format.

Do you happen to have a .clang-format file you can drop into the repo?

asmaloney avatar Dec 24 '22 23:12 asmaloney

I don't have a .clang-format - it would be great to create one that matches the existing style if possible

ggerganov avatar Jan 02 '23 10:01 ggerganov

In my experience it will be tricky to match your style 100%.

If you're willing to compromise on a few things I believe getting code formatting automated and out of the way is a win for any project.

I'll work on it to see how close I can get to the existing code then you can assess it and tweak it if you like.

asmaloney avatar Jan 02 '23 15:01 asmaloney

I think I've seen a tool that can analyse a codebase and try to generate .clang-format that is very close to the existing style. I might be wrong though

ggerganov avatar Jan 02 '23 15:01 ggerganov

I've tried a couple with not-so-great results, but maybe I haven't found the right one yet.

The tricky thing is that clang-format options are complicated and amended frequently. C++ formatting is a mess and has caused so many wasted hours (and bugs) - I like go's approach with gofmt! 😄

asmaloney avatar Jan 02 '23 15:01 asmaloney