Skip to content

Commit

Permalink
fix: merge project-specific config with defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Szabolcs Szabolcsi-Tóth authored and madbence committed Oct 6, 2020
1 parent a3a1106 commit ef9c14a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ const Reporter = require('./reporter');
const rules = require('./rules');

const getRulesConfig = () => {
let rcFile;
const defaultRcFile = fs.readFileSync(path.resolve(__dirname, '.tektonlintrc.yaml'), 'utf8');
const defaultConfig = yaml.parse(defaultRcFile);

if (fs.existsSync('./.tektonlintrc.yaml')) {
rcFile = fs.readFileSync('./.tektonlintrc.yaml', 'utf8');
} else {
rcFile = fs.readFileSync(path.resolve(__dirname, '.tektonlintrc.yaml'), 'utf8');
const customRcFile = fs.readFileSync('./.tektonlintrc.yaml', 'utf8');
const customConfig = yaml.parse(customRcFile);
customConfig.rules = { ...defaultConfig.rules, ...customConfig.rules };

return customConfig;
}
return yaml.parse(rcFile);

return defaultConfig;
};

module.exports = async function runner(globs) {
Expand Down

0 comments on commit ef9c14a

Please sign in to comment.