ggerganov / whisper.cpp

Port of OpenAI's Whisper model in C/C++
MIT License
35.73k stars 3.64k forks source link

Suggestion: Add .clang-format file #332

Open asmaloney opened 1 year ago

asmaloney commented 1 year ago

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?

ggerganov commented 1 year ago

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

asmaloney commented 1 year ago

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.

ggerganov commented 1 year ago

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

asmaloney commented 1 year ago

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! 😄