Skip to content

Commit

Permalink
WIP fixes for current RuboCop
Browse files Browse the repository at this point in the history
it still fails

Important: must use

    bundle exec cucumber -b

to see the full backtrace
  • Loading branch information
mvidner committed Apr 19, 2017
1 parent 05e804a commit c97b371
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
15 changes: 11 additions & 4 deletions features/support/env.rb
Expand Up @@ -2,6 +2,7 @@

require "simplecov"
require "rspec"
require "rubocop/rspec/cop_helper"

# use coveralls for on-line code coverage reporting at Travis CI
if ENV["TRAVIS"]
Expand All @@ -24,12 +25,18 @@
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.include CopHelper
config.full_backtrace = true
end

# reuse the Rubocop helper, provides some nice methods used in tests
require File.join(Gem::Specification.find_by_name("rubocop").gem_dir, "spec",
"support", "cop_helper.rb")
include CopHelper
# a bad hack. including CopHelper in the RSpec example is not enough
# because Cucumber runs it elsewhere
module RSpec::Matchers
def self.let(symbol, &block)
define_method(symbol, block)
end
include CopHelper
end

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))

Expand Down
3 changes: 2 additions & 1 deletion lib/rubocop-yast.rb
Expand Up @@ -3,7 +3,8 @@
require "rubocop"

require_relative "rubocop/yast/config"
RuboCop::Yast::Config.load_defaults
# FIXME: re-enable this
#RuboCop::Yast::Config.load_defaults

require_relative "rubocop/yast/version"
require_relative "rubocop/yast/logger"
Expand Down
3 changes: 1 addition & 2 deletions lib/rubocop/cop/yast/ops.rb
Expand Up @@ -73,7 +73,6 @@ def contains_comment?(string)
# Niceness processor really
class OpsProcessor < Parser::AST::Processor
include RuboCop::Yast::TrackVariableScope
include RuboCop::Cop::Util # const_name

attr_reader :cop

Expand All @@ -91,7 +90,7 @@ def on_send(node)
super

receiver, message = *node
return unless const_name(receiver) == "Ops"
return unless receiver && receiver.const_name == "Ops"
return unless RuboCop::Cop::Yast::Ops::REPLACEMENT.key?(message)
return unless cop.strict_mode || autocorrectable?(node)
cop.add_offense(node, :selector, format(MSG, message))
Expand Down
5 changes: 1 addition & 4 deletions lib/rubocop/yast/builtins/builtin.rb
@@ -1,7 +1,4 @@

# RuboCop::Cop::CorrectionNotPossible exception
require "rubocop/cop/cop"

module RuboCop
module Yast
module Builtins
Expand Down Expand Up @@ -30,7 +27,7 @@ def offense?(node)
end

def correction(_node)
raise RuboCop::Cop::CorrectionNotPossible
false
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion rubocop-yast.gemspec
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(/^spec\//)
spec.extra_rdoc_files = ["LICENSE", "README.md"]

spec.add_runtime_dependency("rubocop", "~> 0.29.1")
spec.add_runtime_dependency("rubocop", "~> 0.48.1")
spec.add_runtime_dependency("unparser", "~> 0")

spec.add_development_dependency("rake", "< 11")
Expand Down

0 comments on commit c97b371

Please sign in to comment.