Skip to content

Commit 6aeaf79

Browse files
committed
Enable bugprone-easily-swappable-parameters
This PR skips the check for existing usage, as fixing it can break the API. But this also makes sure that the new usage will be warned/signalled from now on. Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
1 parent 93c82c1 commit 6aeaf79

File tree

8 files changed

+15
-6
lines changed

8 files changed

+15
-6
lines changed

cmake/common/clang-tidy.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Checks": "-*, bugprone-*, -bugprone-easily-swappable-parameters,-bugprone-unchecked-optional-access, concurrency-*, modernize-*, performance-*, portability-*",
2+
"Checks": "-*, bugprone-*, -bugprone-unchecked-optional-access, concurrency-*, modernize-*, performance-*, portability-*",
33
"WarningsAsErrors": "*",
44
"FormatStyle": "none",
55
"UseColor": true

src/core/json/include/sourcemeta/core/json_error.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ namespace sourcemeta::core {
2525
class SOURCEMETA_CORE_JSON_EXPORT JSONParseError : public std::exception {
2626
public:
2727
/// Create a parsing error
28+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
2829
JSONParseError(const std::uint64_t line, const std::uint64_t column)
2930
: line_{line}, column_{column} {}
3031

3132
/// Create a parsing error with a custom error
33+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
3234
JSONParseError(const std::uint64_t line, const std::uint64_t column,
3335
std::string message)
3436
: line_{line}, column_{column}, message_{std::move(message)} {}

src/core/jsonpointer/include/sourcemeta/core/jsonpointer_pointer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ template <typename PropertyT, typename Hash> class GenericPointer {
536536
/// sourcemeta::core::Pointer{"qux", "baz"});
537537
/// ```
538538
[[nodiscard]] auto
539+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
539540
rebase(const GenericPointer<PropertyT, Hash> &prefix,
540541
const GenericPointer<PropertyT, Hash> &replacement) const
541542
-> GenericPointer<PropertyT, Hash> {

src/core/jsonschema/frame.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,13 @@ auto SchemaFrame::to_json() const -> JSON {
407407
return root;
408408
}
409409

410-
auto SchemaFrame::analyse(const JSON &root, const SchemaWalker &walker,
411-
const SchemaResolver &resolver,
412-
const std::optional<JSON::String> &default_dialect,
413-
const std::optional<JSON::String> &default_id,
414-
const SchemaFrame::Paths &paths) -> void {
410+
auto SchemaFrame::analyse(
411+
const JSON &root, const SchemaWalker &walker,
412+
const SchemaResolver &resolver,
413+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
414+
const std::optional<JSON::String> &default_dialect,
415+
const std::optional<JSON::String> &default_id,
416+
const SchemaFrame::Paths &paths) -> void {
415417
std::vector<InternalEntry> subschema_entries;
416418
std::map<Pointer, CacheSubschema> subschemas;
417419
std::map<sourcemeta::core::Pointer, std::vector<JSON::String>> base_uris;

src/core/jsonschema/jsonschema.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ static auto id_keyword(const std::string &base_dialect) -> std::string {
7070
auto sourcemeta::core::identify(
7171
const sourcemeta::core::JSON &schema, const SchemaResolver &resolver,
7272
const SchemaIdentificationStrategy strategy,
73+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
7374
const std::optional<std::string> &default_dialect,
7475
const std::optional<std::string> &default_id)
7576
-> std::optional<std::string> {

src/core/jsonschema/walker.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ auto walk(const std::optional<sourcemeta::core::Pointer> &parent,
1414
const sourcemeta::core::JSON &subschema,
1515
const sourcemeta::core::SchemaWalker &walker,
1616
const sourcemeta::core::SchemaResolver &resolver,
17+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
1718
const std::string &dialect, const std::string &base_dialect,
1819
const SchemaWalkerType_t type, const std::size_t level,
1920
const bool orphan) -> void {

src/core/regex/include/sourcemeta/core/regex.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ auto matches(const Regex<T> &regex, const T &value) -> bool {
217217
/// assert(sourcemeta::core::matches_if_valid("^foo", "foo bar"));
218218
/// ```
219219
template <typename T>
220+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
220221
auto matches_if_valid(const T &pattern, const T &value) -> bool {
221222
const auto regex{to_regex(pattern)};
222223
return regex.has_value() && matches(regex.value(), value);

src/core/uri/uri.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ auto URI::relative_to(const URI &base) -> URI & {
641641
return *this;
642642
}
643643

644+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
644645
auto URI::rebase(const URI &base, const URI &new_base) -> URI & {
645646
this->relative_to(base);
646647
if (!this->is_relative()) {

0 commit comments

Comments
 (0)