-
-
Notifications
You must be signed in to change notification settings - Fork 5
style(clang-tidy): Clean include headers of src/core/jsonschema #1650
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
base: main
Are you sure you want to change the base?
style(clang-tidy): Clean include headers of src/core/jsonschema #1650
Conversation
These changes are getting bigger when I consider one folder at a time |
@jviotti PTAL |
Reported by clang-tidy check misc-include-cleaner Refs: sourcemeta/blaze#429 Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
Co-authored-by: Juan Cruz Viotti <jv@jviotti.com> Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
94df2c3
to
c5b3460
Compare
Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
Ref: https://github.com/sourcemeta/core/pull/1650/files#r2104799191 "Essentially, for a header X.h, then don't clean its X_<private>.h includes" Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
@jviotti addressed it. PTAL |
@jviotti Consider a public header like What do you think about making |
In our case of clang-tidy, even though the public header |
The idea of these private headers was to make things a little bit more maintainable. Otherwise these modules often expose a lot of stuff, and the single header file would get huge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests look off. The tests should not be including jsonschema_error
if they already include jsonschema
, as that one includes the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned earlier, clang-tidy expects the includes to be direct not transitive
@@ -1,6 +1,8 @@ | |||
#include <gtest/gtest.h> | |||
|
|||
#include <sourcemeta/core/jsonschema.h> | |||
#include <sourcemeta/core/jsonschema_error.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one looks off too?
#include <sourcemeta/core/jsonschema.h> | ||
#include <sourcemeta/core/jsonschema_walker.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ones too, as jsonschema.h
already includes jsonschema_walker.h
Hmm, well that will be tricky then. This whole part of ClangTidy looks complicated. Let me do some more digging. Maybe we should start with other warnings first? |
Or maybe we can turn of
|
See: #1650 (comment) Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
See #1685. I think that is enough for now. Maybe worth trying to re-create that PR given the ClangTidy warnings with that new config? I'll think more about a better solution long term. Maybe C++ modules fixes all of this. |
See: #1650 (comment) Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Yes, we can try that too. |
Yeah, C++ modules definitely makes life easier. I thought of adding an issue or TODO to use modules in the future. But I'm wondering, How do we know that the time is right? |
Ref: sourcemeta#1650 (comment) Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
Ref: sourcemeta#1650 (comment) Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
I think we'll know once most popular C++ libraries out there support it. So far I haven't seen even a single one. I think it will be a couple of years at least |
Ref: #1650 (comment) Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
Reported by clang-tidy check misc-include-cleaner
Refs: sourcemeta/blaze#429