Skip to content

Commit

Permalink
style: fix the linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gas1cent committed Jan 11, 2024
1 parent 6bff30d commit f435429
Show file tree
Hide file tree
Showing 23 changed files with 830 additions and 772 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- name: Install Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
registry-url: "https://registry.npmjs.org"
cache: "yarn"

- name: Install Dependencies
run: yarn --frozen-lockfile
Expand All @@ -29,4 +29,4 @@ jobs:
- name: Publish
run: npm publish --access public --tag canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'yarn'
cache: "yarn"

- name: Install dependencies
run: yarn --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Install Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
registry-url: "https://registry.npmjs.org"
cache: "yarn"

- name: Install Dependencies
run: yarn --frozen-lockfile
Expand All @@ -28,4 +28,4 @@ jobs:
- name: Publish
run: yarn publish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32 changes: 16 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ jobs:
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install Solc AST binary
run: yarn global add solc-typed-ast
- name: Install Solc AST binary
run: yarn global add solc-typed-ast

- name: Install dependencies
run: yarn install
- name: Install dependencies
run: yarn install

- name: Pre-download compilers from historical builds archive
run: |
sol-ast-compile --download-compilers native wasm
find $SOL_AST_COMPILER_CACHE -name 'list.json' -delete
find $SOL_AST_COMPILER_CACHE -name '*v0.5.17*' -delete
- name: Pre-download compilers from historical builds archive
run: |
sol-ast-compile --download-compilers native wasm
find $SOL_AST_COMPILER_CACHE -name 'list.json' -delete
find $SOL_AST_COMPILER_CACHE -name '*v0.5.17*' -delete
- name: Run tests
run: yarn test
- name: Run tests
run: yarn test
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,37 @@ Some description will be written here.
## Usage

As simple as it gets, run:

```bash
npx @defi-wonderland/natspec-smells --contracts ./solidity
```

## Options

### `--contracts` (Required)

Relative path to your solidity files.

### `--root`

Root directory to be used.

Default: `./`

### `--enforceInheritdoc`

Whether `@inheritdoc` is used or not.

Default: `true`

### `--constructorNatspec`

Whether to enforce natspec for constructors.

Default: `false`

### `--ignore`

Glob pattern of files and directories to exclude from processing.

Default: `[]`
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
module.exports = { extends: ['@commitlint/config-conventional'] };
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
};
130 changes: 67 additions & 63 deletions sample-data/BasicSample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,80 @@
pragma solidity =0.8.19;

contract BasicSample {
/**
* @notice Some notice of the struct
*/
struct TestStruct {
address someAddress;
uint256 someNumber;
}
/**
* @notice Some notice of the struct
*/
struct TestStruct {
address someAddress;
uint256 someNumber;
}

/**
* @notice Some error missing parameter natspec
*/
error BasicSample_SomeError(uint256 _param1);
/**
* @notice Some error missing parameter natspec
*/
error BasicSample_SomeError(uint256 _param1);

/**
* @notice An event missing parameter natspec
*/
event BasicSample_BasicEvent(uint256 _param1);
/**
* @notice An event missing parameter natspec
*/
event BasicSample_BasicEvent(uint256 _param1);

/**
* @notice Empty string for revert checks
* @dev result of doing keccak256(bytes(''))
*/
bytes32 internal constant _EMPTY_STRING = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
/**
* @notice Empty string for revert checks
* @dev result of doing keccak256(bytes(''))
*/
bytes32 internal constant _EMPTY_STRING = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;

/**
* @notice External function that returns a bool
* @dev A dev comment
* @param _magicNumber A parameter description
* @param _name Another parameter description
* @return _isMagic Some return data
*/
function externalSimple(uint256 _magicNumber, string memory _name) external pure returns(bool _isMagic) {
return true;
}
/**
* @notice External function that returns a bool
* @dev A dev comment
* @param _magicNumber A parameter description
* @param _name Another parameter description
* @return _isMagic Some return data
*/
function externalSimple(uint256 _magicNumber, string memory _name) external pure returns (bool _isMagic) {
return true;
}

/**
* @notice Private test function
* @param _magicNumber A parameter description
*/
function privateSimple(uint256 _magicNumber) private pure {}
/**
* @notice Private test function
* @param _magicNumber A parameter description
*/
function privateSimple(uint256 _magicNumber) private pure {}

/**
* @notice Private test function
* with multiple
* lines
*/
function multiline() external pure {}
/**
* @notice Private test function
* with multiple
* lines
*/
function multiline() external pure {}

/**
* @notice Private test function
* @notice Another notice
*/
function multitag() external pure {}
/**
* @notice Private test function
* @notice Another notice
*/
function multitag() external pure {}

/**
* @notice External function that returns a bool
* @dev A dev comment
* @param _magicNumber A parameter description
* @param _name Another parameter description
* @return _isMagic Some return data
* @return Test test
*/
function externalSimpleMultipleReturn(uint256 _magicNumber, string memory _name) external pure returns(bool _isMagic, uint256) {
return (true, 111);
}
/**
* @notice External function that returns a bool
* @dev A dev comment
* @param _magicNumber A parameter description
* @param _name Another parameter description
* @return _isMagic Some return data
* @return Test test
*/
function externalSimpleMultipleReturn(uint256 _magicNumber, string memory _name)
external
pure
returns (bool _isMagic, uint256)
{
return (true, 111);
}

/**
* @notice Modifier notice
*/
modifier transferFee(uint256 _receiver) {
_;
}
/**
* @notice Modifier notice
*/
modifier transferFee(uint256 _receiver) {
_;
}
}
20 changes: 10 additions & 10 deletions sample-data/InterfacedSample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
pragma solidity =0.8.19;

interface IInterfacedSample {
/**
* @notice Greets the caller
*
* @return _greeting The greeting
* @return _balance Current token balance of the caller
*/
function greet() external view returns (string memory _greeting, uint256 _balance);
/**
* @notice Greets the caller
*
* @return _greeting The greeting
* @return _balance Current token balance of the caller
*/
function greet() external view returns (string memory _greeting, uint256 _balance);
}

contract InterfacedSample is IInterfacedSample {
/// @inheritdoc IInterfacedSample
/// @dev some dev thingy
function greet() external view returns (string memory _greeting, uint256 _balance) {}
/// @inheritdoc IInterfacedSample
/// @dev some dev thingy
function greet() external view returns (string memory _greeting, uint256 _balance) {}
}
8 changes: 4 additions & 4 deletions sample-data/LibrarySample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
pragma solidity =0.8.19;

library StringUtils {
function nothing(string memory input) public pure returns (string memory) {
return input;
}
function nothing(string memory input) public pure returns (string memory) {
return input;
}
}

contract BasicSample {
using StringUtils for string;
using StringUtils for string;
}
8 changes: 4 additions & 4 deletions sample-data/ignored-data/IgnoredContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity =0.8.19;

contract IgnoredContract {
struct AnotherStruct {
address someAddress;
uint256 someNumber;
}
struct AnotherStruct {
address someAddress;
uint256 someNumber;
}
}
6 changes: 3 additions & 3 deletions sample-data/tests/BasicTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity =0.8.19;

contract BasicTest {
function testFunction() pure external returns(bool) {
return true;
}
function testFunction() external pure returns (bool) {
return true;
}
}
Loading

0 comments on commit f435429

Please sign in to comment.