lint: add oneof_min_branches rule#886
Open
AcEKaycgR wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
2 issues found across 8 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
🤖 Augment PR SummarySummary: Adds a new linter rule Changes:
Technical Notes: The rule reports against the 🤖 Was this summary useful? React with 👍 or 👎 |
7fba29e to
552c753
Compare
Signed-off-by: AcE <kintan0108@gmail.com>
552c753 to
f6faa01
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new lint rule
oneof_min_branchesthat fires whenoneOfis present with fewer than 2 branches. A single-branchoneOfis redundant and a zero-branchoneOfis unsatisfiable.Applies to Draft 4, 6, 7, 2019-09, and 2020-12.
Changes
src/alterschema/linter/oneof_min_branches.h- new rulesrc/alterschema/alterschema.cc- rule registered for all five dialectssrc/alterschema/CMakeLists.txt- header addedtest/alterschema/alterschema_lint_draft4_test.cc- tests 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.