class Gergich::Capture::StylelintCapture
Constants
- ERROR_PATTERN
example error line:
1:15 ✖ Unexpected invalid hex color "#2D3B4" color-no-invalid-hex
- FILE_PATH_PATTERN
example file line: app/stylesheets/base/_variables.scss
- PATTERN
- SEVERITY_MAP
stylelint is a css linter github.com/stylelint/stylelint
example full output: app/stylesheets/base/_print.scss
3:17 ✖ Unexpected invalid hex color "#owiehfi" color-no-invalid-hex 3:17 ⚠ Expected "#owiehfi" to be "#OWIEHFI" color-hex-case
app/stylesheets/base/_variables.scss
2:15 ✖ Unexpected invalid hex color "#2D3B4" color-no-invalid-hex 30:15 ⚠ Expected "#2d3b4a" to be "#2D3B4A" color-hex-case
Public Instance Methods
run(output)
click to toggle source
# File lib/gergich/capture/stylelint_capture.rb, line 34 def run(output) output.scan(PATTERN).map { |file, errors| errors.scan(ERROR_PATTERN).map { |line, severity, error| severity = SEVERITY_MAP[severity] { path: file, message: error, source: "stylelint", position: line.to_i, severity: severity } } }.flatten.compact end