-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move-compiler] Added support for linter warning suppression (#13012)
## Description This implements the ability to add suppression of external warnings, particularly warnings coming from Sui linters. ## Test Plan Must pass all existing tests plus updated linter tests. --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [x] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes Developers can now selectively suppress linter warnings. Linter warnings now also feature an additional message describing how they can be suppressed.
- Loading branch information
Showing
16 changed files
with
575 additions
and
169 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,46 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use move_compiler::{ | ||
diagnostics::codes::{DiagnosticsID, WarningFilter}, | ||
expansion::ast as E, | ||
}; | ||
|
||
pub mod self_transfer; | ||
pub mod share_owned; | ||
|
||
pub const SHARE_OWNED_DIAG_CATEGORY: u8 = 1; | ||
pub const SHARE_OWNED_DIAG_CODE: u8 = 1; | ||
pub const SELF_TRANSFER_DIAG_CATEGORY: u8 = 2; | ||
pub const SELF_TRANSFER_DIAG_CODE: u8 = 1; | ||
|
||
pub const ALLOW_ATTR_NAME: &str = "lint_allow"; | ||
pub const LINT_WARNING_PREFIX: &str = "Lint "; | ||
|
||
pub const SHARE_OWNED_FILTER_NAME: &str = "share_owned"; | ||
pub const SELF_TRANSFER_FILTER_NAME: &str = "self_transfer"; | ||
|
||
pub fn known_filters() -> (E::AttributeName_, Vec<WarningFilter>) { | ||
( | ||
E::AttributeName_::Unknown(ALLOW_ATTR_NAME.into()), | ||
vec![ | ||
WarningFilter::All(Some(LINT_WARNING_PREFIX)), | ||
WarningFilter::Code( | ||
DiagnosticsID::new( | ||
SHARE_OWNED_DIAG_CATEGORY, | ||
SHARE_OWNED_DIAG_CODE, | ||
Some(LINT_WARNING_PREFIX), | ||
), | ||
Some(SHARE_OWNED_FILTER_NAME), | ||
), | ||
WarningFilter::Code( | ||
DiagnosticsID::new( | ||
SELF_TRANSFER_DIAG_CATEGORY, | ||
SELF_TRANSFER_DIAG_CODE, | ||
Some(LINT_WARNING_PREFIX), | ||
), | ||
Some(SELF_TRANSFER_FILTER_NAME), | ||
), | ||
], | ||
) | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
e017e8e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 Validators 500/s Owned Transactions Benchmark Results
4 Validators 500/s Shared Transactions Benchmark Results
20 Validators 50/s Owned Transactions Benchmark Results
20 Validators 50/s Shared Transactions Benchmark Results
Narwhal Benchmark Results
e017e8e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 Validators 500/s Owned Transactions Benchmark Results
4 Validators 500/s Shared Transactions Benchmark Results
20 Validators 50/s Owned Transactions Benchmark Results
20 Validators 50/s Shared Transactions Benchmark Results
Narwhal Benchmark Results