Skip to content

Commit b01927c

Browse files
committed
Fix rubocop violations
1 parent 96e4195 commit b01927c

26 files changed

Lines changed: 110 additions & 85 deletions

.rubocop.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
inherit_from: .rubocop_todo.yml
2+
13
require: rubocop-rspec
24

35
AllCops:
46
DisplayCopNames: true
57

8+
Layout/SpaceBeforeFirstArg:
9+
Enabled: false
10+
611
## Style
712

813
Style/Documentation:
914
Enabled: false
10-
Style/SingleSpaceBeforeFirstArg:
11-
Enabled: false
12-
Style/AccessorMethodName:
13-
Enabled: false
1415
Style/SymbolArray:
1516
Enabled: false
1617
Style/SignalException:
@@ -30,32 +31,37 @@ Style/CollectionMethods:
3031
Style/TrivialAccessors:
3132
ExactNameMatch: true
3233

33-
Style/PredicateName:
34-
NamePrefix:
35-
- is_
36-
- have_
37-
NamePrefixBlacklist:
38-
- is_
39-
- have_
40-
4134
Style/StringLiterals:
4235
EnforcedStyle: double_quotes
4336

4437
## Metrics
4538

4639
Metrics/LineLength:
47-
Max: 100
40+
Max: 120
4841
Exclude:
4942
- 'spec/**/*'
5043

5144
Metrics/MethodLength:
52-
Max: 15
5345
Exclude:
5446
- 'spec/**/*'
5547

5648
Metrics/CyclomaticComplexity:
5749
Max: 10
5850

51+
Metrics/BlockLength:
52+
Exclude:
53+
- 'spec/**/*'
54+
55+
Naming/AccessorMethodName:
56+
Enabled: false
57+
Naming/PredicateName:
58+
NamePrefix:
59+
- is_
60+
- have_
61+
NamePrefixBlacklist:
62+
- is_
63+
- have_
64+
5965
## RSpec
6066

6167
RSpec/DescribeClass:
@@ -68,3 +74,11 @@ RSpec/FilePath:
6874
Enabled: false
6975
RSpec/InstanceVariable:
7076
Enabled: false
77+
RSpec/ExampleLength:
78+
Enabled: false
79+
RSpec/ContextWording:
80+
Enabled: false
81+
RSpec/MultipleExpectations:
82+
Enabled: false
83+
RSpec/ExpectActual:
84+
Enabled: false

.rubocop_todo.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2019-03-26 23:45:23 -0700 using RuboCop version 0.66.0.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 2
10+
Metrics/AbcSize:
11+
Max: 31
12+
13+
# Offense count: 1
14+
# Configuration parameters: CountComments.
15+
Metrics/ClassLength:
16+
Max: 110
17+
18+
# Offense count: 2
19+
# Configuration parameters: CountComments, ExcludedMethods.
20+
Metrics/MethodLength:
21+
Max: 24

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: ruby
22

33
rvm:
4-
- 2.0.0-p648
4+
- 2.3.7
55

66
before_install:
77
- gem update bundler

exe/mac_setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ when "install"
1313
# config_path = (ARGV - options)[0] || File.expand_path(DEFAULT_CONFIG_PATH)
1414

1515
# if File.exist?(config_path)
16-
MacSetup.install # (config_path, options)
16+
MacSetup.install # (config_path, options)
1717
# else
1818
# puts "You must specify a path to config file or create one at #{DEFAULT_CONFIG_PATH}"
1919
# end

lib/mac_setup.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ module MacSetup
2929
HomebrewRunner,
3030
ScriptInstaller,
3131
DefaultsInstaller
32-
]
32+
].freeze
3333

3434
DEFAULT_PLUGINS = [
3535
Plugins::MacAppStore,
3636
Plugins::Keybase,
3737
Plugins::Dotfiles,
3838
Plugins::Asdf
39-
]
39+
].freeze
4040

4141
class << self
4242
def bootstrap(dotfiles_repo)
@@ -48,7 +48,7 @@ def bootstrap(dotfiles_repo)
4848
plugins(config).each { |plugin| plugin.bootstrap(config) }
4949
end
5050

51-
def install # (config_path, _options)
51+
def install
5252
config = Configuration.new(DEFAULT_CONFIG_PATH)
5353

5454
Shell.raw("brew update")

lib/mac_setup/brewfile_installer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module MacSetup
55
class BrewfileInstaller
6-
BUNDLE_TAP = "homebrew/bundle"
6+
BUNDLE_TAP = "homebrew/bundle".freeze
77

88
attr_reader :config, :status
99

lib/mac_setup/command_line_tools_installer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module MacSetup
44
class CommandLineToolsInstaller
5-
BIN_PATH = "/Library/Developer/CommandLineTools/usr/bin/clang"
5+
BIN_PATH = "/Library/Developer/CommandLineTools/usr/bin/clang".freeze
66

77
def self.run
88
if File.exist?(BIN_PATH)

lib/mac_setup/configuration.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Configuration
66
InvalidConfigError = Class.new(StandardError)
77
DEFAULT_KEYS = [
88
:repo, :plugins, :git_repos, :symlinks, :taps, :brews, :fonts, :casks, :quicklook, :mas, :extra_dotfiles
9-
]
9+
].freeze
1010

1111
def initialize(config_path)
1212
@config_path = config_path
@@ -99,11 +99,9 @@ def mas
9999

100100
def add_brews(item, existing_brews = brews)
101101
existing_brews.merge!(brew_value(item)) do |key, oldval, newval|
102-
if oldval == newval
103-
oldval
104-
else
105-
raise InvalidConfigError, "#{key} is defined twice!: #{oldval}, #{newval}"
106-
end
102+
raise InvalidConfigError, "#{key} is defined twice!: #{oldval}, #{newval}" unless oldval == newval
103+
104+
oldval
107105
end
108106
end
109107

lib/mac_setup/homebrew_installer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module MacSetup
44
class HomebrewInstaller
5-
BREW_INSTALL_URL = "https://raw.githubusercontent.com/Homebrew/install/master/install"
5+
BREW_INSTALL_URL = "https://raw.githubusercontent.com/Homebrew/install/master/install".freeze
66

77
def self.run
88
if Shell.command_present?("brew")

lib/mac_setup/homebrew_runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def self.run(config, _status)
66
MacSetup.log("Installing Homebrew brews and casks") do
77
Tempfile.create("Brewfile") do |brewfile|
88
write_brewfile(config, brewfile)
9-
File.chmod(0644, brewfile)
9+
File.chmod(0o644, brewfile)
1010
brewfile.rewind
1111

1212
Shell.raw("brew bundle install --file=#{brewfile.path}")

0 commit comments

Comments
 (0)