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

maint: Correctly exclude json files in clang-format #3749

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
hooks:
- id: clang-format
args: [--style=file]
exclude: ".json"
Copy link
Contributor Author

@mathbunnyru mathbunnyru Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is regex match, that's why libmamba/include/mamba/util/json.hpp matched as well.
It's easier to use exclude_types here

exclude_types: [json]
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
Expand Down
2 changes: 2 additions & 0 deletions libmamba/include/mamba/util/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <nlohmann/json.hpp>

NLOHMANN_JSON_NAMESPACE_BEGIN

template <typename T>
struct adl_serializer<std::optional<T>>
{
Expand Down Expand Up @@ -38,6 +39,7 @@ struct adl_serializer<std::optional<T>>
}
}
};

NLOHMANN_JSON_NAMESPACE_END

namespace mamba::util
Expand Down
Loading