Skip to content

Commit 53a421c

Browse files
Update rubocop and rspec. Rubocop fixes
1 parent a5db88c commit 53a421c

10 files changed

+32
-19
lines changed

.rubocop_todo.yml

+23-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2015-10-29 13:19:55 -0500 using RuboCop version 0.34.1.
3+
# on 2017-12-29 15:04:25 +0000 using RuboCop version 0.52.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 3
10-
# Configuration parameters: AllowURI, URISchemes.
11-
Metrics/LineLength:
12-
Max: 91
9+
# Offense count: 1
10+
Metrics/AbcSize:
11+
Max: 19
1312

1413
# Offense count: 1
15-
# Configuration parameters: Exclude.
16-
Style/FileName:
14+
# Configuration parameters: CountComments.
15+
Metrics/MethodLength:
16+
Max: 31
17+
18+
# Offense count: 1
19+
Naming/AccessorMethodName:
20+
Exclude:
21+
- 'spec/support/static_file_server.rb'
22+
23+
# Offense count: 1
24+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
25+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
26+
Naming/FileName:
1727
Exclude:
1828
- 'lib/critical-path-css-rails.rb'
29+
30+
# Offense count: 4
31+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
32+
# URISchemes: http, https
33+
Metrics/LineLength:
34+
Max: 96

critical-path-css-rails.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
1414
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
1515
s.require_path = 'lib'
1616

17-
s.add_development_dependency 'rspec', '~> 3.6'
17+
s.add_development_dependency 'rspec', '~> 3.7'
1818

1919
s.extensions = ['ext/npm/extconf.rb']
2020
end

ext/npm/extconf.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
File.write 'Makefile',
22
"make:\n\t\ninstall:\n\truby install.rb\nclean:\n\t\n"
3-

lib/critical-path-css-rails.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'critical_path_css/rails/config_loader'
44

55
module CriticalPathCss
6-
CACHE_NAMESPACE = 'critical-path-css'
6+
CACHE_NAMESPACE = 'critical-path-css'.freeze
77

88
def self.generate(route)
99
::Rails.cache.write(

lib/critical_path_css/configuration.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'erb'
22
module CriticalPathCss
33
class Configuration
4-
54
def initialize(config)
65
@config = config
76
end

lib/critical_path_css/css_fetcher.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def css_for_route(route)
3333
# '^\.regexWorksToo'
3434
],
3535
# ms; abort critical CSS generation after this timeout
36-
'timeout' => 30000,
36+
'timeout' => 30_000,
3737
# set to true to throw on CSS errors (will run faster if no errors)
3838
'strict' => false,
3939
# characters; strip out inline base64 encoded resources larger than this

lib/critical_path_css/rails/config_loader.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module CriticalPathCss
22
module Rails
33
class ConfigLoader
4-
CONFIGURATION_FILENAME = 'critical_path_css.yml'
4+
CONFIGURATION_FILENAME = 'critical_path_css.yml'.freeze
55

66
def load
7-
config = YAML.load(ERB.new(File.read(configuration_file_path)).result)[::Rails.env]
7+
config = YAML.safe_load(ERB.new(File.read(configuration_file_path)).result)[::Rails.env]
88
config['css_path'] = "#{::Rails.root}/public" + (
99
config['css_path'] ||
1010
ActionController::Base.helpers.stylesheet_path(
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module CriticalPathCSS
22
module Rails
3-
VERSION = '1.0.1'
3+
VERSION = '1.0.1'.freeze
44
end
55
end

lib/npm_commands.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
# NPM wrapper with helpful error messages
44
class NpmCommands
5-
65
# @return [Boolean] whether the installation succeeded
7-
def install(*args) # rubocop:disable Metrics/MethodLength
6+
def install(*args)
87
return false unless check_nodejs_installed
98
STDERR.puts 'Installing npm dependencies...'
109
install_status = Dir.chdir File.expand_path('..', File.dirname(__FILE__)) do
@@ -24,7 +23,7 @@ def install(*args) # rubocop:disable Metrics/MethodLength
2423

2524
private
2625

27-
def check_nodejs_installed # rubocop:disable Metrics/MethodLength
26+
def check_nodejs_installed
2827
return true if executable?('node')
2928
STDERR.puts(
3029
'-' * 60,

spec/support/static_file_server.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module StaticFileServer
44
class << self
5-
def start # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
5+
def start
66
@port = get_free_port
77
rd, wt = IO.pipe
88
@pid = fork do

0 commit comments

Comments
 (0)