lib/chutney.rb in chutney-2.2.1 vs lib/chutney.rb in chutney-3.0.0.beta.1
- old
+ new
@@ -1,6 +1,9 @@
+# frozen_string_literal: true
+
require 'amatch'
+
require 'chutney/configuration'
require 'chutney/linter'
require 'chutney/linter/avoid_full_stop'
require 'chutney/linter/avoid_outline_for_single_example'
require 'chutney/linter/avoid_scripting'
@@ -31,24 +34,25 @@
require 'chutney/linter/unique_scenario_names'
require 'chutney/linter/unknown_variable'
require 'chutney/linter/unused_variable'
require 'chutney/linter/use_background'
require 'chutney/linter/use_outline'
+
+require 'cuke_modeler'
require 'forwardable'
-require 'gherkin/dialect'
-require 'gherkin/parser'
+# require 'gherkin/dialect'
+# require 'gherkin/parser'
require 'i18n'
require 'set'
require 'yaml'
module Chutney
# gherkin linter
class ChutneyLint
extend Forwardable
attr_accessor :verbose
- attr_reader :files
- attr_reader :results
+ attr_reader :files, :results
def_delegators :@files, :<<, :clear, :delete, :include?
def initialize(*files)
@files = files
@@ -90,17 +94,11 @@
@linters = linters
end
private
- def parse(text)
- @parser ||= Gherkin::Parser.new
- scanner = Gherkin::TokenScanner.new(text)
- @parser.parse(scanner)
- end
-
def lint(file)
- parsed = parse(File.read(file))
+ parsed = CukeModeler::FeatureFile.new(file)
linters.each do |linter_class|
linter = linter_class.new(file, parsed, configuration[linter_class.linter_name])
linter.lint
@results[file] << { linter: linter.linter_name, issues: linter.issues }
end