Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
52c64a5
Settings: Update rubocop and settings
edthamm Aug 17, 2018
e0eefa7
Auto correct: Style/StringLiterals in spec
edthamm Aug 17, 2018
b680c6c
Auto correct: Style/FrozenStringLiteralComment
edthamm Aug 17, 2018
87a677a
Correct: Violations in gemfile
edthamm Aug 17, 2018
cf64428
Fix: Unfreeze string literal in failing test
edthamm Aug 17, 2018
6f3ef4b
Auto correct: Layout/DotPosition
edthamm Aug 17, 2018
e417c40
Auto correct: Style/PercentLiteralDelimiters in spec
edthamm Aug 17, 2018
fe4e7aa
Auto correct: Layout/EmptyLineAfterMagicComment in spec
edthamm Aug 17, 2018
b80411a
Auto correct: Style/SymbolArray in spec
edthamm Aug 17, 2018
fb32fe9
Auto correct: Layout/MultilineMethodCallIndentation in spec
edthamm Aug 17, 2018
4942fc1
Settings: Set Metrics/LineLength:Max to 125
edthamm Aug 17, 2018
8358c62
Auto correct: Style/TrailingCommaIn.*Literal in spec
edthamm Aug 17, 2018
f33d6c4
Settings: Adapt quote and dot settings
edthamm Aug 17, 2018
98933f8
Auto correct: Style/ExpandPathArguments in spec
edthamm Aug 17, 2018
3d8571a
Auto correct: Layout/AlignArray in spec
edthamm Aug 17, 2018
c7b3fd3
Auto correct: Style/Encoding in spec
edthamm Aug 17, 2018
3a98cc0
Correct: Forgotten double-quotes in Gemfile
edthamm Aug 17, 2018
6b466f6
Auto correct: Lint/UnneededSplatExpansion in spec
edthamm Aug 17, 2018
8c93ed9
Fix: Explicitly set rubocop configuration file
edthamm Aug 17, 2018
5069a11
Auto correct: Style/EmptyMethod in spec
edthamm Aug 17, 2018
b095597
Correct: the remaining 3 violations
edthamm Aug 17, 2018
5230884
Settings: Get rid of warnings.
edthamm Aug 17, 2018
49d6ffa
Fix: Resupport version 2.2.9
edthamm Aug 17, 2018
fed30f1
Fix: Increase aruba timeout for Jruby on CI
edthamm Aug 17, 2018
8c2ab9e
Settings: Enrich Metrics/LineLength config
edthamm Aug 19, 2018
8114666
Fix: Resupport 2.2.9 in rubocop
edthamm Aug 19, 2018
215f891
Settings: Set Style/StringLiterals to double_quotes
edthamm Aug 21, 2018
4a77fde
Auto correct: Style/StringLiterals
edthamm Aug 21, 2018
a804658
Trigger Hound
edthamm Sep 18, 2018
b972242
Auto correct: Style/StringLiterals in top level dir
edthamm Sep 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ inherit_from:
AllCops:
TargetRubyVersion: 2.2
Exclude:
- vendor/**/*
- db/schema.rb
- tmp/aruba/Guardfile
- tmp/aruba/Gemfile
Expand Down
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ Style/NumericPredicate:

# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceInsideArrayPercentLiteral:
Layout/SpaceInsideArrayPercentLiteral:
Exclude:
- 'guard.gemspec'

# Offense count: 41
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Style/SpaceInsideStringInterpolation:
Layout/SpaceInsideStringInterpolation:
Exclude:
- 'lib/guard.rb'
- 'lib/guard/cli.rb'
Expand Down
18 changes: 10 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec unless ENV["USE_INSTALLED_GUARD"] == "1"
Expand All @@ -15,13 +17,13 @@ group :development do
# on HoundCI's side.
#
# See https://github.com/houndci/hound/issues/1250
gem "rubocop", "0.51.0", require: false
gem "rubocop", "0.54.0", require: false

gem "guard-rubocop", require: false

gem "yard", require: false, platform: :mri
gem "redcarpet", require: false, platform: :mri
gem "guard-ronn", require: false, platform: :mri
gem "redcarpet", require: false, platform: :mri
gem "yard", require: false, platform: :mri

# Used for release
gem "gems", require: false, platform: :mri
Expand All @@ -37,19 +39,19 @@ group :test do
gem "guard-cucumber", "~> 2.1", require: false
gem "guard-rspec", require: false

gem "codeclimate-test-reporter", require: nil
gem "rspec", ">= 3.0.0", require: false
gem "aruba", "~> 0.9", require: false
gem "codeclimate-test-reporter", require: nil
gem "notiffany", ">= 0.0.6", require: false
gem "rspec", ">= 3.0.0", require: false
end

# Needed for Travis
# See http://docs.travis-ci.com/user/languages/ruby/#Rubinius
#
platforms :rbx do
gem "racc"
gem "rubysl", "~> 2.0"
gem "psych"
gem "json"
gem "psych"
gem "racc"
gem "rubinius-coverage"
gem "rubysl", "~> 2.0"
end
2 changes: 1 addition & 1 deletion config/Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ group :specs, halt_on_fail: true do
# watch(%r{^lib/guard/(guard|plugin).rb$}) { "spec/guard/plugin" }
end

guard :rubocop, all_on_start: false, cli: "--rails" do
guard :rubocop, all_on_start: false, cli: "--rails -c .rubocop.yml" do
watch(%r{.+\.rb$}) { |m| m[0] }
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
Expand Down
2 changes: 1 addition & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
set_environment_variable "HOME", home
FileUtils.mkdir(home)

@aruba_timeout_seconds = Cucumber::JRUBY ? 35 : 15
@aruba_timeout_seconds = Cucumber::JRUBY ? 45 : 15
end
34 changes: 18 additions & 16 deletions spec/lib/guard/bin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
path = File.expand_path("../../../../bin/guard", __FILE__)
# frozen_string_literal: true

path = File.expand_path("../../../bin/guard", __dir__)

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

load path

RSpec.describe GuardReloader do
Expand All @@ -11,13 +13,13 @@
before do
allow(described_class::Config).to receive(:new).and_return(config)

allow(config).to receive(:current_bundler_gemfile).
and_return(bundle_gemfile_env)
allow(config).to receive(:current_bundler_gemfile)
.and_return(bundle_gemfile_env)

allow(config).to receive(:using_bundler?).and_return(bundle_gemfile_env)
allow(config).to receive(:guard_core_path).and_return(guard_core_path)

allow(config).to receive(:program_arguments).and_return(%w(foo bar baz))
allow(config).to receive(:program_arguments).and_return(%w[foo bar baz])
allow(config).to receive(:using_rubygems?).and_return(rubygems_deps_env)
allow(config).to receive(:program_path).and_return(program_path)
end
Expand Down Expand Up @@ -54,8 +56,8 @@

context "when the relative Gemfile exists" do
before do
allow(config).to receive(:exist?).
with(Pathname("/my/project/Gemfile")).and_return(true)
allow(config).to receive(:exist?)
.with(Pathname("/my/project/Gemfile")).and_return(true)

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.


allow(config).to receive(:setup_bundler)
allow(config).to receive(:setup_bundler_env)
Expand All @@ -67,19 +69,19 @@
end

it "sets the Gemfile" do
expect(config).to receive(:setup_bundler_env).
with("/my/project/Gemfile")
expect(config).to receive(:setup_bundler_env)
.with("/my/project/Gemfile")

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

subject.setup
end
end

context "when the relative Gemfile does not exist" do
before do
allow(config).to receive(:exist?).
with(Pathname("/my/project/Gemfile")).and_return(false)
allow(config).to receive(:exist?)
.with(Pathname("/my/project/Gemfile")).and_return(false)

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.


allow(config).to receive(:exist?).with(Pathname("Gemfile")).
and_return(false)
allow(config).to receive(:exist?).with(Pathname("Gemfile"))

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

.and_return(false)
end

it "does not setup bundler" do
Expand Down Expand Up @@ -110,8 +112,8 @@

context "when Gemfile exists" do
before do
allow(config).to receive(:exist?).with(Pathname("Gemfile")).
and_return(true)
allow(config).to receive(:exist?).with(Pathname("Gemfile"))

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

.and_return(true)
end

it "shows a warning" do
Expand All @@ -122,8 +124,8 @@

context "when no Gemfile exists" do
before do
allow(config).to receive(:exist?).with(Pathname("Gemfile")).
and_return(false)
allow(config).to receive(:exist?).with(Pathname("Gemfile"))

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

.and_return(false)
end

it "shows no warning" do
Expand Down
6 changes: 4 additions & 2 deletions spec/lib/guard/cli/environments/bundler_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "guard/cli/environments/bundler"

# TODO: instead of shared examples, use have_received if possible
Expand All @@ -22,8 +24,8 @@
allow(ENV).to receive(:[]).with("BUNDLE_GEMFILE").and_return(gemfile)
allow(ENV).to receive(:[]).with("RUBYGEMS_GEMDEPS").and_return(gemdeps)

allow(File).to receive(:exist?).with("Gemfile").
and_return(gemfile_present)
allow(File).to receive(:exist?).with("Gemfile")

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

.and_return(gemfile_present)

subject.verify
end
Expand Down
14 changes: 8 additions & 6 deletions spec/lib/guard/cli/environments/evaluate_only_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "guard/cli/environments/evaluate_only"

RSpec.describe Guard::Cli::Environments::EvaluateOnly do
Expand Down Expand Up @@ -35,11 +37,11 @@

it "passes options to evaluator" do
evaluator_options = double("evaluator_options")
allow(session).to receive(:evaluator_options).
and_return(evaluator_options)
allow(session).to receive(:evaluator_options)
.and_return(evaluator_options)

expect(Guard::Guardfile::Evaluator).to receive(:new).
with(evaluator_options).and_return(evaluator)
expect(Guard::Guardfile::Evaluator).to receive(:new)
.with(evaluator_options).and_return(evaluator)

subject.evaluate
end
Expand All @@ -52,8 +54,8 @@
].each do |error_class|
context "when a #{error_class} error occurs" do
before do
allow(Guard).to receive(:init).
and_raise(error_class, "#{error_class} error!")
allow(Guard).to receive(:init)
.and_raise(error_class, "#{error_class} error!")
end

it "aborts" do
Expand Down
44 changes: 23 additions & 21 deletions spec/lib/guard/cli/environments/valid_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "guard/cli/environments/valid"
require "guard/cli/environments/bundler"

Expand All @@ -14,8 +16,8 @@
let(:bundler) { instance_double("Guard::Cli::Environments::Bundler") }

before do
allow(Guard::Cli::Environments::Bundler).to receive(:new).
and_return(bundler)
allow(Guard::Cli::Environments::Bundler).to receive(:new)
.and_return(bundler)

allow(bundler).to receive(:verify)
end
Expand All @@ -24,8 +26,8 @@
before do
allow(bundler).to receive(:verify)

allow(options).to receive(:[]).with(:no_bundler_warning).
and_return(false)
allow(options).to receive(:[]).with(:no_bundler_warning)
.and_return(false)
end

it "starts guard" do
Expand All @@ -52,8 +54,8 @@
].each do |error_class|
context "when a #{error_class} error occurs" do
before do
allow(Guard).to receive(:start).
and_raise(error_class, "#{error_class} error!")
allow(Guard).to receive(:start)
.and_raise(error_class, "#{error_class} error!")
end

it "aborts" do
Expand Down Expand Up @@ -150,8 +152,8 @@
end

it "Only creates the Guardfile without initializing any Guard template" do
allow(evaluator).to receive(:evaluate).
and_raise(Guard::Guardfile::Evaluator::NoGuardfileError)
allow(evaluator).to receive(:evaluate)
.and_raise(Guard::Guardfile::Evaluator::NoGuardfileError)

allow(File).to receive(:exist?).with("Gemfile").and_return(false)
expect(generator).to receive(:create_guardfile)
Expand All @@ -178,12 +180,12 @@
end

it "creates a Guardfile" do
expect(evaluator).to receive(:evaluate).
and_raise(Guard::Guardfile::Evaluator::NoGuardfileError).once
expect(evaluator).to receive(:evaluate)
.and_raise(Guard::Guardfile::Evaluator::NoGuardfileError).once
expect(evaluator).to receive(:evaluate)

expect(Guard::Guardfile::Generator).to receive(:new).
and_return(generator)
expect(Guard::Guardfile::Generator).to receive(:new)
.and_return(generator)
expect(generator).to receive(:create_guardfile)

subject.initialize_guardfile
Expand All @@ -203,30 +205,30 @@
expect(generator).to receive(:initialize_template).with("rspec")
expect(generator).to receive(:initialize_template).with("pow")

subject.initialize_guardfile(%w(rspec pow))
subject.initialize_guardfile(%w[rspec pow])
end

context "when passed a guard name" do
context "when the Guardfile is empty" do
before do
allow(evaluator).to receive(:evaluate).
and_raise Guard::Guardfile::Evaluator::NoPluginsError
allow(evaluator).to receive(:evaluate)
.and_raise Guard::Guardfile::Evaluator::NoPluginsError
allow(generator).to receive(:initialize_template)
end

it "works without without errors" do
expect(subject.initialize_guardfile(%w(rspec))).to be_zero
expect(subject.initialize_guardfile(%w[rspec])).to be_zero
end

it "adds the template" do
expect(generator).to receive(:initialize_template).with("rspec")
subject.initialize_guardfile(%w(rspec))
subject.initialize_guardfile(%w[rspec])
end
end

it "initializes the template of the passed Guard" do
expect(generator).to receive(:initialize_template).with("rspec")
subject.initialize_guardfile(%w(rspec))
subject.initialize_guardfile(%w[rspec])
end
end

Expand All @@ -236,16 +238,16 @@

context "when passed an unknown guard name" do
before do
expect(generator).to receive(:initialize_template).with("foo").
and_raise(Guard::Guardfile::Generator::NoSuchPlugin, "foo")
expect(generator).to receive(:initialize_template).with("foo")

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

.and_raise(Guard::Guardfile::Generator::NoSuchPlugin, "foo")

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

end

it "returns an exit code" do
expect(::Guard::UI).to receive(:error).with(
"Could not load 'guard/foo' or '~/.guard/templates/foo'"\
" or find class Guard::Foo\n"
)
expect(subject.initialize_guardfile(%w(foo))).to be(1)
expect(subject.initialize_guardfile(%w[foo])).to be(1)
end
end
end
Expand Down
Loading