Skip to content

Commit

Permalink
Merge pull request #388 from protofire/fix/dirs-with-sol-extension
Browse files Browse the repository at this point in the history
fix: directories with .sol in the name path treated as files
  • Loading branch information
dbale-altoros committed Feb 7, 2023
2 parents a2b8ea3 + a71a19a commit 93b28e2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
@@ -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](https://github.com/protofire/solhint/pull/388)

<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
@@ -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
@@ -0,0 +1,4 @@
pragma solidity >=0.5.0;

contract Foo {
}
10 changes: 10 additions & 0 deletions e2e/test.js
Expand Up @@ -111,4 +111,14 @@ describe('e2e', function() {
expect(stdout.trim()).to.contain('Code contains empty blocks')
})
})

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

it('should handle directory names that end with .sol', function() {
const { code } = shell.exec('solhint contracts/**/*.sol')

expect(code).to.equal(0)
})
})
})
2 changes: 1 addition & 1 deletion lib/index.js
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, { nodir: true })
const files = ignoreFilter.filter(allFiles)

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

0 comments on commit 93b28e2

Please sign in to comment.