rubocop_challenger 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c24828f82d19869be8ae26ca02b4fefa28ad04f9c6f79ebb572e2a7ecd4f53f
4
- data.tar.gz: da89b53d2c43b5ae8f2e0823646b1c1286c1426d865d19864ecfea7d1da84f0d
3
+ metadata.gz: 77bde4ee7a301ae854cd5e1a71d5a0e31f11ed1ebe4d3c2c99e0f56e2711ff6c
4
+ data.tar.gz: cb3a66ec8189001a93c2146cad85339c6d1cbc8c5878ea13913c4524928cceea
5
5
  SHA512:
6
- metadata.gz: a33f4986067cb9dbfb94db0659954ef62c66c3ee215db3296a45991ae55b7c632295672a027534ed13224d18756d88eb287ed56a10059541367fdd676e405ce9
7
- data.tar.gz: 5b798f4cd53a3a9c3eb9cbf1dc45169d4c9c2e8785b15a23a2609cfdf9fff12920f559fecb5c62314f7d1951a40aa71c84177c3fd96b075f284211389f3f8dc9
6
+ metadata.gz: e472c3f77937e3abf231c5ced85dc9de15ac3a3e76ea486abdfdfbd129efbf75951b39cc96eeb1e3b650ed753fc6ff83d3e21977a00c6439e76e0a99b4e88420
7
+ data.tar.gz: ee1848b91fe5d5ec7d0a314ca06d8003532e24d24eb5509fdaebe0a8283baeab574d2f100883fb4d23048e5a4ceca772e1b48537727ff325cf8024c8ed9b7cb0
data/.rubocop.yml CHANGED
@@ -4,3 +4,7 @@ inherit_from: .rubocop_todo.yml
4
4
 
5
5
  AllCops:
6
6
  TargetRubyVersion: 2.3
7
+
8
+ Metrics/BlockLength:
9
+ Exclude:
10
+ - 'spec/**/*'
data/.rubocop_todo.yml CHANGED
@@ -1,45 +1,7 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-10-28 23:30:18 +0000 using RuboCop version 0.60.0.
3
+ # on 2018-11-01 12:15:38 +0900 using RuboCop version 0.60.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 7
10
- # Configuration parameters: CountComments, ExcludedMethods.
11
- # ExcludedMethods: refine
12
- Metrics/BlockLength:
13
- Max: 112
14
-
15
- # Offense count: 2
16
- # Configuration parameters: Max.
17
- RSpec/ExampleLength:
18
- Exclude:
19
- - 'spec/rubocop_challenger/rubocop/todo_reader_spec.rb'
20
-
21
- # Offense count: 9
22
- Style/Documentation:
23
- Exclude:
24
- - 'spec/**/*'
25
- - 'test/**/*'
26
- - 'lib/rubocop_challenger/cli.rb'
27
- - 'lib/rubocop_challenger/github/pr_template.rb'
28
- - 'lib/rubocop_challenger/rubocop/challenge.rb'
29
- - 'lib/rubocop_challenger/rubocop/command.rb'
30
- - 'lib/rubocop_challenger/rubocop/rule.rb'
31
- - 'lib/rubocop_challenger/rubocop/todo_reader.rb'
32
- - 'lib/rubocop_challenger/rubocop/todo_writer.rb'
33
- - 'lib/rubocop_challenger/rubocop/yardoc.rb'
34
-
35
- # Offense count: 1
36
- # Cop supports --auto-correct.
37
- Style/MutableConstant:
38
- Exclude:
39
- - 'bin/create_release_pr'
40
-
41
- # Offense count: 7
42
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
43
- # URISchemes: http, https
44
- Metrics/LineLength:
45
- Max: 87
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop_challenger (0.5.0)
4
+ rubocop_challenger (0.5.1)
5
5
  pr-daikou (~> 0.2.0)
6
6
  rubocop
7
7
  rubocop-rspec
@@ -12,8 +12,16 @@ GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
14
  ast (2.4.0)
15
+ coveralls (0.8.22)
16
+ json (>= 1.8, < 3)
17
+ simplecov (~> 0.16.1)
18
+ term-ansicolor (~> 1.3)
19
+ thor (~> 0.19.4)
20
+ tins (~> 1.6)
15
21
  diff-lcs (1.3)
22
+ docile (1.3.1)
16
23
  jaro_winkler (1.5.1)
24
+ json (2.1.0)
17
25
  parallel (1.12.1)
18
26
  parser (2.5.3.0)
19
27
  ast (~> 2.4.0)
@@ -47,7 +55,15 @@ GEM
47
55
  rubocop-rspec (1.30.0)
48
56
  rubocop (>= 0.58.0)
49
57
  ruby-progressbar (1.10.0)
50
- thor (0.20.0)
58
+ simplecov (0.16.1)
59
+ docile (~> 1.1)
60
+ json (>= 1.8, < 3)
61
+ simplecov-html (~> 0.10.0)
62
+ simplecov-html (0.10.2)
63
+ term-ansicolor (1.6.0)
64
+ tins (~> 1.0)
65
+ thor (0.19.4)
66
+ tins (1.17.0)
51
67
  unicode-display_width (1.4.0)
52
68
  yard (0.9.16)
53
69
 
@@ -56,6 +72,7 @@ PLATFORMS
56
72
 
57
73
  DEPENDENCIES
58
74
  bundler (~> 1.16)
75
+ coveralls
59
76
  rake (~> 10.0)
60
77
  rspec
61
78
  rspec_junit_formatter
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rubocop Challenger
2
2
 
3
- [![CircleCI](https://circleci.com/gh/ryz310/rubocop_challenger/tree/master.svg?style=svg&circle-token=cdf0ffce5b4c0c7804b50dde00ca5ef09cbadb67)](https://circleci.com/gh/ryz310/rubocop_challenger/tree/master) [![Gem Version](https://badge.fury.io/rb/rubocop_challenger.svg)](https://badge.fury.io/rb/rubocop_challenger) [![Waffle.io - Columns and their card count](https://badge.waffle.io/ryz310/rubocop_challenger.svg?columns=all)](https://waffle.io/ryz310/rubocop_challenger)
3
+ [![CircleCI](https://circleci.com/gh/ryz310/rubocop_challenger/tree/master.svg?style=svg&circle-token=cdf0ffce5b4c0c7804b50dde00ca5ef09cbadb67)](https://circleci.com/gh/ryz310/rubocop_challenger/tree/master) [![Gem Version](https://badge.fury.io/rb/rubocop_challenger.svg)](https://badge.fury.io/rb/rubocop_challenger) [![Coverage Status](https://coveralls.io/repos/github/ryz310/rubocop_challenger/badge.svg?branch=master)](https://coveralls.io/github/ryz310/rubocop_challenger?branch=Install-coveralls) [![Waffle.io - Columns and their card count](https://badge.waffle.io/ryz310/rubocop_challenger.svg?columns=all)](https://waffle.io/ryz310/rubocop_challenger)
4
4
 
5
5
  If you introduce [`rubocop`](https://github.com/rubocop-hq/rubocop) to an existing Rails project later, you will use [`$ rubocop --auto-gen-config`](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#automatically-generated-configuration). But it will make a huge `.rubocop_todo.yml` and make you despair.
6
6
  On the other hand, `rubocop` has [`--auto-correct`](https://github.com/rubocop-hq/rubocop/blob/master/manual/basic_usage.md#other-useful-command-line-flags) option, it is possible to automatically repair the writing which does not conform to the rule. But since it occasionally destroys your code, it is quite dangerous to apply all at once.
@@ -15,7 +15,7 @@ def exist_uncommitted_modify?
15
15
  `git add -n .; git diff --name-only` != ''
16
16
  end
17
17
 
18
- VERSION_FORMAT = /\A\d+\.\d+\.\d+\z/
18
+ VERSION_FORMAT = /\A\d+\.\d+\.\d+\z/.freeze
19
19
  version = ARGV[0]
20
20
 
21
21
  # Verifying
data/challenger.gemspec CHANGED
@@ -15,10 +15,8 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = 'https://github.com/ryz310/rubocop_challenger'
16
16
  spec.license = 'MIT'
17
17
 
18
- # Specify which files should be added to the gem when it is released.
19
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
18
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
22
20
  end
23
21
  spec.bindir = 'exe'
24
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -31,6 +29,7 @@ Gem::Specification.new do |spec|
31
29
  spec.add_runtime_dependency 'yard'
32
30
 
33
31
  spec.add_development_dependency 'bundler', '~> 1.16'
32
+ spec.add_development_dependency 'coveralls'
34
33
  spec.add_development_dependency 'rake', '~> 10.0'
35
34
  spec.add_development_dependency 'rspec'
36
35
  spec.add_development_dependency 'rspec_junit_formatter'
@@ -3,8 +3,9 @@
3
3
  require 'thor'
4
4
 
5
5
  module RubocopChallenger
6
+ # To define CLI commands
6
7
  class CLI < Thor
7
- desc 'go', 'Run `$ rubocop --auto-correct` and create PR to your GitHub repository'
8
+ desc 'go', 'Run `$ rubocop --auto-correct` and create PR to GitHub repo'
8
9
  option :email,
9
10
  required: true,
10
11
  type: :string,
@@ -28,7 +29,8 @@ module RubocopChallenger
28
29
  type: :string,
29
30
  default: 'most_occurrence',
30
31
  desc: 'Mode to select deletion target. ' \
31
- 'You can choice "most_occurrence", "least_occurrence", or "random"'
32
+ 'You can choice "most_occurrence", "least_occurrence", ' \
33
+ 'or "random"'
32
34
  option :base,
33
35
  type: :string,
34
36
  default: 'master',
@@ -60,9 +62,9 @@ module RubocopChallenger
60
62
  puts RubocopChallenger::VERSION
61
63
  end
62
64
 
65
+ # Workaround to return exit code 1 when an error occurs
66
+ # @see https://github.com/erikhuda/thor/issues/244
63
67
  module ClassMethods
64
- # Workaround to return exit code 1 when an error occurs
65
- # @see https://github.com/erikhuda/thor/issues/244
66
68
  def exit_on_failure?
67
69
  true
68
70
  end
@@ -2,9 +2,10 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Github
5
+ # To generate Pull Request template as markdown
5
6
  class PrTemplate
6
7
  def initialize(rule, template_path = nil)
7
- template_path ||= File.expand_path('../../templates/default.md.erb', __dir__)
8
+ template_path ||= default_template_path
8
9
  @template = File.read(template_path)
9
10
  @rule = rule
10
11
  @yardoc = Rubocop::Yardoc.new(title)
@@ -21,6 +22,10 @@ module RubocopChallenger
21
22
 
22
23
  attr_reader :template, :rule, :yardoc
23
24
 
25
+ def default_template_path
26
+ File.expand_path('../../templates/default.md.erb', __dir__)
27
+ end
28
+
24
29
  def title
25
30
  rule.title
26
31
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Rubocop
5
+ # To execute Rubocop Challenge flow
5
6
  class Challenge
6
7
  def self.exec(file_path, mode)
7
8
  new(file_path, mode).send(:exec)
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Rubocop
5
+ # To execute rubocop gem command (Mainly for mock when testing)
5
6
  class Command
6
7
  def auto_correct
7
8
  `bundle exec rubocop --auto-correct || true`
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Rubocop
5
+ # Parse rubocop rule which loaded from Rubocop::TodoReader class
5
6
  class Rule
6
7
  include Comparable
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Rubocop
5
+ # To read `.rubocop_todo.yml` and parse each rules
5
6
  class TodoReader
6
7
  def initialize(rubocop_todo_file_path)
7
8
  @rubocop_todo_file_path = rubocop_todo_file_path
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Rubocop
5
+ # To edit `.rubocop_todo.yml`
5
6
  class TodoWriter
6
7
  def initialize(source, destination = source)
7
8
  @source = source
@@ -10,7 +11,8 @@ module RubocopChallenger
10
11
 
11
12
  def delete_rule(rubocop_rule)
12
13
  current_data = File.read(source)
13
- File.write(destination, current_data.sub("\n#{rubocop_rule.contents}", ''))
14
+ contents = current_data.sub("\n#{rubocop_rule.contents}", '')
15
+ File.write(destination, contents)
14
16
  end
15
17
 
16
18
  private
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Rubocop
5
+ # To read YARD style documentation from rubocop gem source code
5
6
  class Yardoc
6
7
  def initialize(title)
7
8
  @cop_class = Object.const_get("RuboCop::Cop::#{title.sub('/', '::')}")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopChallenger
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_challenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryosuke_sato
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2018-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pr-daikou
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.16'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rake
99
113
  requirement: !ruby/object:Gem::Requirement