rubocop-git 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbcc847050e43ef716838ab44ac90c7b49e21c0f
4
- data.tar.gz: f2247c420ef864bb7380228da7996815487d7e8e
3
+ metadata.gz: 95a1517031e3e4f7a255e11f6b3aa60cf0173af9
4
+ data.tar.gz: f50c1fd2638d7514a642888080d8c9fb49ff106f
5
5
  SHA512:
6
- metadata.gz: 80e814265a952def43f0fda8b419dd0889831c3a23d6375712fa2053bf79fa4b489f9db66eb57e838a69b72810460f1e956024b00341f05a9078fa973e64bf92
7
- data.tar.gz: d19768c12c7248cd5f547df64c4e758ad4284119297c38c86095fc55fef2851fa43c303d3e2f2489f6319ad142cefccb59c5a2e4afc40aa16bc8a6abb3200c1b
6
+ metadata.gz: 301ea08e20d5921bfc482af24f354aa5a62d24126a7fc4befcc59194b4f89c5e80ab27a7b4f99825570d0fc77a0cd603417eab614c762dbb45eddc73ed770d42
7
+ data.tar.gz: f0afdf529d69b4f977bde6f85f36f1d7ec3e26838d028b5dbe892073cc30909d14b9e9c4adc59cca77f2d384e49832c343a32af32be0f7a8de3017f4b19d5ef0
data/.gitignore CHANGED
@@ -1,22 +1,11 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ /gemfiles/*.gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,19 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ gemfile:
5
+ - gemfiles/0.24.gemfile
6
+ - gemfiles/0.25.gemfile
7
+ - gemfiles/0.26.gemfile
8
+ - gemfiles/0.27.gemfile
9
+ - gemfiles/0.28.gemfile
10
+ - gemfiles/0.29.gemfile
11
+ - gemfiles/0.30.gemfile
12
+ - gemfiles/0.31.gemfile
13
+ - gemfiles/0.32.gemfile
14
+ - gemfiles/0.33.gemfile
15
+ - gemfiles/0.34.gemfile
16
+ - gemfiles/0.35.gemfile
17
+ - gemfiles/0.36.gemfile
18
+ - gemfiles/0.37.gemfile
19
+ before_install: gem install bundler -v 1.11.2
data/Appraisals ADDED
@@ -0,0 +1,20 @@
1
+ %w(
2
+ 0.24.1
3
+ 0.25.0
4
+ 0.26.1
5
+ 0.27.1
6
+ 0.28.0
7
+ 0.29.1
8
+ 0.30.1
9
+ 0.31.0
10
+ 0.32.1
11
+ 0.33.0
12
+ 0.34.2
13
+ 0.35.1
14
+ 0.36.0
15
+ 0.37.0
16
+ ).each do |version|
17
+ appraise version[/\d+\.\d+/] do
18
+ gem 'rubocop', version
19
+ end
20
+ end
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  RuboCop for git diff.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/rubocop-git.svg)](http://badge.fury.io/rb/rubocop-git)
6
+ [![Build Status](https://travis-ci.org/m4i/rubocop-git.svg?branch=master)](https://travis-ci.org/m4i/rubocop-git)
6
7
  [![Code Climate](https://codeclimate.com/github/m4i/rubocop-git.png)](https://codeclimate.com/github/m4i/rubocop-git)
7
8
 
8
9
  ## Installation
data/Rakefile CHANGED
@@ -1 +1,15 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'appraisal'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'test'
7
+ t.libs << 'lib'
8
+ t.test_files = FileList['test/**/*_test.rb']
9
+ end
10
+
11
+ if ENV['APPRAISAL_INITIALIZED'] || ENV['TRAVIS']
12
+ task default: :test
13
+ else
14
+ task default: :appraisal
15
+ end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.24.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.25.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.26.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.27.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.28.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.29.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.30.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.31.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.32.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.33.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.34.2"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.35.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.36.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rubocop", "0.37.0"
6
+
7
+ gemspec :path => "../"
@@ -72,7 +72,8 @@ module RuboCop
72
72
  def from_hash(hash_options)
73
73
  hash_options = hash_options.dup
74
74
  %w(config cached hound rubocop commits).each do |key|
75
- public_send("#{key}=", hash_options.delete(key))
75
+ value = hash_options.delete(key) || hash_options.delete(key.to_sym)
76
+ public_send("#{key}=", value)
76
77
  end
77
78
  unless hash_options.empty?
78
79
  fail Invalid, "invalid keys: #{hash_options.keys.join(' ')}"
@@ -11,7 +11,7 @@ module RuboCop
11
11
  @files = DiffParser.parse(git_diff(options))
12
12
 
13
13
  display_violations($stdout)
14
-
14
+
15
15
  exit(1) if violations.any?
16
16
  end
17
17
 
@@ -29,7 +29,12 @@ class StyleGuide
29
29
  end
30
30
 
31
31
  def parse_source(file)
32
- RuboCop::ProcessedSource.new(file.content)
32
+ if Gem::Version.new(RuboCop::Version::STRING) < Gem::Version.new('0.36.0')
33
+ RuboCop::ProcessedSource.new(file.content, file.filename)
34
+ else
35
+ RuboCop::ProcessedSource.new(file.content,
36
+ target_ruby_version, file.filename)
37
+ end
33
38
  end
34
39
 
35
40
  def config
@@ -61,5 +66,20 @@ class StyleGuide
61
66
  {}
62
67
  end
63
68
  end
69
+
70
+ def target_ruby_version
71
+ @target ||= begin
72
+ target = config['AllCops'] && config['AllCops']['TargetRubyVersion']
73
+
74
+ if !target || !RuboCop::Config::KNOWN_RUBIES.include?(target)
75
+ fail ValidationError, "Unknown Ruby version #{target.inspect} found " \
76
+ 'in `TargetRubyVersion` parameter (in ' \
77
+ "#{loaded_path}).\nKnown versions: " \
78
+ "#{RuboCop::Config::KNOWN_RUBIES.join(', ')}"
79
+ end
80
+
81
+ target
82
+ end
83
+ end
64
84
  end
65
85
  end
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module Git
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
data/rubocop-git.gemspec CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'minitest'
24
+ spec.add_development_dependency 'appraisal'
23
25
 
24
26
  spec.add_dependency 'rubocop', '>= 0.24.1'
25
27
  end
@@ -0,0 +1,12 @@
1
+ require_relative '../../test_helper'
2
+ require 'rubocop/git/cli'
3
+
4
+ describe RuboCop::Git::CLI do
5
+ it 'fail with invalid options' do
6
+ proc do
7
+ _out, _err = capture_io do
8
+ RuboCop::Git::CLI.new.run(['--gruß'])
9
+ end
10
+ end.must_raise(SystemExit)
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../../test_helper'
2
+ require 'rubocop/git/options'
3
+
4
+ describe RuboCop::Git::Options do
5
+ it 'fail with no options' do
6
+ proc do
7
+ RuboCop::Git::Options.new({})
8
+ end.must_raise(RuboCop::Git::Options::Invalid)
9
+ end
10
+
11
+ it 'can pass string hash options' do
12
+ RuboCop::Git::Options.new('rubocop' => {}, 'commits' => [])
13
+ end
14
+
15
+ it 'can pass symbol hash options' do
16
+ RuboCop::Git::Options.new(rubocop: {}, commits: [])
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../../test_helper'
2
+ require 'rubocop/git/runner'
3
+
4
+ describe RuboCop::Git::Runner do
5
+ it 'exit with violations' do
6
+ options = RuboCop::Git::Options.new
7
+ # lib/rubocop/git/runner.rb:14:1: C: Trailing whitespace detected.
8
+ options.commits = ["v0.0.4", "v0.0.5"]
9
+ proc do
10
+ _out, _err = capture_io do
11
+ RuboCop::Git::Runner.new.run(options)
12
+ end
13
+ end.must_raise(SystemExit)
14
+ end
15
+
16
+ it 'fail with no options' do
17
+ proc do
18
+ _out, _err = capture_io do
19
+ RuboCop::Git::Runner.new.run({})
20
+ end
21
+ end.must_raise(RuboCop::Git::Options::Invalid)
22
+ end
23
+ end
@@ -0,0 +1,2 @@
1
+ require 'minitest/autorun'
2
+ require 'rubocop/git'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Takeuchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-19 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: appraisal
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rubocop
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -61,11 +89,27 @@ extensions: []
61
89
  extra_rdoc_files: []
62
90
  files:
63
91
  - ".gitignore"
92
+ - ".travis.yml"
93
+ - Appraisals
64
94
  - Gemfile
65
95
  - LICENSE.txt
66
96
  - README.md
67
97
  - Rakefile
68
98
  - bin/rubocop-git
99
+ - gemfiles/0.24.gemfile
100
+ - gemfiles/0.25.gemfile
101
+ - gemfiles/0.26.gemfile
102
+ - gemfiles/0.27.gemfile
103
+ - gemfiles/0.28.gemfile
104
+ - gemfiles/0.29.gemfile
105
+ - gemfiles/0.30.gemfile
106
+ - gemfiles/0.31.gemfile
107
+ - gemfiles/0.32.gemfile
108
+ - gemfiles/0.33.gemfile
109
+ - gemfiles/0.34.gemfile
110
+ - gemfiles/0.35.gemfile
111
+ - gemfiles/0.36.gemfile
112
+ - gemfiles/0.37.gemfile
69
113
  - hound.yml
70
114
  - lib/rubocop/git.rb
71
115
  - lib/rubocop/git/cli.rb
@@ -83,6 +127,10 @@ files:
83
127
  - lib/rubocop/git/style_guide.rb
84
128
  - lib/rubocop/git/version.rb
85
129
  - rubocop-git.gemspec
130
+ - test/rubocop/git/cli_test.rb
131
+ - test/rubocop/git/options_test.rb
132
+ - test/rubocop/git/runner_test.rb
133
+ - test/test_helper.rb
86
134
  homepage: https://github.com/m4i/rubocop-git
87
135
  licenses:
88
136
  - MIT
@@ -103,8 +151,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
151
  version: '0'
104
152
  requirements: []
105
153
  rubyforge_project:
106
- rubygems_version: 2.2.2
154
+ rubygems_version: 2.5.1
107
155
  signing_key:
108
156
  specification_version: 4
109
157
  summary: RuboCop for git diff.
110
- test_files: []
158
+ test_files:
159
+ - test/rubocop/git/cli_test.rb
160
+ - test/rubocop/git/options_test.rb
161
+ - test/rubocop/git/runner_test.rb
162
+ - test/test_helper.rb