todogroup / repolinter

Repolinter, The Open Source Repository Linter
https://todogroup.github.io/repolinter/
Apache License 2.0
421 stars 72 forks source link

Cut new version #299

Open oboyle opened 1 year ago

oboyle commented 1 year ago

Issue Report

I've developed rules that use the file-not-contents rule, specifically the contents field of the rule. This feature does not exist in the the current version (0.11.2) released to NPM but the feature exists in the current code in this repository. The ask is to cut a new version of Repolinter.

Steps to Reproduce the Issue

Install the module from NPM and attempt to use the contents field of a rule instead of content.

$ npm install repolinter
$ repolinter -r policy-below.json
Configuration validation failed with errors: 
    configuration.rules['rule-name'].rule.options should have required property 'content'

You can test using this rule set. The linter should run successfully, not generate the error above, and, if there are any Altavista email addresses in your code, generate a finding.

  "rules": {
    "rule-name": {
      "level": "warning",
      "rule": {
        "type": "file-not-contents",
        "options": {
          "globsAll": [
            "**/*"
          ],
          "contents": [
            ".+@yahoo.com",
            ".+@altavista.com"
          ],
          "nocase": true,
          "flags": "gi",
          "fail-on-non-existent": false,
          "display-result-context": true
        }
      }
    }
  }