Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up approx 20% of the rubocop issues in aruba #654

Merged
merged 9 commits into from
Jul 19, 2019
76 changes: 6 additions & 70 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-05-19 17:25:35 +0200 using RuboCop version 0.69.0.
# on 2019-07-01 13:22:17 +0200 using RuboCop version 0.69.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 5
# Cop supports --auto-correct.
Layout/ClosingHeredocIndentation:
Exclude:
- 'lib/aruba/initializer.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: leading, trailing
Layout/DotPosition:
Exclude:
- 'spec/aruba/matchers/collection_spec.rb'

# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: squiggly, active_support, powerpack, unindent
Layout/IndentHeredoc:
Exclude:
- 'lib/aruba/initializer.rb'

# Offense count: 7
Lint/AmbiguousBlockAssociation:
Exclude:
Expand Down Expand Up @@ -56,7 +34,7 @@ Lint/Void:
Metrics/AbcSize:
Max: 116

# Offense count: 69
# Offense count: 72
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Expand All @@ -67,7 +45,7 @@ Metrics/BlockLength:
Metrics/ClassLength:
Max: 135

# Offense count: 19
# Offense count: 18
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 18
Expand All @@ -86,25 +64,13 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Max: 10

# Offense count: 1
Naming/ConstantName:
Exclude:
- 'lib/aruba/platform.rb'

# Offense count: 5
# Configuration parameters: Blacklist.
# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/aruba/initializer.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Naming/MemoizedInstanceVariableName:
Exclude:
- 'lib/aruba/api/core.rb'

# Offense count: 16
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db
Expand Down Expand Up @@ -161,7 +127,7 @@ Style/CommentedKeyword:
Exclude:
- 'spec/aruba/api_spec.rb'

# Offense count: 13
# Offense count: 12
Style/Documentation:
Exclude:
- 'spec/**/*'
Expand All @@ -170,7 +136,6 @@ Style/Documentation:
- 'fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb'
- 'fixtures/empty-app/lib/cli/app.rb'
- 'lib/aruba/api/bundler.rb'
- 'lib/aruba/colorizer.rb'
- 'lib/aruba/matchers/collection/include_an_object.rb'
- 'lib/aruba/platforms/command_monitor.rb'
- 'lib/aruba/setup.rb'
Expand All @@ -181,21 +146,6 @@ Style/EvalWithLocation:
Exclude:
- 'spec/support/helpers/reporting.rb'

# Offense count: 16
# Cop supports --auto-correct.
Style/ExpandPathArguments:
Exclude:
- 'bin/console'
- 'exe/aruba'
- 'features/support/env.rb'
- 'features/support/simplecov_setup.rb'
- 'fixtures/cli-app/bin/aruba-test-cli'
- 'fixtures/cli-app/cli-app.gemspec'
- 'fixtures/cli-app/lib/cli/app.rb'
- 'fixtures/cli-app/spec/spec_helper.rb'
- 'fixtures/empty-app/cli-app.gemspec'
- 'fixtures/empty-app/lib/cli/app.rb'

# Offense count: 84
# Configuration parameters: EnforcedStyle.
# SupportedStyles: annotated, template, unannotated
Expand Down Expand Up @@ -234,20 +184,6 @@ Style/MethodMissingSuper:
- 'lib/aruba/platforms/command_monitor.rb'
- 'lib/aruba/tasks/docker_helpers.rb'

# Offense count: 3
Style/MissingRespondToMissing:
Exclude:
- 'lib/aruba/in_config_wrapper.rb'
- 'lib/aruba/platforms/command_monitor.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Style/MutableConstant:
Exclude:
- 'lib/aruba/colorizer.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: Whitelist.
Expand Down Expand Up @@ -300,7 +236,7 @@ Style/Semicolon:
Exclude:
- 'lib/aruba/platforms/aruba_fixed_size_file_creator.rb'

# Offense count: 44
# Offense count: 43
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: only_raise, only_fail, semantic
Expand All @@ -321,7 +257,7 @@ Style/StderrPuts:
Style/SymbolArray:
EnforcedStyle: brackets

# Offense count: 417
# Offense count: 411
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Expand Down
2 changes: 1 addition & 1 deletion aruba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry-doc', '~> 1.0.0'
spec.add_development_dependency 'rake', '~> 12.3'
spec.add_development_dependency 'rspec', '~> 3.6'
spec.add_development_dependency 'rubocop', '~> 0.69'
spec.add_development_dependency 'rubocop', '~> 0.69.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.1'
spec.add_development_dependency 'simplecov', '~> 0.15'
spec.add_development_dependency 'travis-yaml', '~> 0.2'
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)

require 'aruba/console'

Expand Down
2 changes: 1 addition & 1 deletion exe/aruba
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

$LOAD_PATH << File.expand_path('../../lib', __FILE__)
$LOAD_PATH << File.expand_path('../lib', __dir__)

require 'aruba/cli'

Expand Down
26 changes: 16 additions & 10 deletions features/step_definitions/hooks.rb
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
require 'cucumber/platform'

Before '@requires-python' do |scenario|
Before '@requires-python' do
next unless Aruba.platform.which('python').nil?

skip_this_scenario
end

Before '@requires-java' do |scenario|
Before '@requires-zsh' do
next unless Aruba.platform.which('zsh').nil?

skip_this_scenario
end

Before '@requires-java' do
next unless Aruba.platform.which('javac').nil?

skip_this_scenario
end

Before '@requires-perl' do |scenario|
Before '@requires-perl' do
next unless Aruba.platform.which('perl').nil?

skip_this_scenario
end

Before '@requires-ruby' do |scenario|
Before '@requires-ruby' do
next unless Aruba.platform.which('ruby').nil?

skip_this_scenario
end

Before '@requires-posix-standard-tools' do |scenario|
Before '@requires-posix-standard-tools' do
next unless Aruba.platform.which('printf').nil?

skip_this_scenario
end

Before '@requires-ruby-platform-java' do |scenario|
Before '@requires-ruby-platform-java' do
# leave if java
next if RUBY_PLATFORM.include? 'java'

skip_this_scenario
end

Before '@unsupported-on-platform-java' do |scenario|
Before '@unsupported-on-platform-java' do
# leave if not java
next unless RUBY_PLATFORM.include? 'java'

skip_this_scenario
end

Before '@unsupported-on-platform-windows' do |scenario|
Before '@unsupported-on-platform-windows' do
# leave if not windows
next unless FFI::Platform.windows?

Expand All @@ -59,14 +65,14 @@
end
end

Before '@unsupported-on-platform-unix' do |scenario|
Before '@unsupported-on-platform-unix' do
# leave if not windows
next unless FFI::Platform.unix?

skip_this_scenario
end

Before '@unsupported-on-platform-mac' do |scenario|
Before '@unsupported-on-platform-mac' do
# leave if not windows
next unless FFI::Platform.mac?

Expand Down
2 changes: 1 addition & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
$LOAD_PATH.unshift File.expand_path('../../lib', __dir__)

# Has to be the first file required so that all other files show coverage information
require 'simplecov' unless RUBY_PLATFORM.include?('java')
Expand Down
4 changes: 1 addition & 3 deletions features/support/simplecov_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# child processes and @in-process
unless RUBY_PLATFORM.include?('java')
require 'simplecov'

root = File.expand_path('../../../', __FILE__)

root = File.expand_path('../..', __dir__)
SimpleCov.command_name(ENV['SIMPLECOV_COMMAND_NAME'])
SimpleCov.root(root)
load File.join(root, '.simplecov')
Expand Down
2 changes: 1 addition & 1 deletion fixtures/cli-app/bin/aruba-test-cli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

$LOAD_PATH << File.expand_path('../../lib', __FILE__)
$LOAD_PATH << File.expand_path('../lib', __dir__)
require 'cli/app'

exit 0
2 changes: 1 addition & 1 deletion fixtures/cli-app/cli-app.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cli/app/version'

Expand Down
2 changes: 1 addition & 1 deletion fixtures/cli-app/lib/cli/app.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'cli/app/version'

::Dir.glob(File.expand_path('../**/*.rb', __FILE__)).each { |f| require_relative f }
::Dir.glob(File.expand_path('**/*.rb', __dir__)).each { |f| require_relative f }

module Cli
module App
Expand Down
2 changes: 1 addition & 1 deletion fixtures/cli-app/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)

require 'cli/app'

Expand Down
2 changes: 1 addition & 1 deletion fixtures/empty-app/cli-app.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cli/app/version'

Expand Down
12 changes: 6 additions & 6 deletions lib/aruba/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
module Aruba
# Api
module Api
include Aruba::Api::Core
include Aruba::Api::Commands
include Aruba::Api::Environment
include Aruba::Api::Filesystem
include Aruba::Api::Text
include Aruba::Api::Bundler
include Core
include Commands
include Environment
include Filesystem
include Text
include Bundler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

end
end
2 changes: 2 additions & 0 deletions lib/aruba/api/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ module Core

# Aruba Runtime
def aruba
# TODO: Check this variable being accessed inconsistently. Should only be using the memo!
# Renaming this to `aruba` causes 100's of rspec failures. Needs a deeper dive, approach with caution!
@_aruba_runtime ||= Runtime.new
end

Expand Down
4 changes: 4 additions & 0 deletions lib/aruba/in_config_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ def method_missing(name, *args)

config[name]
end

def respond_to_missing?(*)
true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably do something like config.key? name.

end
end
end
Loading