datarockets-style 1.2.0 → 1.3.0

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: 16590c13f8a15d26842216bb4c0b411c9431a177b7d81b32b9e7a074257b4cf5
4
- data.tar.gz: 440e87351bf3e6900d114650fede11f1ab68b2ba5f1d72fe6e599758fec6f346
3
+ metadata.gz: 6270a40b4ee5b048f1e8df9b7771556a66cc0ff086b9e5198e1b2b2220d99113
4
+ data.tar.gz: e1d537d012304fdcf3d0439d8fa36625823da85930e31304ffa8f1ff4b839f91
5
5
  SHA512:
6
- metadata.gz: be32cf2f4da3c94b9e532bfd0e0a2f0d416200ebc5d2992fdb3ff223b9b9603dd4f78ff198640c4500964cda5f82b93b5484694c909371d53bea2cd185356c0a
7
- data.tar.gz: b0120bd764544c9fe6458b981f3b5174d96eaed7980ea29b8ca4b73065b8794225ab832478ee0c7666a1b4ae13908e17d403f30351c80fdd9ec17a4ef6247d49
6
+ metadata.gz: 67361be1894556117a361d9d2a7f5f82be094d61c5b16df15f2248fd5f41c7f669b6a864415d153d94cf3c94002f0bf936a3accb55c3fb765054a36c2a364c55
7
+ data.tar.gz: 5da0e3a48096c6189decf5692f0d3a258cd572310ccd2553edbc713c97a727e25bd785e4dec621f712a6fa048065fa79cf334815b3642e84acbb9961980cbd89
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@ inherit_mode:
7
7
  - Exclude
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: 2.4
10
+ TargetRubyVersion: 2.6
11
11
 
12
12
  # for checking cops with interpolation
13
13
  Lint/InterpolationCheck:
data/CHANGELOG.md CHANGED
@@ -4,7 +4,32 @@ The format is described in [Contributing notes](CONTRIBUTING.md#changelog-entry-
4
4
 
5
5
  ## master
6
6
 
7
- ## 1.2.0
7
+ ## 1.3.0 (2022-12-02)
8
+
9
+ ### Added
10
+
11
+ * [#261](https://github.com/datarockets/ruby-style/issues/261) Add new config `rails-locales`. ([@r.dubrovsky][])
12
+
13
+ ### Changed
14
+
15
+ * **(Breaking)** Drop support for Ruby 2.4 and Ruby 2.5. ([@r.dubrovsky][])
16
+
17
+ * [#260](https://github.com/datarockets/ruby-style/issues/260) Update rubocop to `1.39`. ([@r.dubrovsky][])
18
+ * Setup `Layout/CaseIndentation` rule. ([@r.dubrovsky][])
19
+ * [#261](https://github.com/datarockets/ruby-style/issues/261) Update rubocop-rails to `2.17.3`. ([@r.dubrovsky][])
20
+ * [#262](https://github.com/datarockets/ruby-style/issues/262) Update rubocop-rspec to `2.15`. ([@r.dubrovsky][])
21
+ * [#32](https://github.com/datarockets/ruby-style/issues/32) Enable back `Style/FrozenStringLiteralComment` cop. ([@r.dubrovsky][])
22
+ * [#176](https://github.com/datarockets/ruby-style/issues/176) Fix hash alignment via changing `Layout/HashAlignment` cop. ([@r.dubrovsky][])
23
+ * [#263](https://github.com/datarockets/ruby-style/issues/263) Setup `EnforcedStyle` for `Layout/LineEndStringConcatenationIndentation` cop. ([@r.dubrovsky][])
24
+ * [#258](https://github.com/datarockets/ruby-style/issues/258) Setup `EnforcedStyle` for `Layout/FirstArrayElementIndentation` cop. ([@r.dubrovsky][])
25
+ * [#179](https://github.com/datarockets/ruby-style/issues/179) Setup `EnforcedStyleAlignWith` rule for `Layout/BlockAlignment` cop. ([@r.dubrovsky][])
26
+
27
+ ### Fixed
28
+
29
+ * [#196](https://github.com/datarockets/ruby-style/issues/196) Fix `Layout/ArrayAlignmentExtended` cop. ([@r.dubrovsky][])
30
+ * [#258](https://github.com/datarockets/ruby-style/issues/258) Fix conflict between `Layout/ArrayAlignmentExtended` and `Layout/FirstArrayElementIndentation` cops. ([@r.dubrovsky][])
31
+
32
+ ## 1.2.0 (2021-02-24)
8
33
 
9
34
  ### Added
10
35
 
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
@@ -10,14 +10,14 @@ Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
12
  group :test, :development do
13
- gem 'datarockets-style', '~> 1.1.0'
13
+ gem 'datarockets-style', '~> 1.3.0'
14
14
  end
15
15
  ```
16
16
 
17
17
  Or, for a Ruby library, add this to your gemspec:
18
18
 
19
19
  ```ruby
20
- spec.add_development_dependency 'datarockets-style', '~> 1.1.0'
20
+ spec.add_development_dependency 'datarockets-style', '~> 1.3.0'
21
21
  ```
22
22
 
23
23
  And then execute:
@@ -51,6 +51,15 @@ inherit_gem:
51
51
  - config/rails.yml
52
52
  ```
53
53
 
54
+ By default, it doesn't include rules for I18n. For enabling them, add the next styles
55
+
56
+ ```yaml
57
+ inherit_gem:
58
+ datarockets-style:
59
+ - config/rails.yml
60
+ - config/rails-locales.yml
61
+ ```
62
+
54
63
  ### Rspec config
55
64
 
56
65
  For Rspec tests, you can add a special rubocop config
data/RELEASING.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Releasing
2
2
 
3
3
  * Update `version.rb` file accordingly.
4
+ * Update `README.mb` file.
4
5
  * Update `CHANGELOG.md` file.
5
- * Update `Gemfile.lock` file via running `bundle install`.
6
6
  * Build and publish (and verify that everything ok):
7
7
 
8
8
  ```bash
data/config/base.yml CHANGED
@@ -25,8 +25,18 @@ Layout/ArrayAlignmentExtended:
25
25
  - with_fixed_indentation
26
26
  IndentationWidth: ~
27
27
 
28
+ Layout/BlockAlignment:
29
+ EnforcedStyleAlignWith: start_of_block
30
+
31
+ Layout/CaseIndentation:
32
+ EnforcedStyle: end
33
+
34
+ Layout/FirstArrayElementIndentation:
35
+ EnforcedStyle: consistent
36
+
28
37
  Layout/HashAlignment:
29
- EnforcedLastArgumentHashStyle: always_ignore
38
+ EnforcedColonStyle: key
39
+ EnforcedHashRocketStyle: key
30
40
 
31
41
  Layout/ParameterAlignment:
32
42
  EnforcedStyle: with_fixed_indentation
@@ -41,6 +51,9 @@ Layout/EndAlignment:
41
51
  Layout/IndentationConsistency:
42
52
  EnforcedStyle: normal
43
53
 
54
+ Layout/LineEndStringConcatenationIndentation:
55
+ EnforcedStyle: indented
56
+
44
57
  Layout/LineLength:
45
58
  Max: 120
46
59
 
@@ -152,7 +165,7 @@ Style/HashTransformValues:
152
165
  Enabled: true
153
166
 
154
167
  Style/FrozenStringLiteralComment:
155
- Enabled: false
168
+ Enabled: true
156
169
 
157
170
  Style/NestedInterpolation:
158
171
  Enabled: true
@@ -0,0 +1,2 @@
1
+ Rails/I18nLocaleTexts:
2
+ Enabled: true
data/config/rails.yml CHANGED
@@ -14,6 +14,9 @@ AllCops:
14
14
  - "config.ru"
15
15
  - "Rakefile"
16
16
 
17
+ Rails/I18nLocaleTexts:
18
+ Enabled: false
19
+
17
20
  Style/Documentation:
18
21
  Enabled: true
19
22
  Exclude:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path("lib", __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require "datarockets_style/version"
@@ -12,7 +14,7 @@ Gem::Specification.new do |spec|
12
14
  spec.homepage = "https://github.com/datarockets/datarockets-style"
13
15
  spec.license = "MIT"
14
16
 
15
- spec.required_ruby_version = ">= 2.4.0"
17
+ spec.required_ruby_version = ">= 2.6.0"
16
18
 
17
19
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
20
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -30,11 +32,12 @@ Gem::Specification.new do |spec|
30
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
33
  spec.require_paths = ["lib"]
32
34
 
33
- spec.add_dependency "rubocop", "~> 1.10"
34
- spec.add_dependency "rubocop-rails", "~> 2.9"
35
- spec.add_dependency "rubocop-rspec", "~> 2.0"
35
+ spec.add_dependency "rubocop", "~> 1.39"
36
+ spec.add_dependency "rubocop-rails", "~> 2.17.3"
37
+ spec.add_dependency "rubocop-rspec", "~> 2.15"
36
38
 
37
39
  spec.add_development_dependency "pry-byebug"
38
40
  spec.add_development_dependency "rake", "~> 13.0"
39
41
  spec.add_development_dependency "rspec", "~> 3.10"
42
+ spec.metadata["rubygems_mfa_required"] = "true"
40
43
  end
@@ -33,13 +33,14 @@ module DatarocketsStyle
33
33
  #
34
34
  # array = [1, 2, 3,
35
35
  # 4, 5, 6]
36
- class ArrayAlignmentExtended < RuboCop::Cop::Cop
36
+ class ArrayAlignmentExtended < RuboCop::Cop::Base
37
37
  include RuboCop::Cop::Alignment
38
+ extend RuboCop::Cop::AutoCorrector
38
39
 
39
40
  ALIGN_PARAMS_MSG = "Align the elements of an array literal if they span more than one line."
40
41
 
41
42
  FIXED_INDENT_MSG = "Use one level of indentation for elements " \
42
- "following the first line of a multi-line array."
43
+ "following the first line of a multi-line array."
43
44
 
44
45
  def on_array(node)
45
46
  return if node.children.size < 2
@@ -47,8 +48,8 @@ module DatarocketsStyle
47
48
  check_alignment(node.children, base_column(node, node.children))
48
49
  end
49
50
 
50
- def autocorrect(node)
51
- RuboCop::Cop::AlignmentCorrector.correct(processed_source, node, column_delta)
51
+ def autocorrect(corrector, node)
52
+ RuboCop::Cop::AlignmentCorrector.correct(corrector, processed_source, node, column_delta)
52
53
  end
53
54
 
54
55
  private
@@ -34,7 +34,7 @@ module DatarocketsStyle
34
34
  def autocorrect(node)
35
35
  lambda do |corrector|
36
36
  block_internals = node.source.split(/ /)
37
- corrector.replace node.loc.expression, ["before", *block_internals[1..-1]].join(" ")
37
+ corrector.replace node.loc.expression, ["before", *block_internals[1..]].join(" ")
38
38
  end
39
39
  end
40
40
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DatarocketsStyle
2
4
  module Cop
3
5
  module Style
@@ -14,7 +16,7 @@ module DatarocketsStyle
14
16
  class NestedInterpolation < RuboCop::Cop::Cop
15
17
  include RuboCop::Cop::Interpolation
16
18
 
17
- MSG = "Redundant nested interpolation.".freeze
19
+ MSG = "Redundant nested interpolation."
18
20
 
19
21
  def on_interpolation(node)
20
22
  node.each_descendant(:dstr) do |descendant_node|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DatarocketsStyle
2
4
  module Formatter
3
5
  module TodoListFormatter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "pathname"
2
4
  require_relative "./todo_list_formatter/report_summary"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DatarocketsStyle
2
- VERSION = "1.2.0".freeze
4
+ VERSION = "1.3.0"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rubocop"
2
4
  require "datarockets_style/formatter/todo_list_formatter"
3
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datarockets-style
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Dubrovsky
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2022-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '1.39'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: '1.39'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.9'
33
+ version: 2.17.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.9'
40
+ version: 2.17.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop-rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '2.15'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '2.15'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry-byebug
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.10'
97
- description:
97
+ description:
98
98
  email:
99
99
  - r.dubrovsky@datarockets.com
100
100
  executables: []
@@ -120,6 +120,7 @@ files:
120
120
  - bin/console
121
121
  - bin/setup
122
122
  - config/base.yml
123
+ - config/rails-locales.yml
123
124
  - config/rails.yml
124
125
  - config/rspec.yml
125
126
  - config/ruby.yml
@@ -140,7 +141,8 @@ licenses:
140
141
  - MIT
141
142
  metadata:
142
143
  allowed_push_host: https://rubygems.org
143
- post_install_message:
144
+ rubygems_mfa_required: 'true'
145
+ post_install_message:
144
146
  rdoc_options: []
145
147
  require_paths:
146
148
  - lib
@@ -148,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
150
  requirements:
149
151
  - - ">="
150
152
  - !ruby/object:Gem::Version
151
- version: 2.4.0
153
+ version: 2.6.0
152
154
  required_rubygems_version: !ruby/object:Gem::Requirement
153
155
  requirements:
154
156
  - - ">="
@@ -156,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
158
  version: '0'
157
159
  requirements: []
158
160
  rubygems_version: 3.1.4
159
- signing_key:
161
+ signing_key:
160
162
  specification_version: 4
161
163
  summary: Datarockets style guides and shared style configs
162
164
  test_files: []