huynguyen-and-friend-projects / smoldb

Simple database in C(++)
1 stars 3 forks source link

New, more opinionated format and lint configs #24

Closed nguyenhuy0905 closed 2 months ago

nguyenhuy0905 commented 3 months ago

More strict lint options

I modified the .clang-format and .clang-tidy files. I remove the Google-specific lint options (eg, "google", "fuchsia"...) and kept the rest (so, that introduces a couple more lint options, "cppcoreguidelines" or "cert" or "misc").

For formatting, I made a very long list, instead of relying on a BasedOn like before.

I also created a "better" format and lint script than the default format-lint-all one. This one only formats and lints the staged files. It will require the following dependencies:

# installed from clang-tools-extra
clang-format
clang-tidy
# installed from cmakelang
cmake-format
cmake-lint

markdownlint
vale

Since it only check your staged files, this is a pretty good one to put onto your pre-commit Git hook.

A lot of this is redundant of course.

It's opinionated, but I believe being super specific would benefit more. A "bad" standard is better than none at all.

I run these two commands:

clang-format --dump-config > .clang-format
clang-tidy --dump-config > .clang-tidy

Then changed the tabsize to 4 (instead of the default 8)

This is a very opinionated PR. If you don't like these changes, do leave a comment and then you can reject the PR :+1:.

@qu-ngx @BAOELIETRAN @AbstractionHLR @bebeminhminh @aqt169


Pull request by: Huy Nguyen