lint: add incoherent_exclusive_limits rule#818
Conversation
🤖 Augment PR SummarySummary: This PR introduces a new linter rule, Changes:
Technical Notes: The rule is non-mutating (lint-only) and reports both keywords as implicated when it fires. 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
2 issues found across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
efb534c to
bffc321
Compare
jviotti
left a comment
There was a problem hiding this comment.
I think this one is a good one to have in the common folder for both the linter and canonicalizer (and testing on both), and having a transform that sets the current schema to false or just adds not: true or whatever to make the unsatisfiability obvious.
I believe we have some rules that do something like this for you to take inspiration from
bffc321 to
ed368af
Compare
Signed-off-by: AcE <kintan0108@gmail.com>
ed368af to
d8625e0
Compare
|
Updated as suggested. The rule is now in |
Summary
Adds a new lint rule
incoherent_exclusive_limitsthat fires whenexclusiveMinimumis greater than or equal toexclusiveMaximum, making the schema unsatisfiable.Applies to Draft 6, Draft 7, 2019-09, and 2020-12.
Test cases (per dialect)
exclusiveMinimum<exclusiveMaximumexclusiveMinimumpresentexclusiveMaximumpresentexclusiveMinimum==exclusiveMaximumexclusiveMinimum>exclusiveMaximumChanges
src/alterschema/linter/incoherent_exclusive_limits.h- new rulesrc/alterschema/alterschema.cc- rule registered for all four dialectssrc/alterschema/CMakeLists.txt- header addedtest/alterschema/alterschema_lint_draft6_test.cc- tests addedtest/alterschema/alterschema_lint_draft7_test.cc- tests addedtest/alterschema/alterschema_lint_2019_09_test.cc- tests addedtest/alterschema/alterschema_lint_2020_12_test.cc- tests addedPart of sourcemeta/core#1975.