diff --git a/detectors/Cargo.toml b/detectors/Cargo.toml index ee0eb109..cbf5695c 100644 --- a/detectors/Cargo.toml +++ b/detectors/Cargo.toml @@ -1,12 +1,9 @@ [workspace] -members = ["*"] exclude = [".cargo", "target"] +members = ["*"] [workspace.dependencies] -dylint_testing = "3.0.0" -if_chain = "1.0.2" - -scout-audit-clippy-utils = { version = "=0.2.3" } -scout-audit-internal = { version = "=0.2.3", features = ["detector", "lint_helper"] } -dylint_linting = { package = "scout-audit-dylint-linting", version = "3.0.1" } -itertools = { version = "0.12" } +clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "99c7838" } +if_chain = "=1.0.2" +itertools = { version = "=0.13" } +scout-audit-dylint-linting = { git = "https://github.com/CoinFabrik/scout-audit", rev = "e03ede4" } diff --git a/detectors/assert-violation/Cargo.toml b/detectors/assert-violation/Cargo.toml index 328750d6..3edee9c3 100644 --- a/detectors/assert-violation/Cargo.toml +++ b/detectors/assert-violation/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "assert-violation" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/assert-violation/src/lib.rs b/detectors/assert-violation/src/lib.rs index 2a593d72..ef9d4ec2 100644 --- a/detectors/assert-violation/src/lib.rs +++ b/detectors/assert-violation/src/lib.rs @@ -3,6 +3,7 @@ extern crate rustc_ast; extern crate rustc_span; +use clippy_utils::sym; use if_chain::if_chain; use rustc_ast::{ ptr::P, @@ -11,10 +12,9 @@ use rustc_ast::{ }; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::{sym, Span}; -use scout_audit_clippy_utils::sym; const LINT_MESSAGE: &str = "Assert causes panic. Instead, return a proper error."; -dylint_linting::impl_pre_expansion_lint! { +scout_audit_dylint_linting::impl_pre_expansion_lint! { /// ### What it does /// Checks for `assert!` usage. /// ### Why is this bad? @@ -119,7 +119,7 @@ fn check_macro_call(cx: &EarlyContext, span: Span, mac: &P) { .iter() .any(|sym| &mac.path == sym) { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, ASSERT_VIOLATION, span, diff --git a/detectors/avoid-autokey-upgradable/Cargo.toml b/detectors/avoid-autokey-upgradable/Cargo.toml index a80771f6..41fa395c 100644 --- a/detectors/avoid-autokey-upgradable/Cargo.toml +++ b/detectors/avoid-autokey-upgradable/Cargo.toml @@ -1,19 +1,16 @@ [package] +edition = "2021" name = "avoid-autokey-upgradable" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } itertools = { workspace = true } - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/avoid-autokey-upgradable/src/lib.rs b/detectors/avoid-autokey-upgradable/src/lib.rs index 8cb2b313..16f9cb20 100644 --- a/detectors/avoid-autokey-upgradable/src/lib.rs +++ b/detectors/avoid-autokey-upgradable/src/lib.rs @@ -14,9 +14,9 @@ use rustc_hir::{ }; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::Span; -use scout_audit_clippy_utils::diagnostics::span_lint_and_note; +use clippy_utils::diagnostics::span_lint_and_note; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub AVOID_AUTOKEY_UPGRADABLE, Warn, "", diff --git a/detectors/avoid-core-mem-forget/Cargo.toml b/detectors/avoid-core-mem-forget/Cargo.toml index 5c472b72..7f84709c 100644 --- a/detectors/avoid-core-mem-forget/Cargo.toml +++ b/detectors/avoid-core-mem-forget/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "avoid-core-mem-forget" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/avoid-core-mem-forget/src/lib.rs b/detectors/avoid-core-mem-forget/src/lib.rs index bbfa31a1..db9b2bab 100644 --- a/detectors/avoid-core-mem-forget/src/lib.rs +++ b/detectors/avoid-core-mem-forget/src/lib.rs @@ -11,7 +11,7 @@ use rustc_span::sym; const LINT_MESSAGE: &str = "Using `core::mem::forget` is not recommended."; -dylint_linting::impl_pre_expansion_lint! { +scout_audit_dylint_linting::impl_pre_expansion_lint! { /// ### What it does /// Checks for `core::mem::forget` usage. /// ### Why is this bad? @@ -79,7 +79,7 @@ impl EarlyLintPass for AvoidStdCoreMemForget { if path.segments[1].ident.name.to_string() == "mem"; if path.segments[2].ident.name.to_string() == "forget"; then { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, AVOID_STD_CORE_MEM_FORGET, expr.span, diff --git a/detectors/avoid-format-string/Cargo.toml b/detectors/avoid-format-string/Cargo.toml index 3f8ab03b..bdfd1517 100644 --- a/detectors/avoid-format-string/Cargo.toml +++ b/detectors/avoid-format-string/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "avoid-format-string" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/avoid-format-string/src/lib.rs b/detectors/avoid-format-string/src/lib.rs index 39220a4f..a5046611 100644 --- a/detectors/avoid-format-string/src/lib.rs +++ b/detectors/avoid-format-string/src/lib.rs @@ -11,11 +11,11 @@ use rustc_ast::{ }; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::{sym, Span}; -use scout_audit_clippy_utils::sym; +use clippy_utils::sym; const LINT_MESSAGE: &str = "The format! macro should not be used."; -dylint_linting::impl_pre_expansion_lint! { +scout_audit_dylint_linting::impl_pre_expansion_lint! { /// ### What it does /// Detects the usage of `format!` macro. /// @@ -93,7 +93,7 @@ impl EarlyLintPass for AvoidFormatString { if mac.path == sym!(format); then { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, AVOID_FORMAT_STRING, expr.span, diff --git a/detectors/avoid-unsafe-block/Cargo.toml b/detectors/avoid-unsafe-block/Cargo.toml index 328acf85..2e021a91 100644 --- a/detectors/avoid-unsafe-block/Cargo.toml +++ b/detectors/avoid-unsafe-block/Cargo.toml @@ -1,18 +1,15 @@ [package] +edition = "2021" name = "avoid-unsafe-block" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/avoid-unsafe-block/src/lib.rs b/detectors/avoid-unsafe-block/src/lib.rs index 55f782e5..44b0dfbd 100644 --- a/detectors/avoid-unsafe-block/src/lib.rs +++ b/detectors/avoid-unsafe-block/src/lib.rs @@ -5,10 +5,10 @@ extern crate rustc_span; use rustc_ast::{BlockCheckMode, Expr, ExprKind, UnsafeSource}; use rustc_lint::{EarlyContext, EarlyLintPass}; -use scout_audit_clippy_utils::diagnostics::span_lint; +use clippy_utils::diagnostics::span_lint; const LINT_MESSAGE: &str = "Avoid using unsafe blocks as it may lead to undefined behavior."; -dylint_linting::impl_pre_expansion_lint! { +scout_audit_dylint_linting::impl_pre_expansion_lint! { pub AVOID_UNSAFE_BLOCK, Warn, LINT_MESSAGE, diff --git a/detectors/buffering-unsized-types/Cargo.toml b/detectors/buffering-unsized-types/Cargo.toml index cb7386f2..5652d4d0 100644 --- a/detectors/buffering-unsized-types/Cargo.toml +++ b/detectors/buffering-unsized-types/Cargo.toml @@ -1,18 +1,15 @@ [package] +edition = "2021" name = "buffering-unsized-types" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/buffering-unsized-types/src/lib.rs b/detectors/buffering-unsized-types/src/lib.rs index 2fe73bda..49de5ba0 100644 --- a/detectors/buffering-unsized-types/src/lib.rs +++ b/detectors/buffering-unsized-types/src/lib.rs @@ -12,9 +12,9 @@ use rustc_hir::{ use rustc_lint::{LateContext, LateLintPass}; use rustc_span::symbol::Ident; use rustc_span::Span; -use scout_audit_clippy_utils::diagnostics::span_lint_and_help; +use clippy_utils::diagnostics::span_lint_and_help; const LINT_MESSAGE: &str = "Do not use these method with an unsized (dynamically sized) type."; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub BUFFERING_UNSIZED_TYPES, Warn, LINT_MESSAGE, diff --git a/detectors/delegate-call/Cargo.toml b/detectors/delegate-call/Cargo.toml index 8f9106be..357a138b 100644 --- a/detectors/delegate-call/Cargo.toml +++ b/detectors/delegate-call/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "delegate-call" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/delegate-call/src/lib.rs b/detectors/delegate-call/src/lib.rs index 3255f959..316fade2 100644 --- a/detectors/delegate-call/src/lib.rs +++ b/detectors/delegate-call/src/lib.rs @@ -16,7 +16,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "Passing arguments to the target of a delegate call is not safe, as it allows the caller to set a malicious hash as the target."; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// Checks for delegated calls to contracts passed as arguments. /// ### Why is this bad? @@ -149,7 +149,7 @@ impl<'tcx> LateLintPass<'tcx> for DelegateCall { walk_expr(&mut delegate_storage, body.value); if delegate_storage.has_vulnerable_delegate { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, DELEGATE_CALL, delegate_storage.span.unwrap(), diff --git a/detectors/divide-before-multiply/Cargo.toml b/detectors/divide-before-multiply/Cargo.toml index e72dd6f9..2399f3f7 100644 --- a/detectors/divide-before-multiply/Cargo.toml +++ b/detectors/divide-before-multiply/Cargo.toml @@ -1,19 +1,16 @@ [package] +edition = "2021" name = "divide-before-multiply" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -dylint_linting = { workspace = true } if_chain = { workspace = true } +scout-audit-dylint-linting = { workspace = true } -scout-audit-clippy-utils = { workspace = true } - -[dev-dependencies] -dylint_testing = { workspace = true } +clippy_utils = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/divide-before-multiply/src/lib.rs b/detectors/divide-before-multiply/src/lib.rs index 0f65338c..c8612e6d 100644 --- a/detectors/divide-before-multiply/src/lib.rs +++ b/detectors/divide-before-multiply/src/lib.rs @@ -24,7 +24,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "Division before multiplication might result in a loss of precision"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// Checks the existence of a division before a multiplication. /// @@ -365,7 +365,7 @@ impl<'tcx> LateLintPass<'tcx> for DivideBeforeMultiply { ); for span in spans { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, DIVIDE_BEFORE_MULTIPLY, span, @@ -382,7 +382,7 @@ impl<'tcx> LateLintPass<'tcx> for DivideBeforeMultiply { if BinOpKind::Mul == op.node; then{ for division in get_divisions_inside_expr(expr) { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, DIVIDE_BEFORE_MULTIPLY, division, diff --git a/detectors/dont-use-instantiate-contract-v1/Cargo.toml b/detectors/dont-use-instantiate-contract-v1/Cargo.toml index 726cc015..e0b1249e 100644 --- a/detectors/dont-use-instantiate-contract-v1/Cargo.toml +++ b/detectors/dont-use-instantiate-contract-v1/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "dont-use-instantiate-contract-v1" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/dont-use-instantiate-contract-v1/src/lib.rs b/detectors/dont-use-instantiate-contract-v1/src/lib.rs index ac6bd3c6..b4c63791 100644 --- a/detectors/dont-use-instantiate-contract-v1/src/lib.rs +++ b/detectors/dont-use-instantiate-contract-v1/src/lib.rs @@ -14,7 +14,7 @@ use rustc_span::{Span, Symbol}; const LINT_MESSAGE: &str = "This is a low level way to instantiate another smart contract, calling the legacy `instantiate_v1` host function."; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { pub DONT_USE_INSTANTIATE_CONTRACT_V1, Warn, LINT_MESSAGE, @@ -60,7 +60,7 @@ impl<'tcx> LateLintPass<'tcx> for DontUseInstantiateContractV1 { visitor.has_instantiate_contract_v1_span.iter().for_each(|span| { if let Some(span) = span { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, DONT_USE_INSTANTIATE_CONTRACT_V1, *span, diff --git a/detectors/dont-use-invoke-contract-v1/Cargo.toml b/detectors/dont-use-invoke-contract-v1/Cargo.toml index cdbf4327..1ad1169d 100644 --- a/detectors/dont-use-invoke-contract-v1/Cargo.toml +++ b/detectors/dont-use-invoke-contract-v1/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "dont-use-invoke-contract-v1" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/dont-use-invoke-contract-v1/src/lib.rs b/detectors/dont-use-invoke-contract-v1/src/lib.rs index 3de1c52b..9c9e9a4b 100644 --- a/detectors/dont-use-invoke-contract-v1/src/lib.rs +++ b/detectors/dont-use-invoke-contract-v1/src/lib.rs @@ -14,7 +14,7 @@ use rustc_span::{Span, Symbol}; const LINT_MESSAGE: &str = "This is a low level way to evaluate another smart contract. Avoid using it. But if needed, use `invoke_contract`."; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { pub DONT_USE_INVOKE_CONTRACT_V1, Warn, LINT_MESSAGE, @@ -60,7 +60,7 @@ impl<'tcx> LateLintPass<'tcx> for DontUseInvokeContractV1 { visitor.has_invoke_contract_v1_span.iter().for_each(|span| { if let Some(span) = span { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, DONT_USE_INVOKE_CONTRACT_V1, *span, diff --git a/detectors/dos-unbounded-operation/Cargo.toml b/detectors/dos-unbounded-operation/Cargo.toml index 00033499..0160af31 100644 --- a/detectors/dos-unbounded-operation/Cargo.toml +++ b/detectors/dos-unbounded-operation/Cargo.toml @@ -1,19 +1,16 @@ [package] +edition = "2021" name = "dos-unbounded-operation" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -dylint_linting = { workspace = true } if_chain = { workspace = true } +scout-audit-dylint-linting = { workspace = true } -scout-audit-clippy-utils = { workspace = true } - -[dev-dependencies] -dylint_testing = { workspace = true } +clippy_utils = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/dos-unbounded-operation/src/lib.rs b/detectors/dos-unbounded-operation/src/lib.rs index 3dd30892..be2d68e9 100644 --- a/detectors/dos-unbounded-operation/src/lib.rs +++ b/detectors/dos-unbounded-operation/src/lib.rs @@ -15,7 +15,7 @@ use rustc_span::{def_id::LocalDefId, Span}; const LINT_MESSAGE: &str = "In order to prevent a single transaction from consuming all the gas in a block, unbounded operations must be avoided"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// This detector checks that when using for or while loops, their conditions limit the execution to a constant number of iterations. /// ### Why is this bad? @@ -97,7 +97,7 @@ impl<'tcx> LateLintPass<'tcx> for DosUnboundedOperation { walk_expr(&mut visitor, body.value); for span in visitor.span_constant { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, DOS_UNBOUNDED_OPERATION, span, diff --git a/detectors/dos-unexpected-revert-with-vector/Cargo.toml b/detectors/dos-unexpected-revert-with-vector/Cargo.toml index 5b4f2b20..99c5f130 100644 --- a/detectors/dos-unexpected-revert-with-vector/Cargo.toml +++ b/detectors/dos-unexpected-revert-with-vector/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "dos-unexpected-revert-with-vector" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/dos-unexpected-revert-with-vector/src/lib.rs b/detectors/dos-unexpected-revert-with-vector/src/lib.rs index dcb2f965..f0f91c57 100644 --- a/detectors/dos-unexpected-revert-with-vector/src/lib.rs +++ b/detectors/dos-unexpected-revert-with-vector/src/lib.rs @@ -23,7 +23,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "This vector operation is called without access control"; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { /// ### What it does /// Checks for array pushes without access control. /// ### Why is this bad? @@ -216,7 +216,7 @@ impl<'tcx> LateLintPass<'tcx> for UnexpectedRevertWarn { &mut HashSet::::default(), ); for place in unchecked_places { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNEXPECTED_REVERT_WARN, place.1, diff --git a/detectors/incorrect-exponentiation/Cargo.toml b/detectors/incorrect-exponentiation/Cargo.toml index 6cca6039..1384f247 100644 --- a/detectors/incorrect-exponentiation/Cargo.toml +++ b/detectors/incorrect-exponentiation/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "incorrect-exponentiation" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/incorrect-exponentiation/src/lib.rs b/detectors/incorrect-exponentiation/src/lib.rs index dbd2c5ae..fa6bb233 100644 --- a/detectors/incorrect-exponentiation/src/lib.rs +++ b/detectors/incorrect-exponentiation/src/lib.rs @@ -11,12 +11,12 @@ use rustc_hir::{Body, FnDecl}; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::Span; -use scout_audit_clippy_utils::diagnostics::span_lint_and_help; +use clippy_utils::diagnostics::span_lint_and_help; const LINT_MESSAGE: &str = "'^' It is not an exponential operator. It is a bitwise XOR."; const LINT_HELP: &str = "If you want to use XOR, use bitxor(). If you want to raise a number use .checked_pow() or .pow() "; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { pub INCORRECT_EXPONENTIATION, Warn, LINT_MESSAGE, diff --git a/detectors/ink-version/Cargo.toml b/detectors/ink-version/Cargo.toml index 1f5d8ccb..cb49516d 100644 --- a/detectors/ink-version/Cargo.toml +++ b/detectors/ink-version/Cargo.toml @@ -1,23 +1,19 @@ [package] +edition = "2021" name = "ink-version" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } +scout-audit-dylint-linting = { workspace = true } semver = "1.0.4" serde_json = "1.0" toml = "0.7.6" ureq = { version = "2.7.1", features = ["json"] } - -[dev-dependencies] -dylint_testing = { workspace = true } - [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/ink-version/src/lib.rs b/detectors/ink-version/src/lib.rs index ba5b1ced..7832276c 100644 --- a/detectors/ink-version/src/lib.rs +++ b/detectors/ink-version/src/lib.rs @@ -11,7 +11,7 @@ use semver::*; const LINT_MESSAGE: &str = "Use the latest version of ink!"; -dylint_linting::declare_early_lint! { +scout_audit_dylint_linting::declare_early_lint! { /// ### What it does /// Checks the ink! version of the contract /// ### Why is this bad? @@ -53,7 +53,7 @@ impl EarlyLintPass for CheckInkVersion { let ink_version = VersionReq::parse(&ink_version.replace('\"', "")).unwrap(); if !ink_version.matches(&req) { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, CHECK_INK_VERSION, rustc_span::DUMMY_SP, diff --git a/detectors/insufficiently-random-values/Cargo.toml b/detectors/insufficiently-random-values/Cargo.toml index fa2576a0..c799db84 100644 --- a/detectors/insufficiently-random-values/Cargo.toml +++ b/detectors/insufficiently-random-values/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "insufficiently-random-values" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/insufficiently-random-values/src/lib.rs b/detectors/insufficiently-random-values/src/lib.rs index fa9ad554..b54134c7 100644 --- a/detectors/insufficiently-random-values/src/lib.rs +++ b/detectors/insufficiently-random-values/src/lib.rs @@ -8,7 +8,7 @@ use rustc_lint::{LateContext, LateLintPass}; const LINT_MESSAGE: &str = "In order to prevent randomness manipulations by validators block_timestamp should not be used as random number source"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// This detector prevents the usage of timestamp/block number and modulo operator as a random number source. /// @@ -41,7 +41,7 @@ impl<'tcx> LateLintPass<'tcx> for InsufficientlyRandomValues { if path.ident.as_str() == "block_timestamp" || path.ident.as_str() == "block_number"; then { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, INSUFFICIENTLY_RANDOM_VALUES, expr.span, diff --git a/detectors/integer-overflow-or-underflow/Cargo.toml b/detectors/integer-overflow-or-underflow/Cargo.toml index e37aa7d2..d7a0d3e7 100644 --- a/detectors/integer-overflow-or-underflow/Cargo.toml +++ b/detectors/integer-overflow-or-underflow/Cargo.toml @@ -1,18 +1,15 @@ [package] +edition = "2021" name = "integer-overflow-or-underflow" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/integer-overflow-or-underflow/src/lib.rs b/detectors/integer-overflow-or-underflow/src/lib.rs index cee13881..f67464b0 100644 --- a/detectors/integer-overflow-or-underflow/src/lib.rs +++ b/detectors/integer-overflow-or-underflow/src/lib.rs @@ -7,12 +7,12 @@ use rustc_hir::{self as hir, Body, Expr, ExprKind, UnOp}; use rustc_lint::LateContext; use rustc_lint::LateLintPass; use rustc_span::Span; -use scout_audit_clippy_utils::consts::constant_simple; -use scout_audit_clippy_utils::is_integer_literal; +use clippy_utils::consts::constant_simple; +use clippy_utils::is_integer_literal; pub const LINT_MESSAGE: &str = "Potential for integer arithmetic overflow/underflow. Consider checked, wrapping or saturating arithmetic."; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { /// ### What it does /// Checks for integer arithmetic operations which could overflow or panic. /// @@ -138,7 +138,7 @@ impl ArithmeticContext { hir::ExprKind::Lit(_lit) => (), hir::ExprKind::Unary(hir::UnOp::Neg, expr) => { if is_integer_literal(expr, 1) { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, INTEGER_OVERFLOW_UNDERFLOW, expr.span, @@ -150,7 +150,7 @@ impl ArithmeticContext { } } _ => { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, INTEGER_OVERFLOW_UNDERFLOW, expr.span, @@ -162,7 +162,7 @@ impl ArithmeticContext { } }, _ => { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, INTEGER_OVERFLOW_UNDERFLOW, expr.span, @@ -187,7 +187,7 @@ impl ArithmeticContext { } let ty = cx.typeck_results().expr_ty(arg); if constant_simple(cx, cx.typeck_results(), expr).is_none() && ty.is_integral() { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, INTEGER_OVERFLOW_UNDERFLOW, expr.span, diff --git a/detectors/iterators-over-indexing/Cargo.toml b/detectors/iterators-over-indexing/Cargo.toml index 2726a266..eb48acde 100644 --- a/detectors/iterators-over-indexing/Cargo.toml +++ b/detectors/iterators-over-indexing/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "iterators-over-indexing" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/iterators-over-indexing/src/lib.rs b/detectors/iterators-over-indexing/src/lib.rs index db88abbb..dfa149aa 100644 --- a/detectors/iterators-over-indexing/src/lib.rs +++ b/detectors/iterators-over-indexing/src/lib.rs @@ -17,7 +17,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "Hardcoding an index could lead to panic if the top bound is out of bounds."; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { pub ITERATOR_OVER_INDEXING, Warn, LINT_MESSAGE, @@ -118,7 +118,7 @@ impl<'tcx> LateLintPass<'tcx> for IteratorOverIndexing { walk_expr(&mut visitor, body.value); for span in visitor.span_constant { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, ITERATOR_OVER_INDEXING, span, diff --git a/detectors/lazy-delegate/Cargo.toml b/detectors/lazy-delegate/Cargo.toml index a008144e..f2f8b492 100644 --- a/detectors/lazy-delegate/Cargo.toml +++ b/detectors/lazy-delegate/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "lazy-delegate" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/lazy-delegate/src/lib.rs b/detectors/lazy-delegate/src/lib.rs index 30613d67..aac447b0 100644 --- a/detectors/lazy-delegate/src/lib.rs +++ b/detectors/lazy-delegate/src/lib.rs @@ -15,7 +15,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "Delegate call with non-lazy, non-mapping storage"; -dylint_linting::impl_pre_expansion_lint! { +scout_audit_dylint_linting::impl_pre_expansion_lint! { /// ### What it does /// Checks for non-lazy storage when using delegate calls. /// ### Why is this bad? @@ -86,7 +86,7 @@ impl EarlyLintPass for LazyDelegate { } if !self.delegate_uses.is_empty() && !self.non_lazy_manual_storage_spans.is_empty() { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, LAZY_DELEGATE, id.span, @@ -96,7 +96,7 @@ impl EarlyLintPass for LazyDelegate { ); for span in &self.non_lazy_manual_storage_spans { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, LAZY_DELEGATE, *span, diff --git a/detectors/lazy-values-not-set/Cargo.toml b/detectors/lazy-values-not-set/Cargo.toml index ca415813..96ea1117 100644 --- a/detectors/lazy-values-not-set/Cargo.toml +++ b/detectors/lazy-values-not-set/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "lazy-values-not-set" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] -rustc_private = true \ No newline at end of file +rustc_private = true diff --git a/detectors/lazy-values-not-set/src/lib.rs b/detectors/lazy-values-not-set/src/lib.rs index 50eb5d63..b56a3fbd 100644 --- a/detectors/lazy-values-not-set/src/lib.rs +++ b/detectors/lazy-values-not-set/src/lib.rs @@ -17,11 +17,11 @@ use rustc_middle::mir::{Local, Operand, Rvalue, TerminatorKind}; use rustc_middle::ty::TyKind; use rustc_span::def_id::LocalDefId; use rustc_span::Span; -use scout_audit_clippy_utils::match_def_path; +use clippy_utils::match_def_path; const LINT_MESSAGE: &str = "Lazy value was gotten here but never set afterwards"; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub LAZY_VALUES_NOT_SET, Warn, LINT_MESSAGE, @@ -120,7 +120,7 @@ impl<'tcx> LateLintPass<'tcx> for LazyValuesNotSet { let (_, hm) = self.get_func_info(cx, id.to_def_id(), &[], &[], &mut vec![]); for val in hm.values() { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, LAZY_VALUES_NOT_SET, *val, diff --git a/detectors/non-payable-transferred-value/Cargo.toml b/detectors/non-payable-transferred-value/Cargo.toml index 0bf5e39d..b0876377 100644 --- a/detectors/non-payable-transferred-value/Cargo.toml +++ b/detectors/non-payable-transferred-value/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "non-payable-transferred-value" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/non-payable-transferred-value/src/lib.rs b/detectors/non-payable-transferred-value/src/lib.rs index 8461c05f..f2d9042e 100644 --- a/detectors/non-payable-transferred-value/src/lib.rs +++ b/detectors/non-payable-transferred-value/src/lib.rs @@ -10,12 +10,12 @@ use rustc_ast::{ }; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::Span; -use scout_audit_clippy_utils::diagnostics::span_lint_and_help; +use clippy_utils::diagnostics::span_lint_and_help; const LINT_MESSAGE: &str = "Using `transferred_value` without #[ink(payable)] will always return 0."; -dylint_linting::impl_pre_expansion_lint! { +scout_audit_dylint_linting::impl_pre_expansion_lint! { pub NON_PAYABLE_TRANSFERRED_VALUE, Warn, LINT_MESSAGE, diff --git a/detectors/panic-error/Cargo.toml b/detectors/panic-error/Cargo.toml index 3d5b3fbd..8cc7d518 100644 --- a/detectors/panic-error/Cargo.toml +++ b/detectors/panic-error/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "panic-error" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/panic-error/src/lib.rs b/detectors/panic-error/src/lib.rs index 49bd2b3d..aaceae4e 100644 --- a/detectors/panic-error/src/lib.rs +++ b/detectors/panic-error/src/lib.rs @@ -13,11 +13,11 @@ use rustc_ast::{ }; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::{sym, Span}; -use scout_audit_clippy_utils::sym; +use clippy_utils::sym; const LINT_MESSAGE: &str = "The panic! macro is used to stop execution when a condition is not met. This is useful for testing and prototyping, but should be avoided in production code"; -dylint_linting::impl_pre_expansion_lint! { +scout_audit_dylint_linting::impl_pre_expansion_lint! { /// ### What it does /// The panic! macro is used to stop execution when a condition is not met. /// This is useful for testing and prototyping, but should be avoided in production code @@ -111,7 +111,7 @@ fn check_macro_call(cx: &EarlyContext, span: Span, mac: &P) { if let TokenKind::Literal(lit) = token.kind; if lit.kind == LitKind::Str; then { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, PANIC_ERROR, span, diff --git a/detectors/reentrancy-1/Cargo.toml b/detectors/reentrancy-1/Cargo.toml index d85d7faf..9ef9f984 100644 --- a/detectors/reentrancy-1/Cargo.toml +++ b/detectors/reentrancy-1/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "reentrancy-1" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/reentrancy-1/src/lib.rs b/detectors/reentrancy-1/src/lib.rs index 7ab3a5f1..84095b6c 100644 --- a/detectors/reentrancy-1/src/lib.rs +++ b/detectors/reentrancy-1/src/lib.rs @@ -17,7 +17,7 @@ use rustc_span::Span; const LINT_MESSAGE:&str = "External calls could open the opportunity for a malicious contract to execute any arbitrary code"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// This linting rule checks whether the 'check-effect' interaction pattern has been properly followed by code that invokes a contract that may call back the original one. /// ### Why is this bad? @@ -240,7 +240,7 @@ impl<'tcx> LateLintPass<'tcx> for Reentrancy1 { && reentrant_storage.allow_reentrancy_flag && reentrant_storage.state_change { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, REENTRANCY_1, reentrant_storage.span.unwrap(), diff --git a/detectors/reentrancy-2/Cargo.toml b/detectors/reentrancy-2/Cargo.toml index d967eb04..a71829c9 100644 --- a/detectors/reentrancy-2/Cargo.toml +++ b/detectors/reentrancy-2/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "reentrancy-2" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/reentrancy-2/src/lib.rs b/detectors/reentrancy-2/src/lib.rs index c0d817f0..7d1084c4 100644 --- a/detectors/reentrancy-2/src/lib.rs +++ b/detectors/reentrancy-2/src/lib.rs @@ -25,7 +25,7 @@ use rustc_target::abi::VariantIdx; const LINT_MESSAGE:&str = "External calls could open the opportunity for a malicious contract to execute any arbitrary code"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// This linting rule checks whether the 'check-effect' interaction pattern has been properly followed by code that invokes a contract that may call back the original one. /// ### Why is this bad? @@ -280,7 +280,7 @@ impl<'tcx> LateLintPass<'tcx> for Reentrancy2 { // Iterate over all potential reentrancy spans and emit a warning for each. if reentrancy_visitor.has_insert_operation { reentrancy_visitor.reentrancy_spans.into_iter().for_each(|span| { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, REENTRANCY_2, span, diff --git a/detectors/set-code-hash/Cargo.toml b/detectors/set-code-hash/Cargo.toml index d8aacf07..1cc29498 100644 --- a/detectors/set-code-hash/Cargo.toml +++ b/detectors/set-code-hash/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "set-code-hash" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/set-code-hash/src/lib.rs b/detectors/set-code-hash/src/lib.rs index 7dcb7cca..84832861 100644 --- a/detectors/set-code-hash/src/lib.rs +++ b/detectors/set-code-hash/src/lib.rs @@ -23,7 +23,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "This set_code_hash is called without access control"; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub UNPROTECTED_SET_CODE_HASH, Warn, LINT_MESSAGE, @@ -173,7 +173,7 @@ impl<'tcx> LateLintPass<'tcx> for UnprotectedSetCodeHash { if caller_and_terminate.callers.is_empty() { for terminate in caller_and_terminate.terminates { if let TerminatorKind::Call { fn_span, .. } = terminate.0.terminator().kind { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNPROTECTED_SET_CODE_HASH, fn_span, @@ -190,7 +190,7 @@ impl<'tcx> LateLintPass<'tcx> for UnprotectedSetCodeHash { &mut vec![], ); for place in unchecked_places { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNPROTECTED_SET_CODE_HASH, place.1, diff --git a/detectors/set-contract-storage/Cargo.toml b/detectors/set-contract-storage/Cargo.toml index a796b4ab..cc277990 100644 --- a/detectors/set-contract-storage/Cargo.toml +++ b/detectors/set-contract-storage/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "set-contract-storage" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/set-contract-storage/src/lib.rs b/detectors/set-contract-storage/src/lib.rs index aba0ad40..efdd2883 100644 --- a/detectors/set-contract-storage/src/lib.rs +++ b/detectors/set-contract-storage/src/lib.rs @@ -16,7 +16,7 @@ use rustc_span::Span; const LINT_MESSAGE:&str = "Abitrary users should not have control over keys because it implies writing any value of left mapping, lazy variable, or the main struct of the contract located in position 0 of the storage"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// Checks for calls to env::set_contract_storage. /// @@ -144,7 +144,7 @@ impl<'tcx> LateLintPass<'tcx> for SetStorageWarn { walk_expr(&mut reentrant_storage, body.value); if reentrant_storage.has_set_contract && reentrant_storage.unprotected { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, SET_STORAGE_WARN, reentrant_storage.span.unwrap(), diff --git a/detectors/unprotected-mapping-operation/Cargo.toml b/detectors/unprotected-mapping-operation/Cargo.toml index 54762674..bb62163c 100644 --- a/detectors/unprotected-mapping-operation/Cargo.toml +++ b/detectors/unprotected-mapping-operation/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "unprotected-mapping-operation" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/unprotected-mapping-operation/src/lib.rs b/detectors/unprotected-mapping-operation/src/lib.rs index a42cf0a7..d007eb2d 100644 --- a/detectors/unprotected-mapping-operation/src/lib.rs +++ b/detectors/unprotected-mapping-operation/src/lib.rs @@ -24,7 +24,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "This mapping operation is called without access control on a different key than the caller's address"; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub UNPROTECTED_MAPPING_OPERATION, Warn, LINT_MESSAGE, @@ -172,7 +172,7 @@ impl<'tcx> LateLintPass<'tcx> for UnprotectedMappingOperation { &mut HashSet::::default(), ); for place in unchecked_places { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNPROTECTED_MAPPING_OPERATION, place.1, diff --git a/detectors/unprotected-self-destruct/Cargo.toml b/detectors/unprotected-self-destruct/Cargo.toml index d552028c..39806873 100644 --- a/detectors/unprotected-self-destruct/Cargo.toml +++ b/detectors/unprotected-self-destruct/Cargo.toml @@ -1,20 +1,15 @@ [package] +edition = "2021" name = "unprotected-self-destruct" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } - +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/unprotected-self-destruct/src/lib.rs b/detectors/unprotected-self-destruct/src/lib.rs index 237bfb8a..1df3c8a8 100644 --- a/detectors/unprotected-self-destruct/src/lib.rs +++ b/detectors/unprotected-self-destruct/src/lib.rs @@ -21,7 +21,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "This terminate_contract is called without access control"; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub UNPROTECTED_SELF_DESTRUCT, Warn, LINT_MESSAGE, @@ -145,7 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for UnprotectedSelfDestruct { if caller_and_terminate.callers.is_empty() { for terminate in caller_and_terminate.terminates { if let TerminatorKind::Call { fn_span, .. } = terminate.0.terminator().kind { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNPROTECTED_SELF_DESTRUCT, fn_span, @@ -162,7 +162,7 @@ impl<'tcx> LateLintPass<'tcx> for UnprotectedSelfDestruct { &mut vec![], ); for place in unchecked_places { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNPROTECTED_SELF_DESTRUCT, place.1, diff --git a/detectors/unrestricted-transfer-from/Cargo.toml b/detectors/unrestricted-transfer-from/Cargo.toml index 6e477d68..7476dd62 100644 --- a/detectors/unrestricted-transfer-from/Cargo.toml +++ b/detectors/unrestricted-transfer-from/Cargo.toml @@ -1,20 +1,15 @@ [package] +edition = "2021" name = "unrestricted-transfer-from" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } - +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/unrestricted-transfer-from/src/lib.rs b/detectors/unrestricted-transfer-from/src/lib.rs index cb657e4e..f8d053fb 100644 --- a/detectors/unrestricted-transfer-from/src/lib.rs +++ b/detectors/unrestricted-transfer-from/src/lib.rs @@ -20,7 +20,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "This argument comes from a user-supplied argument"; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub UNRESTRICTED_TRANSFER_FROM, Warn, LINT_MESSAGE, @@ -180,7 +180,7 @@ impl<'tcx> LateLintPass<'tcx> for UnrestrictedTransferFrom { walk_expr(&mut utf_storage, body.value); if utf_storage.from_ref { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNRESTRICTED_TRANSFER_FROM, utf_storage.span.unwrap(), @@ -271,7 +271,7 @@ impl<'tcx> LateLintPass<'tcx> for UnrestrictedTransferFrom { if arg.place().map_or(false, |place| { tainted_locals.iter().any(|l| l == &place.local) }) { - scout_audit_clippy_utils::diagnostics::span_lint( + clippy_utils::diagnostics::span_lint( cx, UNRESTRICTED_TRANSFER_FROM, *fn_span, diff --git a/detectors/unsafe-expect/Cargo.toml b/detectors/unsafe-expect/Cargo.toml index 02c44b9f..683526e0 100644 --- a/detectors/unsafe-expect/Cargo.toml +++ b/detectors/unsafe-expect/Cargo.toml @@ -1,20 +1,15 @@ [package] +edition = "2021" name = "unsafe-expect" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } - +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/unsafe-expect/src/lib.rs b/detectors/unsafe-expect/src/lib.rs index 3a2d1f98..cfec6969 100644 --- a/detectors/unsafe-expect/src/lib.rs +++ b/detectors/unsafe-expect/src/lib.rs @@ -15,12 +15,12 @@ use rustc_hir::{ }; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::{sym, Span, Symbol}; -use scout_audit_clippy_utils::{diagnostics::span_lint_and_help, higher}; +use clippy_utils::{diagnostics::span_lint_and_help, higher}; const LINT_MESSAGE: &str = "Unsafe usage of `expect`"; const PANIC_INDUCING_FUNCTIONS: [&str; 2] = ["panic", "bail"]; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// Checks for usage of `expect` /// diff --git a/detectors/unsafe-unwrap/Cargo.toml b/detectors/unsafe-unwrap/Cargo.toml index 66ba9941..f7bd7927 100644 --- a/detectors/unsafe-unwrap/Cargo.toml +++ b/detectors/unsafe-unwrap/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "unsafe-unwrap" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/unsafe-unwrap/src/lib.rs b/detectors/unsafe-unwrap/src/lib.rs index 6f7180c1..b07c7fb8 100644 --- a/detectors/unsafe-unwrap/src/lib.rs +++ b/detectors/unsafe-unwrap/src/lib.rs @@ -15,12 +15,12 @@ use rustc_hir::{ }; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::{sym, Span, Symbol}; -use scout_audit_clippy_utils::{diagnostics::span_lint_and_help, higher}; +use clippy_utils::{diagnostics::span_lint_and_help, higher}; const LINT_MESSAGE: &str = "Unsafe usage of `unwrap`"; const PANIC_INDUCING_FUNCTIONS: [&str; 2] = ["panic", "bail"]; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// Checks for usage of `unwrap` /// diff --git a/detectors/unused-return-enum/Cargo.toml b/detectors/unused-return-enum/Cargo.toml index 9c52072d..2a537d55 100644 --- a/detectors/unused-return-enum/Cargo.toml +++ b/detectors/unused-return-enum/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "unused-return-enum" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/unused-return-enum/src/lib.rs b/detectors/unused-return-enum/src/lib.rs index e798f549..6d4f7388 100644 --- a/detectors/unused-return-enum/src/lib.rs +++ b/detectors/unused-return-enum/src/lib.rs @@ -13,7 +13,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "Unused return enum"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// It warns if a fuction that returns a Result type does not return a Result enum variant (Ok/Err) /// @@ -197,7 +197,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedReturnEnum { && (visitor.count_err == 0 || visitor.count_ok == 0) { visitor.span.iter().for_each(|span| { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, UNUSED_RETURN_ENUM, *span, diff --git a/detectors/vec-could-be-mapping/Cargo.toml b/detectors/vec-could-be-mapping/Cargo.toml index 355dbc9a..967d0c95 100644 --- a/detectors/vec-could-be-mapping/Cargo.toml +++ b/detectors/vec-could-be-mapping/Cargo.toml @@ -1,19 +1,16 @@ [package] +edition = "2021" name = "vec-could-be-mapping" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } -itertools = {workspace = true} - -[dev-dependencies] -dylint_testing = { workspace = true } +itertools = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/vec-could-be-mapping/src/lib.rs b/detectors/vec-could-be-mapping/src/lib.rs index c999af19..79e54f55 100644 --- a/detectors/vec-could-be-mapping/src/lib.rs +++ b/detectors/vec-could-be-mapping/src/lib.rs @@ -15,14 +15,14 @@ use rustc_hir::{Ty, TyKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::def_id::LocalDefId; use rustc_span::Span; -use scout_audit_clippy_utils::diagnostics::span_lint_and_help; +use clippy_utils::diagnostics::span_lint_and_help; const LINT_MESSAGE: &str = "You are iterating over a vector of tuples using `find`. Consider using a mapping instead."; const ITERABLE_METHODS: [&str; 1] = ["find"]; -dylint_linting::impl_late_lint! { +scout_audit_dylint_linting::impl_late_lint! { pub VEC_COULD_BE_MAPPING, Warn, LINT_MESSAGE, diff --git a/detectors/warning-sr25519-verify/Cargo.toml b/detectors/warning-sr25519-verify/Cargo.toml index ac327066..0a2a8c30 100644 --- a/detectors/warning-sr25519-verify/Cargo.toml +++ b/detectors/warning-sr25519-verify/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "warning-sr25519-verify" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/warning-sr25519-verify/src/lib.rs b/detectors/warning-sr25519-verify/src/lib.rs index f724a714..d6302f00 100644 --- a/detectors/warning-sr25519-verify/src/lib.rs +++ b/detectors/warning-sr25519-verify/src/lib.rs @@ -10,11 +10,11 @@ use rustc_hir::{ }; use rustc_lint::LateLintPass; use rustc_span::Span; -use scout_audit_clippy_utils::diagnostics::span_lint_and_help; +use clippy_utils::diagnostics::span_lint_and_help; const LINT_MESSAGE: &str = "This function is from the unstable interface, which is unsafe and normally is not available on production chains."; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { pub WARNING_SR25519_VERIFY, Warn, LINT_MESSAGE, diff --git a/detectors/zero-or-test-address/Cargo.toml b/detectors/zero-or-test-address/Cargo.toml index 7ad75c4b..06dcd95a 100644 --- a/detectors/zero-or-test-address/Cargo.toml +++ b/detectors/zero-or-test-address/Cargo.toml @@ -1,19 +1,15 @@ [package] +edition = "2021" name = "zero-or-test-address" version = "0.1.0" -edition = "2021" [lib] crate-type = ["cdylib"] [dependencies] -scout-audit-clippy-utils = { workspace = true } -dylint_linting = { workspace = true } +clippy_utils = { workspace = true } if_chain = { workspace = true } - - -[dev-dependencies] -dylint_testing = { workspace = true } +scout-audit-dylint-linting = { workspace = true } [package.metadata.rust-analyzer] rustc_private = true diff --git a/detectors/zero-or-test-address/src/lib.rs b/detectors/zero-or-test-address/src/lib.rs index 9ff694ee..6b3c32b0 100644 --- a/detectors/zero-or-test-address/src/lib.rs +++ b/detectors/zero-or-test-address/src/lib.rs @@ -22,7 +22,7 @@ use rustc_span::Span; const LINT_MESSAGE: &str = "Not checking for a zero-address could lead to a locked contract"; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// /// Checks if function parameters of type `AccountId` are being compared with a zero address. @@ -189,7 +189,7 @@ impl<'tcx> LateLintPass<'tcx> for ZeroOrTestAddress { for param in zerocheck_storage.acc_id_params { if !zerocheck_storage.checked_params.contains(¶m.hir_id) { - scout_audit_clippy_utils::diagnostics::span_lint_and_help( + clippy_utils::diagnostics::span_lint_and_help( cx, ZERO_OR_TEST_ADDRESS, param.span, diff --git a/templates/detector/early-lint/src/lib.rs b/templates/detector/early-lint/src/lib.rs index 042f58b5..b5dd8f0f 100644 --- a/templates/detector/early-lint/src/lib.rs +++ b/templates/detector/early-lint/src/lib.rs @@ -9,7 +9,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::Span; use scout_audit_clippy_utils::diagnostics::span_lint_and_help; -dylint_linting::declare_early_lint! { +scout_audit_dylint_linting::declare_early_lint! { /// ### What it does /// Describe what the lint does. /// diff --git a/templates/detector/late-lint/src/lib.rs b/templates/detector/late-lint/src/lib.rs index 76c6f0cc..fc5c16a4 100644 --- a/templates/detector/late-lint/src/lib.rs +++ b/templates/detector/late-lint/src/lib.rs @@ -9,7 +9,7 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_span::Span; use scout_audit_clippy_utils::diagnostics::span_lint_and_help; -dylint_linting::declare_late_lint! { +scout_audit_dylint_linting::declare_late_lint! { /// ### What it does /// Describe what the lint does. ///