Skip to content

Commit

Permalink
Pin clippy_utils and dylint-linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jgcrosta committed Jul 22, 2024
1 parent 781f9cf commit 930651e
Show file tree
Hide file tree
Showing 71 changed files with 193 additions and 328 deletions.
13 changes: 5 additions & 8 deletions detectors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
10 changes: 3 additions & 7 deletions detectors/assert-violation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions detectors/assert-violation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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?
Expand Down Expand Up @@ -119,7 +119,7 @@ fn check_macro_call(cx: &EarlyContext, span: Span, mac: &P<MacCall>) {
.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,
Expand Down
9 changes: 3 additions & 6 deletions detectors/avoid-autokey-upgradable/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions detectors/avoid-autokey-upgradable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"",
Expand Down
10 changes: 3 additions & 7 deletions detectors/avoid-core-mem-forget/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions detectors/avoid-core-mem-forget/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 3 additions & 7 deletions detectors/avoid-format-string/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions detectors/avoid-format-string/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 3 additions & 6 deletions detectors/avoid-unsafe-block/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions detectors/avoid-unsafe-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 3 additions & 6 deletions detectors/buffering-unsized-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions detectors/buffering-unsized-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 3 additions & 7 deletions detectors/delegate-call/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions detectors/delegate-call/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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(),
Expand Down
9 changes: 3 additions & 6 deletions detectors/divide-before-multiply/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions detectors/divide-before-multiply/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
10 changes: 3 additions & 7 deletions detectors/dont-use-instantiate-contract-v1/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions detectors/dont-use-instantiate-contract-v1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 930651e

Please sign in to comment.