goodcheck icon indicating copy to clipboard operation
goodcheck copied to clipboard

Add rule location in JSON output

Open ybiquitous opened this issue 5 years ago • 1 comments

Example

goodcheck.yml:

rules:
  - id: disallow-standard-error
    pattern:
      - token: StandardError
    glob: lib/**/*.rb
    message: Disallow `StandardError`.
    justification:
      - When there is an unavoidable reason to use `StandardError`.

goodcheck check --format json lib/:

[
  {
    "rule_id": "disallow-standard-error",
    "path": "lib/errors.rb",
    "location": {
      "start_line": 2,
      "start_column": 16,
      "end_line": 2,
      "end_column": 29
    },
    "message": "Disallow `StandardError`.",
    "justifications": [
      "When there is an unavoidable reason to use `StandardError`."
    ],
    "rule_location": { //<= new property
      "uri": "file:///tmp/project/goodcheck.yml", // or https://some.host/shared/rules.yml
      "line": 2
    }
  }
]

ybiquitous avatar Jul 23 '20 12:07 ybiquitous

I agree :+1:

yykamei avatar Jul 27 '20 01:07 yykamei