Skip to content

Commit

Permalink
Merge pull request #938 from cucumber/unify-rubocop
Browse files Browse the repository at this point in the history
Unify RuboCop configuration with other Cucumber projects
  • Loading branch information
mvz authored Oct 20, 2024
2 parents 1280b28 + b1a4d27 commit d98df76
Show file tree
Hide file tree
Showing 148 changed files with 1,803 additions and 1,831 deletions.
31 changes: 9 additions & 22 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inherit_from: .rubocop_todo.yml

inherit_mode:
merge:
- Exclude
Expand Down Expand Up @@ -32,9 +34,9 @@ Gemspec/DevelopmentDependencies:
Gemspec/RequireMFA:
Enabled: false

# Spaces in strings with line continuations go at the beginning of the line.
Layout/LineContinuationLeadingSpace:
EnforcedStyle: leading
# Be relatively lenient with line length
Layout/LineLength:
Max: 94

# Assume the programmer knows how bracketed block syntax works
Lint/AmbiguousBlockAssociation:
Expand All @@ -50,6 +52,10 @@ Metrics/BlockLength:
- '**/*.gemspec'
- 'spec/**/*'

# Stylistic preference for cucumber
RSpec/MessageSpies:
EnforcedStyle: receive

# This cop does not work properly with predicates that take arguments.
# TODO: Re-enable once https://github.com/rubocop/rubocop-rspec/issues/466 is resolved.
RSpec/PredicateMatcher:
Expand All @@ -58,22 +64,3 @@ RSpec/PredicateMatcher:
# This cop doesn't seem to add much for us.
Style/FetchEnvVar:
Enabled: false

# Use older RuboCop default
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%w': ()

# Do not commit to use of interpolation
Style/StringLiterals:
EnforcedStyle: double_quotes

# SupportedStyles: percent, brackets
Style/SymbolArray:
EnforcedStyle: brackets

# Be relatively lenient with line length
Layout/LineLength:
Max: 94

inherit_from: .rubocop_todo.yml
14 changes: 7 additions & 7 deletions .simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ SimpleCov.configure do
enable_coverage :branch

# ignore this file
add_filter ".simplecov"
add_filter "features"
add_filter '.simplecov'
add_filter 'features'

# Rake tasks aren't tested with rspec
add_filter "Rakefile"
add_filter "lib/tasks"
add_filter 'Rakefile'
add_filter 'lib/tasks'

#
# Changed Files in Git Group
Expand All @@ -21,15 +21,15 @@ SimpleCov.configure do
all = untracked + unstaged + staged
changed_filenames = all.split("\n")

add_group "Changed" do |source_file|
add_group 'Changed' do |source_file|
changed_filenames.select do |changed_filename|
source_file.filename.end_with?(changed_filename)
end
end

add_group "Libraries", "lib"
add_group 'Libraries', 'lib'

# Specs are reported on to ensure that all examples are being run and all
# lets, befores, afters, etc are being used.
add_group "Specs", "spec/"
add_group 'Specs', 'spec/'
end
8 changes: 4 additions & 4 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Customize.new heading: <<~HEADING.chomp
This file was generated by Appraisal
HEADING

appraise "cucumber_8" do
gem "cucumber", "~> 8.0"
appraise 'cucumber_8' do
gem 'cucumber', '~> 8.0'
end

appraise "cucumber_9" do
gem "cucumber", ["~> 9.0", ">= 9.0.1"]
appraise 'cucumber_9' do
gem 'cucumber', ['~> 9.0', '>= 9.0.1']
end
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

# Use dependencies from gemspec
gemspec

# Load local Gemfile
if File.file? File.expand_path("Gemfile.local", __dir__)
load File.expand_path("Gemfile.local", __dir__)
if File.file? File.expand_path('Gemfile.local', __dir__)
load File.expand_path('Gemfile.local', __dir__)
end
36 changes: 18 additions & 18 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@

$LOAD_PATH << File.expand_path(__dir__)

require "aruba/platform"
require 'aruba/platform'

require "bundler"
require 'bundler'
Bundler.setup

require "cucumber/rake/task"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require 'cucumber/rake/task'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w(--format progress)
t.cucumber_opts = %w[--format progress]
end

Cucumber::Rake::Task.new("cucumber:wip", "Run Cucumber features" \
" which are \"WORK IN PROGRESS\" and" \
" are allowed to fail") do |t|
t.cucumber_opts = %w(--tags @wip:3 --wip)
Cucumber::Rake::Task.new('cucumber:wip', 'Run Cucumber features ' \
'which are "WORK IN PROGRESS" and ' \
'are allowed to fail') do |t|
t.cucumber_opts = %w[--tags @wip:3 --wip]
end

RSpec::Core::RakeTask.new

desc "Run the whole test suite."
task test: [:spec, :cucumber]
desc 'Run the whole test suite.'
task test: %i[spec cucumber]

RuboCop::RakeTask.new

Bundler::GemHelper.install_tasks

require "rake/manifest/task"
require 'rake/manifest/task'

Rake::Manifest::Task.new do |t|
t.patterns = ["lib/**/*", "exe/*", "CHANGELOG.md", "CONTRIBUTING.md",
"LICENSE", "README.md"]
t.patterns = ['lib/**/*', 'exe/*', 'CHANGELOG.md', 'CONTRIBUTING.md',
'LICENSE', 'README.md']
end

# Check the manifest before building the gem
task build: "manifest:check"
task build: 'manifest:check'

desc "Run checks"
task lint: %w(rubocop manifest:check)
desc 'Run checks'
task lint: %w[rubocop manifest:check]

task default: :test
80 changes: 40 additions & 40 deletions aruba.gemspec
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# frozen_string_literal: true

require_relative "lib/aruba/version"
require_relative 'lib/aruba/version'

Gem::Specification.new do |spec|
spec.name = "aruba"
spec.name = 'aruba'
spec.version = Aruba::VERSION
spec.author = "Aslak Hellesøy, Matt Wynne and other Aruba Contributors"
spec.author = 'Aslak Hellesøy, Matt Wynne and other Aruba Contributors'
spec.description = <<~TEXT
Extension for popular TDD and BDD frameworks like "Cucumber", "RSpec" and "Minitest",
to make testing command line applications meaningful, easy and fun.
TEXT
spec.summary = "aruba-#{spec.version}"
spec.license = "MIT"
spec.email = "cukes@googlegroups.com"
spec.homepage = "https://github.com/cucumber/aruba"
spec.license = 'MIT'
spec.email = 'cukes@googlegroups.com'
spec.homepage = 'https://github.com/cucumber/aruba'

spec.metadata = {
"bug_tracker_uri" => "https://github.com/cucumber/aruba/issues",
"changelog_uri" => "https://www.rubydoc.info/gems/aruba/file/CHANGELOG.md",
"documentation_uri" => "https://www.rubydoc.info/gems/aruba",
"homepage_uri" => spec.homepage,
"source_code_uri" => "https://github.com/cucumber/aruba"
'bug_tracker_uri' => 'https://github.com/cucumber/aruba/issues',
'changelog_uri' => 'https://www.rubydoc.info/gems/aruba/file/CHANGELOG.md',
'documentation_uri' => 'https://www.rubydoc.info/gems/aruba',
'homepage_uri' => spec.homepage,
'source_code_uri' => 'https://github.com/cucumber/aruba'
}

spec.add_dependency "bundler", [">= 1.17", "< 3.0"]
spec.add_dependency "contracts", [">= 0.16.0", "< 0.18.0"]
spec.add_dependency "cucumber", ">= 8.0", "< 10.0"
spec.add_dependency "rspec-expectations", "~> 3.4"
spec.add_dependency "thor", "~> 1.0"

spec.add_development_dependency "appraisal", "~> 2.4"
spec.add_development_dependency "json", "~> 2.1"
spec.add_development_dependency "kramdown", "~> 2.1"
spec.add_development_dependency "minitest", "~> 5.10"
spec.add_development_dependency "pry", [">= 0.13.0", "< 0.15.0"]
spec.add_development_dependency "rake", [">= 12.0", "< 14.0"]
spec.add_development_dependency "rake-manifest", "~> 0.2.0"
spec.add_development_dependency "rspec", "~> 3.11"
spec.add_development_dependency "rubocop", "~> 1.62"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.2"
spec.add_development_dependency "rubocop-performance", "~> 1.21"
spec.add_development_dependency "rubocop-rspec", "~> 3.0"
spec.add_development_dependency "simplecov", ">= 0.18.0", "< 0.23.0"

spec.required_ruby_version = ">= 3.0.0"

spec.files = File.readlines("Manifest.txt", chomp: true)

spec.executables = ["aruba"]
spec.rdoc_options = ["--charset", "UTF-8", "--main", "README.md"]
spec.extra_rdoc_files = ["CHANGELOG.md", "CONTRIBUTING.md", "README.md", "LICENSE"]
spec.bindir = "exe"
spec.require_paths = ["lib"]
spec.add_dependency 'bundler', ['>= 1.17', '< 3.0']
spec.add_dependency 'contracts', ['>= 0.16.0', '< 0.18.0']
spec.add_dependency 'cucumber', '>= 8.0', '< 10.0'
spec.add_dependency 'rspec-expectations', '~> 3.4'
spec.add_dependency 'thor', '~> 1.0'

spec.add_development_dependency 'appraisal', '~> 2.4'
spec.add_development_dependency 'json', '~> 2.1'
spec.add_development_dependency 'kramdown', '~> 2.1'
spec.add_development_dependency 'minitest', '~> 5.10'
spec.add_development_dependency 'pry', ['>= 0.13.0', '< 0.15.0']
spec.add_development_dependency 'rake', ['>= 12.0', '< 14.0']
spec.add_development_dependency 'rake-manifest', '~> 0.2.0'
spec.add_development_dependency 'rspec', '~> 3.11'
spec.add_development_dependency 'rubocop', '~> 1.62'
spec.add_development_dependency 'rubocop-packaging', '~> 0.5.2'
spec.add_development_dependency 'rubocop-performance', '~> 1.21'
spec.add_development_dependency 'rubocop-rspec', '~> 3.0'
spec.add_development_dependency 'simplecov', '>= 0.18.0', '< 0.23.0'

spec.required_ruby_version = '>= 3.0.0'

spec.files = File.readlines('Manifest.txt', chomp: true)

spec.executables = ['aruba']
spec.rdoc_options = ['--charset', 'UTF-8', '--main', 'README.md']
spec.extra_rdoc_files = ['CHANGELOG.md', 'CONTRIBUTING.md', 'README.md', 'LICENSE']
spec.bindir = 'exe'
spec.require_paths = ['lib']
end
4 changes: 2 additions & 2 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

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

require "aruba/console"
require 'aruba/console'

Aruba::Console.new.start
4 changes: 2 additions & 2 deletions exe/aruba
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

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

require "aruba/cli"
require 'aruba/cli'

Aruba::Cli.start
40 changes: 20 additions & 20 deletions features/step_definitions/hooks.rb
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
# frozen_string_literal: true

require "cucumber/platform"
require 'cucumber/platform'

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

skip_this_scenario
end

Before "@requires-zsh" do
next unless Aruba.platform.which("zsh").nil?
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?
Before '@requires-java' do
next unless Aruba.platform.which('javac').nil?

skip_this_scenario
end

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

skip_this_scenario
end

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

skip_this_scenario
end

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

skip_this_scenario
end

Before "@requires-ruby-platform-java" do
Before '@requires-ruby-platform-java' do
skip_this_scenario unless Cucumber::JRUBY
end

Before "@unsupported-on-platform-java" do
Before '@unsupported-on-platform-java' do
skip_this_scenario if Cucumber::JRUBY
end

Before "@unsupported-on-platform-windows" do
Before '@unsupported-on-platform-windows' do
skip_this_scenario if Cucumber::WINDOWS
end

Before "@requires-readline" do
require "readline"
Before '@requires-readline' do
require 'readline'
rescue LoadError
skip_this_scenario
end

Before "@unsupported-on-platform-unix" do
Before '@unsupported-on-platform-unix' do
skip_this_scenario unless Cucumber::WINDOWS
end

Before "@unsupported-on-platform-mac" do
Before '@unsupported-on-platform-mac' do
skip_this_scenario if Cucumber::OS_X
end
4 changes: 2 additions & 2 deletions features/support/aruba.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

require "aruba/cucumber"
require 'aruba/cucumber'

Aruba.configure do |config|
config.exit_timeout = 120
config.io_wait_timeout = 2
config.activate_announcer_on_command_failure = [:stderr, :stdout, :command]
config.activate_announcer_on_command_failure = %i[stderr stdout command]
end
Loading

0 comments on commit d98df76

Please sign in to comment.