rubocop_rules 1.1.1 → 1.1.2

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: 78af4aa32c9b667e41f57877d593ad1c2e8c2dd21adadb19af2a50f61e59f0c9
4
- data.tar.gz: fe40cd13ae9a8db315fd0086d9f285451121067965176948919e69cd51839efe
3
+ metadata.gz: be00bb5e611c0b6d7c8ef1f1baacf144a7059ff367189f4bd953b656de51448e
4
+ data.tar.gz: 4c462ddf90cc19d6cab0ec9b3fadd6c66b7cd21fc4f64de246833bbac468b7f9
5
5
  SHA512:
6
- metadata.gz: f21279594a43abd08e88f97d3448d1cadee341eb88aa0ccc98b4cbb5ef70d705ff9fbca3a344bd5654f6f343941b6e8ab4d7fddb450decb3690038e69892bbec
7
- data.tar.gz: 7a089d12a091edd6a2e5cefb884e17e71ced705c05e41ff99678b32f5c154925901c10d63e583e0bd76b14e3c412903ecb8c78166588cf215fc630eb5368152f
6
+ metadata.gz: 372b60ca0732d7f97f4c6fb1343965b0267279bfe206b6de2eb5a1e839faa685edcee74775aef941e21ea5107088418a6004f49fd295d0282873cf598eeb4455
7
+ data.tar.gz: 84008f06871c873d1e3fb4a738c30e0521354c3585eda8c60573f34420b6c26de0f454e50ad4c6a72315428cf1c715b5d8012aaa0536cf79d043b4c94bd62c53
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.1
4
+ - 2.5.1
5
5
  before_install: gem install bundler -v 1.16
@@ -7,6 +7,12 @@ adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.2] - 2018-10-24
11
+
12
+ ### Fixed
13
+
14
+ * `.rubocop.yml` is generated correctly on update
15
+
10
16
  ## [1.1.1] - 2018-05-08
11
17
 
12
18
  ### Changed
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
data/README.md CHANGED
@@ -116,4 +116,4 @@ Keep this to a minimum and always consider if it belongs in .rubocop_common.yml
116
116
 
117
117
  ## Development
118
118
 
119
- Bug reports and pull requests are welcome on GitHub at https://github.com/klarna/rubocop_rules.
119
+ Bug reports and pull requests are welcome on GitHub at https://github.com/klippx/rubocop_rules.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'rubocop/rules'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
4
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubocop_rules/version'
2
4
 
3
5
  # :nodoc:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
  require 'open3'
3
5
  require 'git'
@@ -21,7 +23,7 @@ module RubocopRules
21
23
  puts RubocopRules::VERSION
22
24
  end
23
25
 
24
- desc 'init', 'Initialize RubocopRules in your project'
26
+ desc 'init', 'Initialize Rubocop Rules in your project'
25
27
  def init
26
28
  puts 'Copying config... '
27
29
  copy_file 'templates/.rubosync.yml', '.rubosync.yml'
@@ -38,7 +40,7 @@ module RubocopRules
38
40
  insert_into_file '.rubocop.yml', ' - .rubocop_todo.yml', after: " - .rubocop_common.yml\n"
39
41
  end
40
42
 
41
- desc 'update', 'Regenerate RubocopRules configuration in your project'
43
+ desc 'update', 'Regenerate Rubocop Rules configuration in your project'
42
44
  def update
43
45
  puts 'Recreating configuration...'
44
46
  ensure_rubosync_config
@@ -50,10 +52,30 @@ module RubocopRules
50
52
  comment_lines '.rubocop.yml', /\.rubocop_todo\.yml/
51
53
  generate_todo(silent: true)
52
54
  uncomment_lines '.rubocop.yml', /\.rubocop_todo\.yml/
55
+ clean_up_rubocop_config
53
56
  end
54
57
 
55
58
  private
56
59
 
60
+ def clean_up_rubocop_config
61
+ gsub_file '.rubocop.yml', all_inherit_lines_rex, ''
62
+ insert_into_file '.rubocop.yml', todo_string_block, after: "# our violation whitelist.\n"
63
+ gsub_file '.rubocop.yml', /^ - .rubocop_common.yml\n+/, " - .rubocop_common.yml\n\n"
64
+ end
65
+
66
+ def all_inherit_lines_rex
67
+ /(^inherit_from:\n)|(^ - .rubocop_common.yml\n+)|(^ - .rubocop_todo.yml\n+)/
68
+ end
69
+
70
+ def todo_string_block
71
+ <<~TODO
72
+ inherit_from:
73
+ - .rubocop_todo.yml
74
+ - .rubocop_common.yml
75
+
76
+ TODO
77
+ end
78
+
57
79
  def generate_todo(silent: false)
58
80
  run_process(command: 'rubocop -a', silent: silent)
59
81
  run_process(command: 'rubocop --auto-gen-config', silent: silent)
@@ -63,6 +85,7 @@ module RubocopRules
63
85
  unless File.exist?('.rubosync.yml')
64
86
  raise 'Missing configuration file! Please add and configure .rubosync.yml'
65
87
  end
88
+
66
89
  @config = YAML.safe_load(ERB.new(File.read('.rubosync.yml')).result, [], [], true)
67
90
  end
68
91
 
@@ -70,6 +93,7 @@ module RubocopRules
70
93
  unless @config && @config['git'] && @config['git']['repo']
71
94
  raise 'Missing git repo in configuration! Please configure .rubosync.yml'
72
95
  end
96
+
73
97
  repo = @config['git']['repo']
74
98
 
75
99
  puts "Downloading latest configuration from #{repo}..."
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RubocopRules
2
- VERSION = '1.1.1'.freeze
4
+ VERSION = '1.1.2'
3
5
  end
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'rubocop_rules/version'
5
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Klippinge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-08 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -109,6 +109,7 @@ files:
109
109
  - ".rspec"
110
110
  - ".rubocop.yml"
111
111
  - ".rubocop_common.yml"
112
+ - ".ruby-version"
112
113
  - ".travis.yml"
113
114
  - CHANGELOG.md
114
115
  - Gemfile