Skip to content

Commit

Permalink
chore: Integrate solhint with a few rules to enforce contract convent…
Browse files Browse the repository at this point in the history
…ion (ubiquity#851)

* chore: integrate solhint with a few rules

* chore: integrate solhint with a few rules

* chore: add command to the namespace to invoke solhint on top level repo

* chore: add command to the namespace to invoke solhint on top level repo

* chore: add few more rules, update readme
  • Loading branch information
molecula451 authored Dec 21, 2023
1 parent ae51df9 commit f6bd4c9
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
.next/
dist/_next/
!.solhint.json
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ yarn workspace @ubiquity/dapp start # Run the web application at http://localhos

4. We run [CI jobs](https://github.com/ubiquity/ubiquity-dollar/actions) all CI jobs must pass before commiting/merging a PR with no exceptions (usually a few exceptions while the PR it's getting reviewed and the maintainers highlight a job run that may skip)

5. We run Solhint to enforce a pre-set selected number of rules for code quality/style on Smart Contracts

### Network Settings
| Network | Chain ID | RPC Endpoint | Comment |
|---------|----------|-------------------------------|---------|
Expand Down
15 changes: 15 additions & 0 deletions packages/contracts/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "solhint:recommended",
"rules": {
"func-param-name-mixedcase": "error",
"func-visibility": ["warn", { "ignoreConstructors": true }],
"custom-errors": "off",
"no-inline-assembly": "off",
"reentrancy": "warn",
"foundry-test-functions": ["warn", ["setUp"]],
"event-name-camelcase": "warn",
"func-name-mixedcase": "warn",
"use-forbidden-name": "error",
"func-named-parameters": ["warn", 4]
}
}
4 changes: 3 additions & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"forge:install": "forge install",
"format": "prettier --plugin=prettier-plugin-solidity src/**/*.sol test/**/*.sol --write",
"docs": "FOUNDRY_PROFILE=docs forge doc --build",
"_hardhat-task": "tsx ./scripts/task/task.ts"
"_hardhat-task": "tsx ./scripts/task/task.ts",
"run:solhint": "npx solhint 'src/**/*.sol'"
},
"keywords": [
"stablecoin",
Expand Down Expand Up @@ -71,6 +72,7 @@
"glob": "^10.3.0",
"prettier": "^3.1.0",
"prettier-plugin-solidity": "^1.2.0",
"solhint": "^4.0.0",
"typescript": "^4.9.4"
}
}
Loading

0 comments on commit f6bd4c9

Please sign in to comment.