Skip to content

Commit

Permalink
Yarn + solhint (#122)
Browse files Browse the repository at this point in the history
protofire/solhint#554 has changed the solhint
behaviour wrt the exit code. This PR is trying to solve the problem.
  • Loading branch information
madlabman authored Apr 11, 2024
1 parent 77ad0e6 commit 7092542
Show file tree
Hide file tree
Showing 8 changed files with 2,509 additions and 1,124 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ broadcast/
cache/
out/
lcov.info

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
39 changes: 39 additions & 0 deletions .yarn/patches/solhint-npm-4.5.2-10dbd0e73b.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/solhint.js b/solhint.js
index 755a910c9c084d027520a73b7b989b9b7912a975..53d912394404ee6bc0a4f283da9ee145f1f73d76 100755
--- a/solhint.js
+++ b/solhint.js
@@ -160,8 +160,7 @@ function executeMainActionLogic() {

printReports(reports, formatterFn)

- // exitWithCode(reports)
- process.exit(0)
+ exitWithCode(reports)
}

function processStdin(options) {
@@ -182,8 +181,7 @@ function processStdin(options) {
const reports = [report]

printReports(reports, formatterFn)
- process.exit(0)
- // exitWithCode(reports)
+ exitWithCode(reports)
}

function writeSampleConfigFile() {
@@ -363,10 +361,10 @@ function listRules() {
}
}

-// function exitWithCode(reports) {
-// const errorsCount = reports.reduce((acc, i) => acc + i.errorCount, 0)
-// process.exit(errorsCount > 0 ? 1 : 0)
-// }
+function exitWithCode(reports) {
+ const errorsCount = reports.reduce((acc, i) => acc + i.errorCount, 0)
+ process.exit(errorsCount > 0 ? 1 : 0)
+}

function checkForUpdate() {
// eslint-disable-next-line import/no-extraneous-dependencies
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.1.cjs
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"prettier-plugin-solidity": "^1.1.3",
"solhint": "^4.5.2",
"solhint": "patch:solhint@npm%3A4.5.2#~/.yarn/patches/solhint-npm-4.5.2-10dbd0e73b.patch",
"solhint-plugin-lido-csm": "https://github.com/lidofinance/solhint-plugin-lido-csm.git#0.3.2"
},
"lint-staged": {
"*": "prettier --ignore-unknown --write",
"src/**/*.sol": "solhint"
},
"packageManager": "yarn@4.1.1",
"resolutions": {
"solhint@npm:4.5.2": "patch:solhint@npm%3A4.5.2#~/.yarn/patches/solhint-npm-4.5.2-10dbd0e73b.patch"
}
}
10 changes: 5 additions & 5 deletions src/CSAccounting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,6 @@ contract CSAccounting is
AssetRecovererLib.recoverStETHShares(address(LIDO), shares);
}

modifier onlyRecoverer() override {
_checkRole(RECOVERER_ROLE);
_;
}

function _getActiveKeys(
uint256 nodeOperatorId
) internal view returns (uint256) {
Expand Down Expand Up @@ -660,4 +655,9 @@ contract CSAccounting is
}
_;
}

modifier onlyRecoverer() override {
_checkRole(RECOVERER_ROLE);
_;
}
}
10 changes: 5 additions & 5 deletions src/CSModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1675,11 +1675,6 @@ contract CSModule is
);
}

modifier onlyRecoverer() override {
_checkRole(RECOVERER_ROLE);
_;
}

function _incrementModuleNonce() internal {
_nonce++;
}
Expand Down Expand Up @@ -1725,4 +1720,9 @@ contract CSModule is
revert NodeOperatorDoesNotExist();
_;
}

modifier onlyRecoverer() override {
_checkRole(RECOVERER_ROLE);
_;
}
}
Loading

0 comments on commit 7092542

Please sign in to comment.