basant307/AI_Governance_Project
048
1export class SecretLintRule {2 ruleReportHandle;3 ruleCreator;4 descriptorRule;5 constructor({ descriptorRule, context }) {6 this.descriptorRule = descriptorRule;7 this.ruleCreator = descriptorRule.rule;8 // normalize rule options9 const ruleCreatorOptions = descriptorRule.options || {};10 this.ruleReportHandle = this.ruleCreator.create(context, ruleCreatorOptions);11 }12 allowMessageIds() {13 if (!this.descriptorRule.allowMessageIds) {14 return [];15 }16 const ruleId = this.ruleCreator.meta.id;17 return this.descriptorRule.allowMessageIds.map((allowMessageId) => {18 return {19 messageId: allowMessageId,20 ruleId,21 };22 });23 }24 supportSourceCode(sourceCode) {25 const contentType = sourceCode.contentType;26 if (contentType === "unknown") {27 return true;28 }29 if (this.ruleCreator.meta.supportedContentTypes.includes("all")) {30 return true;31 }32 return this.ruleCreator.meta.supportedContentTypes.includes(contentType);33 }34 async file(source) {35 const file = this.ruleReportHandle.file;36 if (!file) {37 return;38 }39 return file(source);40 }41}42//# sourceMappingURL=SecretLintRuleImpl.js.map