linter-phpcs icon indicating copy to clipboard operation
linter-phpcs copied to clipboard

disableWhenNoConfigFile not really working

Open Cweet opened this issue 5 years ago • 0 comments

Something that bothered me when working in projects without a config file, it throws errors every time you click on a file, even when I have check on the "disableWhenNoConfigFile". The problem is that this check is not being executed early enough. By moving this check further up, right under "const parameters = ['--report=json'];" this issue is resolved.

// Check if a config file exists and handle it
const confFileNames = [
     '.phpcs.xml', '.phpcs.xml.dist', 'phpcs.xml', 'phpcs.xml.dist',
     'phpcs.ruleset.xml', 'ruleset.xml',
];
const confFile = await helpers.findAsync(fileDir, confFileNames);
if (this.disableWhenNoConfigFile && !confFile) {
     return [];
}

Cweet avatar Mar 11 '20 15:03 Cweet