Skip to content

Commit 34eea15

Browse files
authored
Add Rubocop
autorrect offenses (#57) Merge pull request 57
1 parent 7ac9ff2 commit 34eea15

24 files changed

+84
-10
lines changed

.rubocop.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
inherit_gem:
22
jekyll: .rubocop.yml
3+
AllCops:
4+
TargetRubyVersion: 2.2
5+
Exclude:
6+
- vendor/**/*
7+
8+
Lint/AmbiguousOperator:
9+
Exclude:
10+
- lib/jekyll/commands/draft.rb
11+
- lib/jekyll/commands/page.rb
12+
- lib/jekyll/commands/post.rb
313

414
Metrics/LineLength:
515
Exclude:
6-
- spec/**/*
716
- jekyll-compose.gemspec
17+
- lib/jekyll-compose/file_creator.rb
18+
- lib/jekyll-compose/file_mover.rb
19+
- lib/jekyll/commands/draft.rb
20+
- lib/jekyll/commands/page.rb
21+
- lib/jekyll/commands/post.rb
22+
- lib/jekyll/commands/publish.rb
23+
- lib/jekyll/commands/unpublish.rb
24+
- spec/**/*
825

926
Metrics/BlockLength:
1027
Exclude:
@@ -13,3 +30,7 @@ Metrics/BlockLength:
1330
Style/IndentHeredoc:
1431
Exclude:
1532
- spec/**/*
33+
34+
Style/GlobalVars:
35+
Exclude:
36+
- spec/spec_helper.rb

Gemfile

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
source "https://rubygems.org"
24
gemspec
35

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# frozen_string_literal: true
2+
13
require "bundler/gem_tasks"

jekyll-compose.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ Gem::Specification.new do |spec|
1919
spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) }
2020
spec.require_paths = ["lib"]
2121

22-
spec.add_dependency "jekyll", ">= 3.0.0"
22+
spec.add_dependency "jekyll", "~> 3.0"
2323

2424
spec.add_development_dependency "bundler", "~> 1.5"
2525
spec.add_development_dependency "rake", "~> 10.0"
2626
spec.add_development_dependency "rspec", "~> 3.0"
27+
spec.add_development_dependency "rubocop", "~> 0.51"
2728
end

lib/jekyll-compose.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "jekyll-compose/version"
24
require "jekyll-compose/arg_parser"
35
require "jekyll-compose/movement_arg_parser"
@@ -13,6 +15,6 @@ module Compose
1315
end
1416
end
1517

16-
%w{draft post publish unpublish page}.each do |file|
18+
%w(draft post publish unpublish page).each do |file|
1719
require File.expand_path("jekyll/commands/#{file}.rb", __dir__)
1820
end

lib/jekyll-compose/arg_parser.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
class Jekyll::Compose::ArgParser
24
attr_reader :args, :options, :config
35
def initialize(args, options)

lib/jekyll-compose/file_creator.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# frozen_string_literal: true
2+
13
module Jekyll
24
module Compose
35
class FileCreator
46
attr_reader :file, :force, :root
5-
def initialize(fileInfo, force = false, root = nil)
6-
@file = fileInfo
7+
def initialize(file_info, force = false, root = nil)
8+
@file = file_info
79
@force = force
810
@root = root
911
end

lib/jekyll-compose/file_info.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
class Jekyll::Compose::FileInfo
24
attr_reader :params
35
def initialize(params)

lib/jekyll-compose/file_mover.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 Jekyll
24
module Compose
35
class FileMover

lib/jekyll-compose/movement_arg_parser.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Jekyll
24
module Compose
35
class MovementArgParser
@@ -17,7 +19,7 @@ def path
1719
end
1820

1921
def source
20-
source = config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "")
22+
config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "")
2123
end
2224
end
2325
end

0 commit comments

Comments
 (0)