Sha256: 9d33f4fef524f19d6f44902172383f48091723b160daee9bc0267ac7c9d4a523
Contents?: true
Size: 530 Bytes
Versions: 15
Compression:
Stored size: 530 Bytes
Contents
require 'open3' module Skeptic module Rules class CheckSyntax DESCRIPTION = 'Check the syntax' def initialize(enabled = false) @errors = [] end def apply_to(code, tokens, sexp) output, error, status = Open3.capture3 'ruby -c', stdin_data: code @errors << "Invalid syntax:\n#{error.gsub(/^/m, ' ')}" unless output.chomp == 'Syntax OK' self end def violations @errors end def name 'Syntax check' end end end end
Version data entries
15 entries across 15 versions & 1 rubygems