humanmade / humanmade/linter-bot
Specifying version of phpcs, etc in hmlinter.yml can silently disable sniffing
- Dominant language
- JavaScript
- Stars
- 16
- Forks
- 2
- Avg merge
- 17d 47m
- Merged PRs (30d)
- 1
Description
When you create a yaml file like this:
```yaml
version: "latest"
phpcs:
version: "1.1.1"
```
it's reasonable to expect that HM Linter will run as normal, and use 1.1.1 for PHPCS. What actually happens is that PHPCS uses 1.1.1, but is also marked as _disabled_ so no sniffs are run.
The default configuration [includes a nested property `enabled: true` (config.js)](https://github.com/humanmade/linter-bot/blob/5b65b4b24af8344b1bbe652a91da295c77578172/src/config.js#L9-L23):
```
const DEFAULT_CONFIG = {
version: 'latest',
phpcs: {
enabled: true,
version: 'inherit',
},
//...
};
```
The defaults are then [merged in here](https://github.com/humanmade/linter-bot/blob/5b65b4b24af8344b1bbe652a91da295c77578172/src/config.js#L55-L58):
```js
return {
...DEFAULT_CONFIG,
...config
};
```
Because this merge clobbers any keys from the defaults in a non-recursive fashion, `enabled` is not set on the resulting configuration option and PHPCS does not run.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.