You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
At the moment the tool supports only some pre-defined rules defined here https://github.com/IBM/tekton-lint/blob/main/src/rule-loader.ts
It would be great if users could provide (and leave them to maintain) their custom rule implementations and specify how to treat the findings (e.g. error, warning, etc..).
An example would be like the following:
constforbidPipelinesWithoutRequiredAnnotation=(docs,tekton,report)=>{for(constpipelineofObject.values(tekton.pipelines)){constpipelineAnnotations=Object.keys(pipeline.metadata.annotations);if(!pipelineAnnotations.includes('my/required-annotation')){report(`Pipeline '${pipeline.metadata.name}' does not specify the 'my/required-annotation' annotation`,);}}};module.exports={rules: {'no-required-annotations': 'error'},customRules: {'no-required-annotations': forbidPipelinesWithoutRequiredAnnotation}}
Describe the solution you'd like
Support (on top of the yaml configuration) a JS (or TS) configuration file as well, e.g. .tektonlintrc.js where it is possible to define a set of custom rules or provide a specific rule as a function (instead of providing a string 'error' or 'warning', and leave the implementation to handle it).
Describe alternatives you've considered
At the moment there is no way to provide custom rules since they are specified in the mentioned file above
Additional context
Add JS File loader in the ./src/config.ts main constructor. An example below:
if(fs.lstatSync(user_tektonlintrc).isDirectory()){user_tektonlintrc=path.join(user_tektonlintrc,'.tektonlintrc.yaml');}if(fs.lstatSync(user_tektonlintjs).isDirectory()){user_tektonlintjs=path.join(user_tektonlintjs,'.tektonlintrc.js');}letcustomRcConfig={
...defaultConfig};if(fs.existsSync(user_tektonlintrc)){constcustomRcFile=fs.readFileSync(user_tektonlintrc,'utf8');customRcConfig=yaml.parse(customRcFile);logger.info('Using .tektonlintrc.yaml at %s',user_tektonlintrc);logger.info('customConfig %o',customRcConfig);}elseif(fs.existsSync(user_tektonlintjs)){customRcConfig=require(user_tektonlintjs);logger.info('Using .tektonlintrc.js at %s',user_tektonlintrc);logger.info('customConfig %o',customRcConfig);}else{logger.warn('Unable to find configuration - using defaults');}this._rulesConfig={ ...customRcConfig};this._rulesConfig.rules={ ...customRcConfig.rules};this._rulesConfig.customRules={ ...customRcConfig.customRules};this._globs=[...cliConfig['_'], ...(customRcConfig.globs ? customRcConfig.globs : ['_'])];
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
At the moment the tool supports only some pre-defined rules defined here https://github.com/IBM/tekton-lint/blob/main/src/rule-loader.ts
It would be great if users could provide (and leave them to maintain) their custom rule implementations and specify how to treat the findings (e.g. error, warning, etc..).
An example would be like the following:
Describe the solution you'd like
Support (on top of the yaml configuration) a JS (or TS) configuration file as well, e.g.
.tektonlintrc.js
where it is possible to define a set of custom rules or provide a specificrule
as a function (instead of providing a string 'error' or 'warning', and leave the implementation to handle it).Describe alternatives you've considered
At the moment there is no way to provide custom rules since they are specified in the mentioned file above
Additional context
Add JS File loader in the
./src/config.ts
main constructor. An example below:The text was updated successfully, but these errors were encountered: