Skip to content

style(clang-tidy): fix bugprone-unchecked-optional-access #1762

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

Merged
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
12 changes: 10 additions & 2 deletions src/core/jsonschema/frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ auto find_anchors(const sourcemeta::core::JSON &schema,
const sourcemeta::core::URI identifier(schema.at("$id").to_string());
if (identifier.is_fragment_only()) {
result.insert(
{sourcemeta::core::JSON::String{identifier.fragment().value()},
{sourcemeta::core::JSON::String{
identifier.fragment()
.value()}, // NOLINT(bugprone-unchecked-optional-access):
// Check for optional is happening
// inside is_fragment_only()
AnchorType::Static});
}
}
Expand All @@ -91,7 +95,11 @@ auto find_anchors(const sourcemeta::core::JSON &schema,
const sourcemeta::core::URI identifier(schema.at("id").to_string());
if (identifier.is_fragment_only()) {
result.insert(
{sourcemeta::core::JSON::String{identifier.fragment().value()},
{sourcemeta::core::JSON::String{
identifier.fragment()
.value()}, // NOLINT(bugprone-unchecked-optional-access):
// Check for optional is happening
// inside is_fragment_only()
AnchorType::Static});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/jsonschema/walker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ auto walk(const std::optional<sourcemeta::core::Pointer> &parent,
const auto current_base_dialect{
is_schema_resource
? sourcemeta::core::base_dialect(subschema, resolver, current_dialect)
.value()
.value_or(base_dialect)
: base_dialect};

const auto vocabularies{sourcemeta::core::vocabularies(
Expand Down