From 20be3858965b42bba75d95f2e5cc8a9564e7f444 Mon Sep 17 00:00:00 2001 From: shaito <106555513+0xShaito@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:20:01 -0300 Subject: [PATCH] feat: use solhint features (#82) Co-authored-by: Gas One Cent <86567384+gas1cent@users.noreply.github.com> --- .solhint.json | 10 +++------- .solhint.tests.json | 25 ------------------------- package.json | 10 ++++------ script/.solhint.json | 7 +++++++ src/interfaces/.solhint.json | 11 +++++++++++ test/.solhint.json | 16 ++++++++++++++++ 6 files changed, 41 insertions(+), 38 deletions(-) delete mode 100644 .solhint.tests.json create mode 100644 script/.solhint.json create mode 100644 src/interfaces/.solhint.json create mode 100644 test/.solhint.json diff --git a/.solhint.json b/.solhint.json index 94f58b24..23782374 100644 --- a/.solhint.json +++ b/.solhint.json @@ -1,18 +1,14 @@ { "extends": "solhint:recommended", "rules": { - "compiler-version": ["off"], - "constructor-syntax": "warn", - "quotes": ["error", "single"], + "compiler-version": ["warn"], + "quotes": "off", "func-visibility": ["warn", { "ignoreConstructors": true }], - "not-rely-on-time": "off", "no-inline-assembly": "off", "no-empty-blocks": "off", "private-vars-leading-underscore": ["warn", { "strict": false }], "ordering": "warn", - "immutable-name-snakecase": "warn", "avoid-low-level-calls": "off", - "no-console": "off", - "max-line-length": ["warn", 120] + "named-parameters-mapping": "warn" } } diff --git a/.solhint.tests.json b/.solhint.tests.json deleted file mode 100644 index fb26b4ea..00000000 --- a/.solhint.tests.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "solhint:recommended", - "rules": { - "compiler-version": ["off"], - "constructor-syntax": "warn", - "quotes": ["error", "single"], - "func-visibility": ["warn", { "ignoreConstructors": true }], - "not-rely-on-time": "off", - "style-guide-casing": "off", - "var-name-mixedcase": "off", - "const-name-snakecase": "off", - "no-inline-assembly": "off", - "no-empty-blocks": "error", - "definition-name-capwords": "off", - "named-parameters-function": "off", - "no-global-import": "off", - "max-states-count": "off", - "private-vars-leading-underscore": ["warn", { "strict": false }], - "ordering": "off", - "immutable-name-snakecase": "warn", - "avoid-low-level-calls": "off", - "one-contract-per-file": "off", - "max-line-length": ["warn", 120] - } -} diff --git a/package.json b/package.json index 738c1d49..88242ec3 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,10 @@ "coverage": "forge coverage --report summary --report lcov --match-path 'test/unit/*'", "deploy:mainnet": "bash -c 'source .env && forge script Deploy --rpc-url $MAINNET_RPC --account $MAINNET_DEPLOYER_NAME --broadcast --verify --chain mainnet -vvvvv'", "deploy:sepolia": "bash -c 'source .env && forge script Deploy --rpc-url $SEPOLIA_RPC --account $SEPOLIA_DEPLOYER_NAME --broadcast --verify --chain sepolia -vvvvv'", - "lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check", - "lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix", + "lint:check": "yarn lint:sol && forge fmt --check", + "lint:fix": "sort-package-json && forge fmt && yarn lint:sol --fix", "lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js", - "lint:sol-logic": "solhint -c .solhint.json 'src/**/*.sol' 'script/**/*.sol'", - "lint:sol-tests": "solhint -c .solhint.tests.json 'test/**/*.sol'", + "lint:sol": "solhint 'src/**/*.sol' 'script/**/*.sol' 'test/**/*.sol'", "prepare": "husky", "test": "forge test -vvv", "test:fuzz": "echidna test/invariants/fuzz/Greeter.t.sol --contract InvariantGreeter --corpus-dir test/invariants/fuzz/echidna_coverage/ --test-mode assertion", @@ -30,8 +29,7 @@ }, "lint-staged": { "*.{js,css,md,ts,sol}": "forge fmt", - "(src|script)/**/*.sol": "yarn lint:sol-logic", - "test/**/*.sol": "yarn lint:sol-tests", + "(src|test|script)/**/*.sol": "yarn lint:sol", "package.json": "sort-package-json" }, "devDependencies": { diff --git a/script/.solhint.json b/script/.solhint.json new file mode 100644 index 00000000..740c6a42 --- /dev/null +++ b/script/.solhint.json @@ -0,0 +1,7 @@ +{ + "rules": { + "ordering": "off", + "one-contract-per-file": "off", + "no-console": "off" + } +} diff --git a/src/interfaces/.solhint.json b/src/interfaces/.solhint.json new file mode 100644 index 00000000..8bb790c1 --- /dev/null +++ b/src/interfaces/.solhint.json @@ -0,0 +1,11 @@ +{ + "rules": { + "ordering": "warn", + "style-guide-casing": [ + "warn", + { + "ignoreExternalFunctions": true + } + ] + } +} diff --git a/test/.solhint.json b/test/.solhint.json new file mode 100644 index 00000000..3ec7f113 --- /dev/null +++ b/test/.solhint.json @@ -0,0 +1,16 @@ +{ + "rules": { + "style-guide-casing": [ + "warn", + { + "ignorePublicFunctions":true, + "ignoreExternalFunctions":true, + "ignoreContracts":true + } + ], + "no-global-import": "off", + "max-states-count": "off", + "ordering": "off", + "one-contract-per-file": "off" + } +}