From a6dd6a23eb82ce202e568d639fb0d9e390f64316 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Tue, 17 Oct 2023 03:13:33 +0200 Subject: [PATCH] fix(ci): linting errors from updated ws --- contracts/.prettierrc.yml | 13 +++++++++- contracts/.solhint.json | 4 ++- contracts/package.json | 5 ++-- contracts/test/foundry/AllowlistMinter.t.sol | 7 ------ contracts/test/foundry/Bitshifting.t.sol | 2 -- .../HypercertMinter.batchminting.t.sol | 6 ++--- .../foundry/HypercertMinter.pausable.t.sol | 1 - .../foundry/HypercertMinter.transfers.t.sol | 1 - .../test/foundry/PerformanceTesting.t.sol | 7 +++--- .../foundry/SemiFungible1155.allowances.t.sol | 2 -- .../foundry/SemiFungible1155.burning.t.sol | 1 - .../foundry/SemiFungible1155.minting.t.sol | 1 - contracts/test/foundry/SemiFungible1155.t.sol | 1 - .../foundry/SemiFungible1155.transfers.t.sol | 1 - .../test/foundry/SemiFungible1155.units.sol | 1 - pnpm-lock.yaml | 25 +++++++++++++++++-- 16 files changed, 47 insertions(+), 31 deletions(-) diff --git a/contracts/.prettierrc.yml b/contracts/.prettierrc.yml index 5d6c1590..0f125e7c 100644 --- a/contracts/.prettierrc.yml +++ b/contracts/.prettierrc.yml @@ -7,10 +7,21 @@ tabWidth: 2 trailingComma: "all" useTabs: false +plugins: + - prettier-plugin-solidity + overrides: + - files: "**/*.t.sol" + rules: + max-state-count": "off" + state-visibility": "off" + max-line-length": "off" + options: + tabWidth: 4 - files: "*.sol" + rules: + compiler-version: "0.8.16" options: - compiler: "0.8.16" tabWidth: 4 - files: "*.ts" options: diff --git a/contracts/.solhint.json b/contracts/.solhint.json index 47f2ca08..48849103 100644 --- a/contracts/.solhint.json +++ b/contracts/.solhint.json @@ -1,4 +1,5 @@ { + "plugins": ["prettier"], "extends": "solhint:recommended", "rules": { "code-complexity": ["error", 8], @@ -7,6 +8,7 @@ "max-line-length": ["error", 120], "no-console": "off", "not-rely-on-time": "off", - "reason-string": ["warn", { "maxLength": 64 }] + "reason-string": ["warn", { "maxLength": 64 }], + "one-contract-per-file": "off" } } diff --git a/contracts/package.json b/contracts/package.json index 481badaf..045e4139 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -61,7 +61,7 @@ "hardhat-preprocessor": "^0.1.5", "husky": "^8.0.1", "lint-staged": "^13.0.3", - "prettier": "^2.7.1", + "prettier": "^2.8.8", "prettier-plugin-solidity": "^1.1.3", "rimraf": "^5.0.5", "rollup": "^4.0.2", @@ -70,7 +70,8 @@ "rollup-plugin-esbuild": "^6.1.0", "rollup-plugin-node-polyfills": "^0.2.1", "shx": "^0.3.4", - "solhint": "^3.3.7", + "solhint": "^3.6.2", + "solhint-plugin-prettier": "^0.0.5", "solidity-coverage": "^0.8.2", "ts-node": "^10.9.1", "typechain": "^8.3.1", diff --git a/contracts/test/foundry/AllowlistMinter.t.sol b/contracts/test/foundry/AllowlistMinter.t.sol index 569ea593..7ccb3aa9 100644 --- a/contracts/test/foundry/AllowlistMinter.t.sol +++ b/contracts/test/foundry/AllowlistMinter.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; @@ -75,9 +74,6 @@ contract AllowlistTest is PRBTest, StdCheats, StdUtils { units[2] = 600; bytes32[] memory data = merkle.generateCustomData(accounts, units); - for (uint256 i = 0; i < data.length; i++) { - console2.logBytes32(data[i]); - } bytes32 root = merkle.getRoot(data); @@ -102,9 +98,6 @@ contract AllowlistTest is PRBTest, StdCheats, StdUtils { units[2] = 600; bytes32[] memory data = merkle.generateCustomData(accounts, units); - for (uint256 i = 0; i < data.length; i++) { - console2.logBytes32(data[i]); - } bytes32 root = merkle.getRoot(data); diff --git a/contracts/test/foundry/Bitshifting.t.sol b/contracts/test/foundry/Bitshifting.t.sol index e7ffb46a..68bc2cc8 100644 --- a/contracts/test/foundry/Bitshifting.t.sol +++ b/contracts/test/foundry/Bitshifting.t.sol @@ -1,11 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; -import { SemiFungible1155Helper } from "./SemiFungibleHelper.sol"; contract Bitshifter { /// @dev Bitmask used to expose only upper 128 bits of uint256 diff --git a/contracts/test/foundry/HypercertMinter.batchminting.t.sol b/contracts/test/foundry/HypercertMinter.batchminting.t.sol index fd745335..b5349919 100644 --- a/contracts/test/foundry/HypercertMinter.batchminting.t.sol +++ b/contracts/test/foundry/HypercertMinter.batchminting.t.sol @@ -1,14 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; import { HypercertMinter } from "../../src/HypercertMinter.sol"; -import { - ERC1155HolderUpgradeable -} from "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/utils/ERC1155HolderUpgradeable.sol"; +//solhint-disable-next-line max-line-length +import { ERC1155HolderUpgradeable } from "openzeppelin-contracts-upgradeable/contracts/token/ERC1155/utils/ERC1155HolderUpgradeable.sol"; import { Merkle } from "murky/Merkle.sol"; import { IHypercertToken } from "../../src/interfaces/IHypercertToken.sol"; diff --git a/contracts/test/foundry/HypercertMinter.pausable.t.sol b/contracts/test/foundry/HypercertMinter.pausable.t.sol index fc156398..716c8c5f 100644 --- a/contracts/test/foundry/HypercertMinter.pausable.t.sol +++ b/contracts/test/foundry/HypercertMinter.pausable.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; diff --git a/contracts/test/foundry/HypercertMinter.transfers.t.sol b/contracts/test/foundry/HypercertMinter.transfers.t.sol index 0b27131a..7c74edb1 100644 --- a/contracts/test/foundry/HypercertMinter.transfers.t.sol +++ b/contracts/test/foundry/HypercertMinter.transfers.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; diff --git a/contracts/test/foundry/PerformanceTesting.t.sol b/contracts/test/foundry/PerformanceTesting.t.sol index 1f021248..7ed5b2df 100644 --- a/contracts/test/foundry/PerformanceTesting.t.sol +++ b/contracts/test/foundry/PerformanceTesting.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; @@ -46,7 +45,9 @@ contract PerformanceTestHelper is Merkle { return 0; } sum = 0; - for (uint256 i = 0; i < array.length; i++) sum += array[i]; + for (uint256 i = 0; i < array.length; i++) { + sum += array[i]; + } } function buildFractions(uint256 size) public pure returns (uint256[] memory) { @@ -66,8 +67,8 @@ contract PerformanceTestHelper is Merkle { function isContract(address _addr) internal view returns (bool) { uint32 size; + // solhint-disable-next-line no-inline-assembly assembly { - // solhint-disable-next-line no-inline-assembly size := extcodesize(_addr) } return (size > 0); diff --git a/contracts/test/foundry/SemiFungible1155.allowances.t.sol b/contracts/test/foundry/SemiFungible1155.allowances.t.sol index 53048061..438b1893 100644 --- a/contracts/test/foundry/SemiFungible1155.allowances.t.sol +++ b/contracts/test/foundry/SemiFungible1155.allowances.t.sol @@ -1,9 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; -import { stdError } from "forge-std/StdError.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; import { SemiFungible1155Helper } from "./SemiFungibleHelper.sol"; diff --git a/contracts/test/foundry/SemiFungible1155.burning.t.sol b/contracts/test/foundry/SemiFungible1155.burning.t.sol index 5f212dcd..e816d35f 100644 --- a/contracts/test/foundry/SemiFungible1155.burning.t.sol +++ b/contracts/test/foundry/SemiFungible1155.burning.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; diff --git a/contracts/test/foundry/SemiFungible1155.minting.t.sol b/contracts/test/foundry/SemiFungible1155.minting.t.sol index aa289f2a..ae7f78d6 100644 --- a/contracts/test/foundry/SemiFungible1155.minting.t.sol +++ b/contracts/test/foundry/SemiFungible1155.minting.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { stdError } from "forge-std/StdError.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; diff --git a/contracts/test/foundry/SemiFungible1155.t.sol b/contracts/test/foundry/SemiFungible1155.t.sol index 8b974114..09918e69 100644 --- a/contracts/test/foundry/SemiFungible1155.t.sol +++ b/contracts/test/foundry/SemiFungible1155.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; diff --git a/contracts/test/foundry/SemiFungible1155.transfers.t.sol b/contracts/test/foundry/SemiFungible1155.transfers.t.sol index 821ea745..5a910740 100644 --- a/contracts/test/foundry/SemiFungible1155.transfers.t.sol +++ b/contracts/test/foundry/SemiFungible1155.transfers.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; diff --git a/contracts/test/foundry/SemiFungible1155.units.sol b/contracts/test/foundry/SemiFungible1155.units.sol index 1061234d..654c1dbb 100644 --- a/contracts/test/foundry/SemiFungible1155.units.sol +++ b/contracts/test/foundry/SemiFungible1155.units.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import { console2 } from "forge-std/console2.sol"; import { PRBTest } from "prb-test/PRBTest.sol"; import { StdCheats } from "forge-std/StdCheats.sol"; import { StdUtils } from "forge-std/StdUtils.sol"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ccecbb69..39adbe22 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -151,7 +151,7 @@ importers: specifier: ^13.0.3 version: 13.3.0 prettier: - specifier: ^2.7.1 + specifier: ^2.8.8 version: 2.8.8 prettier-plugin-solidity: specifier: ^1.1.3 @@ -178,8 +178,11 @@ importers: specifier: ^0.3.4 version: 0.3.4 solhint: - specifier: ^3.3.7 + specifier: ^3.6.2 version: 3.6.2(typescript@4.9.5) + solhint-plugin-prettier: + specifier: ^0.0.5 + version: 0.0.5(prettier-plugin-solidity@1.1.3)(prettier@2.8.8) solidity-coverage: specifier: ^0.8.2 version: 0.8.5(hardhat@2.13.1) @@ -27499,6 +27502,13 @@ packages: resolution: {integrity: sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==} engines: {node: '>=4'} + /prettier-linter-helpers@1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + dependencies: + fast-diff: 1.3.0 + dev: true + /prettier-plugin-solidity@1.1.3(prettier@2.8.8): resolution: {integrity: sha512-fQ9yucPi2sBbA2U2Xjh6m4isUTJ7S7QLc/XDDsktqqxYfTwdYKJ0EnnywXHwCGAaYbQNK+HIYPL1OemxuMsgeg==} engines: {node: '>=12'} @@ -29848,6 +29858,17 @@ packages: - debug dev: true + /solhint-plugin-prettier@0.0.5(prettier-plugin-solidity@1.1.3)(prettier@2.8.8): + resolution: {integrity: sha512-7jmWcnVshIrO2FFinIvDQmhQpfpS2rRRn3RejiYgnjIE68xO2bvrYvjqVNfrio4xH9ghOqn83tKuTzLjEbmGIA==} + peerDependencies: + prettier: ^1.15.0 || ^2.0.0 + prettier-plugin-solidity: ^1.0.0-alpha.14 + dependencies: + prettier: 2.8.8 + prettier-linter-helpers: 1.0.0 + prettier-plugin-solidity: 1.1.3(prettier@2.8.8) + dev: true + /solhint@3.6.2(typescript@4.9.5): resolution: {integrity: sha512-85EeLbmkcPwD+3JR7aEMKsVC9YrRSxd4qkXuMzrlf7+z2Eqdfm1wHWq1ffTuo5aDhoZxp2I9yF3QkxZOxOL7aQ==} hasBin: true