Commit 3a9271f1 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Convert parser warnings to stdout in haml_lint

This was used in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/16648
and this could happen from time to time, so let's just keep it.
parent 0cbefe85
# frozen_literal_string: true
# This works around unnecessary static-analysis warnings that will be
# fixed via https://github.com/whitequark/parser/pull/528.
module Parser
class << self
def warn_syntax_deviation(feature, version)
return if ['2.3.8', '2.4.5', '2.5.3'].include?(version)
warn "warning: parser/current is loading #{feature}, which recognizes"
warn "warning: #{version}-compliant syntax, but you are running #{RUBY_VERSION}."
warn "warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri."
end
end
end
......@@ -2,5 +2,16 @@ unless Rails.env.production?
require 'haml_lint/rake_task'
require 'haml_lint/inline_javascript'
# Workaround for warnings from parser/current
# Keep it even if it no longer emits any warnings,
# because we'll still see warnings in console/server anyway,
# and we don't need to break static-analysis for this.
task :haml_lint do
require 'parser'
def Parser.warn(*args)
puts(*args) # static-analysis ignores stdout if status is 0
end
end
HamlLint::RakeTask.new
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment