Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable clang-analyzer #2194

Merged
merged 3 commits into from
Oct 17, 2023
Merged

Enable clang-analyzer #2194

merged 3 commits into from
Oct 17, 2023

Conversation

Riolku
Copy link
Contributor

@Riolku Riolku commented Oct 12, 2023

This PR implements a new handwritten stringFormat function (maybe it should be called StringFormat::fmt?)

Using spdlog::fmt (which is really just fmtlib) is overkill. Our
codebase only uses {}, and so this commit implements exactly that
(along with the ability to escape values). Experimentally this gives us
a 15% compilation speedup.

It also moves string formatting to its own file, because of how often it
is included. Finally, this change is conducive to adding clang-analyzer
to clang-tidy, as spdlog has an unitialized object warning.

Finally, this PR enables clang-analyzer in clang-tidy.

@Riolku Riolku marked this pull request as ready for review October 12, 2023 15:50
@Riolku Riolku force-pushed the clang-tidy-analyzer branch 7 times, most recently from 8432501 to ee3bc67 Compare October 12, 2023 19:16
tools/benchmark/benchmark.cpp Show resolved Hide resolved
test/util_tests/string_format.cpp Show resolved Hide resolved
src/include/common/string_format.h Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Attention: 43 lines in your changes are missing coverage. Please review.

Comparison is base (fc71a74) 89.58% compared to head (9a4d2a6) 89.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2194      +/-   ##
==========================================
+ Coverage   89.58%   89.68%   +0.10%     
==========================================
  Files        1006     1008       +2     
  Lines       36313    35830     -483     
==========================================
- Hits        32530    32135     -395     
+ Misses       3783     3695      -88     
Files Coverage Δ
src/binder/bind/bind_copy.cpp 94.83% <100.00%> (ø)
src/binder/bind/bind_create_macro.cpp 100.00% <100.00%> (+10.00%) ⬆️
src/binder/bind/bind_ddl.cpp 98.48% <100.00%> (+1.03%) ⬆️
src/binder/bind/bind_file_scan.cpp 98.46% <100.00%> (+1.44%) ⬆️
src/binder/bind/bind_graph_pattern.cpp 96.19% <100.00%> (+1.47%) ⬆️
src/binder/bind/bind_reading_clause.cpp 95.61% <100.00%> (-0.04%) ⬇️
src/binder/bind/bind_updating_clause.cpp 95.48% <100.00%> (ø)
...inder/bind_expression/bind_property_expression.cpp 93.33% <100.00%> (ø)
src/binder/binder.cpp 97.70% <100.00%> (-0.04%) ⬇️
src/binder/expression_binder.cpp 97.50% <100.00%> (-0.07%) ⬇️
... and 62 more

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Riolku
Copy link
Contributor Author

Riolku commented Oct 12, 2023

The missing coverage is a good opportunity to make sure we hit all these errors. I suppose I will add tests for these tomorrow/monday.

@Riolku Riolku force-pushed the clang-tidy-analyzer branch 3 times, most recently from bf5e94b to 564a9ae Compare October 14, 2023 00:15
@Riolku Riolku marked this pull request as draft October 14, 2023 00:15
@Riolku Riolku force-pushed the clang-tidy-analyzer branch 6 times, most recently from 2ec9964 to 7e43e23 Compare October 17, 2023 19:42
Using spdlog::fmt (which is really just fmtlib) is overkill. Our
codebase only uses `{}`, and so this commit implements exactly that
(along with the ability to escape values). Experimentally this gives us
a 15% compilation speedup.

It also moves string formatting to its own file, because of how often it
is included. Finally, this change is conducive to adding clang-analyzer
to clang-tidy, as spdlog has an unitialized object warning.
This enables a myriad of complex checks.
@Riolku Riolku marked this pull request as ready for review October 17, 2023 19:48
Add a test for every error not covered, as reported by lcov for lines
changed after the stringFormat change.
@Riolku
Copy link
Contributor Author

Riolku commented Oct 17, 2023

The leftover missing coverage will be handled in followup PRs. It's all non-trivial changes.

@Riolku Riolku merged commit fd38139 into master Oct 17, 2023
11 of 12 checks passed
@Riolku Riolku deleted the clang-tidy-analyzer branch October 17, 2023 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants