Skip to content

Commit

Permalink
fix: directories with .sol extension treated as files
Browse files Browse the repository at this point in the history
  • Loading branch information
dbale-altoros committed Jan 25, 2023
1 parent 6b3c7ea commit fdc962f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
## [3.3.9] - TBD

### Updated
- Update solhint dependencies to support newer versions [#380](https://github.com/protofire/solhint/pull/380)
- Linter fixed to get clearer source code [#381](https://github.com/protofire/solhint/pull/381)
- Updated E2E, added formatters into repo, updated CI [#385](https://github.com/protofire/solhint/pull/385)

### Added
- Lint rule for banning "console.sol" and "import hardhat or foundry console.sol" [#372](https://github.com/protofire/solhint/pull/372)

### Fixed
- Directories with .sol in the name path treated as files [#352]()

<br><br>
## [3.3.8] - 2023-01-17
### Fixed Docs and Typos
- [#292](https://github.com/protofire/solhint/pull/292)
- [#343](https://github.com/protofire/solhint/pull/343)
- [#355](https://github.com/protofire/solhint/pull/355)
- [#285](https://github.com/protofire/solhint/pull/285)

### Added
- Lint rule for banning "console.sol" and "import hardhat/console.sol" [#372](https://github.com/protofire/solhint/pull/372)

### Updated
- Solidity Parser to 0.14.5 [#378](https://github.com/protofire/solhint/pull/378)
Expand Down
5 changes: 5 additions & 0 deletions e2e/04-dotSol-on-path/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"no-empty-blocks": "off"
}
}
Empty file.
4 changes: 4 additions & 0 deletions e2e/04-dotSol-on-path/contracts/ERC20.sol/Foo.sol.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pragma solidity >=0.5.0;

contract Foo {
}
12 changes: 12 additions & 0 deletions e2e/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,16 @@ describe('e2e', function() {
expect(stdout.trim()).to.contain('Code contains empty blocks')
})
})

describe('.sol on path', function() {
useFixture('04-dotSol-on-path')

it('should success', function() {
const { code, stdout } = shell.exec('solhint contracts/**/*.sol')

expect(code).to.equal(0)

console.log(stdout)
})
})
})
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function processFile(file, config) {
function processPath(path, config) {
const ignoreFilter = ignore({ allowRelativePaths: true }).add(config.excludedFiles)

const allFiles = glob.sync(path, {})
const allFiles = glob.sync(path, {}).filter((f) => fs.lstatSync(f).isFile())
const files = ignoreFilter.filter(allFiles)

return files.map((curFile) => processFile(curFile, config))
Expand Down

0 comments on commit fdc962f

Please sign in to comment.