Skip to content

Commit 409c849

Browse files
committed
Add rubocop as a check on Travis
1 parent 1ec8b37 commit 409c849

12 files changed

Lines changed: 52 additions & 27 deletions

File tree

.rubocop.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
---
22
inherit_from: .hound.yml
33

4+
Metrics/BlockLength:
5+
Exclude:
6+
- spec/**/*
7+
- lib/tasks/**/*
8+
49
AllCops:
510
Exclude:
611
- spec/dummy/**/*

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ before_install:
77
- gem install bundler
88
rvm:
99
- 2.5
10+
script:
11+
- bundle exec rubocop
12+
- bundle exec rake

Gemfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
source "https://rubygems.org"
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
24

35
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
4-
gem "solidus", github: "solidusio/solidus", branch: branch
6+
gem 'solidus', github: 'solidusio/solidus', branch: branch
57

68
if ENV['DB'] == 'mysql'
79
gem 'mysql2', '~> 0.4.10'
@@ -10,8 +12,8 @@ else
1012
end
1113

1214
group :development, :test do
13-
gem "pry-rails"
1415
gem 'i18n-tasks', '~> 0.9' if branch == 'master'
16+
gem 'pry-rails'
1517
end
1618

1719
gemspec

Rakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler'
24
Bundler::GemHelper.install_tasks
35

46
require 'rspec/core/rake_task'
57
RSpec::Core::RakeTask.new
68

79
task :default do
8-
if Dir["spec/dummy"].empty?
10+
if Dir['spec/dummy'].empty?
911
Rake::Task[:test_app].invoke
10-
Dir.chdir("../../")
12+
Dir.chdir('../../')
1113
end
1214
Rake::Task[:spec].invoke
1315
end
@@ -24,12 +26,10 @@ namespace :solidus_i18n do
2426
desc 'Update by retrieving the latest Solidus locale files'
2527
task :update_default do
2628
require 'open-uri'
27-
puts "Fetching latest Solidus locale file"
29+
puts 'Fetching latest Solidus locale file'
2830
location = 'https://raw.github.com/solidusio/solidus/master/core/config/locales/en.yml'
2931

30-
open("#{locales_dir}/en.yml", 'wb') do |file|
31-
file << open(location).read
32-
end
32+
File.write("#{locales_dir}/en.yml", URI.parse(location).read)
3333
end
3434

3535
def locales_dir

config/routes.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
Spree::Core::Engine.routes.draw do
24
end

lib/solidus_i18n.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'solidus_core'
24
require 'solidus_i18n/engine'
35
require 'solidus_i18n/version'

lib/solidus_i18n/engine.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module SolidusI18n
24
class Engine < Rails::Engine
35
engine_name 'solidus_i18n'

lib/solidus_i18n/version.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module SolidusI18n
24
module_function
35

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# frozen_string_literal: true
2+
13
require 'fileutils'
24

35
namespace :solidus_i18n do
46
desc 'Upgrades to version without globalize.'
57
task upgrade: :environment do
6-
files = %w(
8+
files = %w[
79
add_translations_to_main_models
810
add_translations_to_product_permalink
911
add_translations_to_option_value
@@ -13,7 +15,7 @@ namespace :solidus_i18n do
1315
remove_null_constraints_from_spree_tables
1416
add_deleted_at_to_translation_tables
1517
add_translations_to_store
16-
).collect do |file_name|
18+
].collect do |file_name|
1719
Dir.glob Rails.root.join('db', 'migrate', "*_#{file_name}*.rb")
1820
end.flatten
1921

@@ -23,21 +25,21 @@ namespace :solidus_i18n do
2325
# Install new migrations
2426
Rake::Task['solidus_i18n:install:migrations'].invoke
2527

26-
puts <<-DESC
27-
Upgraded migrations successfully.
28+
puts <<~DESC
29+
Upgraded migrations successfully.
2830
29-
Now please remove these lines from your vendor/assets folder:
31+
Now please remove these lines from your vendor/assets folder:
3032
31-
From `vendor/assets/javascripts/spree/backend/all.js`
33+
From `vendor/assets/javascripts/spree/backend/all.js`
3234
33-
//= require spree/backend/spree_i18n
35+
//= require spree/backend/spree_i18n
3436
35-
and from `vendor/assets/stylesheets/spree/backend/all.css`
37+
and from `vendor/assets/stylesheets/spree/backend/all.css`
3638
37-
*= require spree/backend/spree_i18n
39+
*= require spree/backend/spree_i18n
3840
39-
Don't forget to run `rake db:migrate` now.
41+
Don't forget to run `rake db:migrate` now.
4042
41-
DESC
43+
DESC
4244
end
4345
end

solidus_i18n.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# coding: utf-8
2-
lib = File.expand_path('../lib/', __FILE__)
1+
# frozen_string_literal: true
2+
3+
lib = File.expand_path('lib', __dir__)
34
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
45

56
require 'solidus_i18n/version'
@@ -24,8 +25,8 @@ Gem::Specification.new do |s|
2425
s.add_runtime_dependency 'solidus_core', ['>= 1.1', '< 3']
2526

2627
s.add_development_dependency 'pry-rails', '>= 0.3.0'
27-
s.add_development_dependency 'rubocop', '>= 0.24.1'
2828
s.add_development_dependency 'rspec-rails', '~> 3.1'
29+
s.add_development_dependency 'rubocop', '0.67.2'
2930
s.add_development_dependency 'simplecov', '~> 0.9'
3031
s.add_development_dependency 'sqlite3', '~> 1.3.6'
3132
end

0 commit comments

Comments
 (0)