From cab3887b8461b6d4eb8ef874b65cf8e838ea40ac Mon Sep 17 00:00:00 2001 From: shaito Date: Wed, 4 Sep 2024 17:24:09 -0300 Subject: [PATCH] feat: use solhint features --- .solhint.json | 11 +++-------- .solhint.tests.json | 25 ------------------------- package.json | 10 ++++------ script/.solhint.json | 7 +++++++ src/interfaces/.solhint.json | 11 +++++++++++ test/.solhint.json | 9 +++++++++ 6 files changed, 34 insertions(+), 39 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..076f7c77 100644 --- a/.solhint.json +++ b/.solhint.json @@ -1,18 +1,13 @@ { "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] + "avoid-low-level-calls": "off" } } 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 b92bb27c..f18b9582 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 -vvvvv --rpc-url $MAINNET_RPC --broadcast --chain mainnet --private-key $MAINNET_DEPLOYER_PK'", "deploy:sepolia": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $SEPOLIA_RPC --broadcast --chain sepolia --private-key $SEPOLIA_DEPLOYER_PK'", - "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 install", "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..acb99bd0 --- /dev/null +++ b/src/interfaces/.solhint.json @@ -0,0 +1,11 @@ +{ + "rules": { + "ordering": "off", + "style-guide-casing": [ + "warn", + { + "ignoreExternalFunctions": true + } + ] + } +} diff --git a/test/.solhint.json b/test/.solhint.json new file mode 100644 index 00000000..9b61fd59 --- /dev/null +++ b/test/.solhint.json @@ -0,0 +1,9 @@ +{ + "rules": { + "style-guide-casing": "off", + "no-global-import": "off", + "max-states-count": "off", + "ordering": "off", + "one-contract-per-file": "off" + } +}