datarockets-style 1.2.0 → 1.4.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: d8cf398f37f77c928364df3e33a874052bb6912f909688e881a03b87cc7d53d1
4
+ data.tar.gz: 7f3e05cf2f7c6dbdff1e5c506131de539f14974400cefb2e30170be0cabec9c9
5
5
  SHA512:
6
- metadata.gz: be32cf2f4da3c94b9e532bfd0e0a2f0d416200ebc5d2992fdb3ff223b9b9603dd4f78ff198640c4500964cda5f82b93b5484694c909371d53bea2cd185356c0a
7
- data.tar.gz: b0120bd764544c9fe6458b981f3b5174d96eaed7980ea29b8ca4b73065b8794225ab832478ee0c7666a1b4ae13908e17d403f30351c80fdd9ec17a4ef6247d49
6
+ metadata.gz: 4072a041ba599dcad11bfdf6f50c851541f9b77a0a5283989a26d12c121fcc778c11883ccc6eb495fc737674ee5e2c024a9f067150953077bcf2361b45a8425f
7
+ data.tar.gz: b68cc6a20a6bd27c42071606c27329365fc0e0c400999f66846aa9604b705fccab9d652de8711de69bc4ff25e9c5f121b5a2e11b422ee4b88dbb413ff06adb0b
@@ -13,25 +13,13 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
 
15
15
  steps:
16
- - uses: actions/checkout@v1
17
-
18
- - uses: actions/cache@v1
19
- with:
20
- path: vendor/bundle
21
- key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
22
- restore-keys: |
23
- ${{ runner.os }}-gem-
16
+ - uses: actions/checkout@v3
24
17
 
25
18
  - name: Set up Ruby 2.6
26
- uses: actions/setup-ruby@v1
19
+ uses: ruby/setup-ruby@v1
27
20
  with:
28
- ruby-version: 2.6.x
29
-
30
- - name: Install and run bundler
31
- run: |
32
- gem install bundler
33
- bundle config path vendor/bundle
34
- bundle install --jobs 4 --retry 3
21
+ ruby-version: '2.6'
22
+ bundler-cache: true
35
23
 
36
24
  - name: Run linter
37
25
  run: make lint
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,40 @@ The format is described in [Contributing notes](CONTRIBUTING.md#changelog-entry-
4
4
 
5
5
  ## master
6
6
 
7
- ## 1.2.0
7
+ ## 1.4.0 (2023-02-11)
8
+
9
+ ### Changed
10
+
11
+ * Update rubocop to `1.45.1`. ([@r.dubrovsky][])
12
+ * Update rubocop-rails to `2.17.4`. ([@r.dubrovsky][])
13
+ * Update rubocop-rspec to `2.18.1`. ([@r.dubrovsky][])
14
+
15
+ ## 1.3.0 (2022-12-02)
16
+
17
+ ### Added
18
+
19
+ * [#261](https://github.com/datarockets/ruby-style/issues/261) Add new config `rails-locales`. ([@r.dubrovsky][])
20
+
21
+ ### Changed
22
+
23
+ * **(Breaking)** Drop support for Ruby 2.4 and Ruby 2.5. ([@r.dubrovsky][])
24
+
25
+ * [#260](https://github.com/datarockets/ruby-style/issues/260) Update rubocop to `1.39`. ([@r.dubrovsky][])
26
+ * Setup `Layout/CaseIndentation` rule. ([@r.dubrovsky][])
27
+ * [#261](https://github.com/datarockets/ruby-style/issues/261) Update rubocop-rails to `2.17.3`. ([@r.dubrovsky][])
28
+ * [#262](https://github.com/datarockets/ruby-style/issues/262) Update rubocop-rspec to `2.15`. ([@r.dubrovsky][])
29
+ * [#32](https://github.com/datarockets/ruby-style/issues/32) Enable back `Style/FrozenStringLiteralComment` cop. ([@r.dubrovsky][])
30
+ * [#176](https://github.com/datarockets/ruby-style/issues/176) Fix hash alignment via changing `Layout/HashAlignment` cop. ([@r.dubrovsky][])
31
+ * [#263](https://github.com/datarockets/ruby-style/issues/263) Setup `EnforcedStyle` for `Layout/LineEndStringConcatenationIndentation` cop. ([@r.dubrovsky][])
32
+ * [#258](https://github.com/datarockets/ruby-style/issues/258) Setup `EnforcedStyle` for `Layout/FirstArrayElementIndentation` cop. ([@r.dubrovsky][])
33
+ * [#179](https://github.com/datarockets/ruby-style/issues/179) Setup `EnforcedStyleAlignWith` rule for `Layout/BlockAlignment` cop. ([@r.dubrovsky][])
34
+
35
+ ### Fixed
36
+
37
+ * [#196](https://github.com/datarockets/ruby-style/issues/196) Fix `Layout/ArrayAlignmentExtended` cop. ([@r.dubrovsky][])
38
+ * [#258](https://github.com/datarockets/ruby-style/issues/258) Fix conflict between `Layout/ArrayAlignmentExtended` and `Layout/FirstArrayElementIndentation` cops. ([@r.dubrovsky][])
39
+
40
+ ## 1.2.0 (2021-02-24)
8
41
 
9
42
  ### Added
10
43
 
data/Gemfile CHANGED
@@ -1,5 +1,11 @@
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}" }
4
6
 
5
7
  gemspec
8
+
9
+ gem "pry-byebug"
10
+ gem "rake", "~> 13.0"
11
+ gem "rspec", "~> 3.10"
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.4.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.4.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,9 @@ 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.45.1"
36
+ spec.add_dependency "rubocop-rails", "~> 2.17.4"
37
+ spec.add_dependency "rubocop-rspec", "~> 2.18.1"
36
38
 
37
- spec.add_development_dependency "pry-byebug"
38
- spec.add_development_dependency "rake", "~> 13.0"
39
- spec.add_development_dependency "rspec", "~> 3.10"
39
+ spec.metadata["rubygems_mfa_required"] = "true"
40
40
  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.4.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.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Dubrovsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2023-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,84 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: 1.45.1
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.45.1
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.4
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.4
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.18.1
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'
55
- - !ruby/object:Gem::Dependency
56
- name: pry-byebug
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'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '13.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '13.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.10'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.10'
54
+ version: 2.18.1
97
55
  description:
98
56
  email:
99
57
  - r.dubrovsky@datarockets.com
@@ -120,6 +78,7 @@ files:
120
78
  - bin/console
121
79
  - bin/setup
122
80
  - config/base.yml
81
+ - config/rails-locales.yml
123
82
  - config/rails.yml
124
83
  - config/rspec.yml
125
84
  - config/ruby.yml
@@ -140,6 +99,7 @@ licenses:
140
99
  - MIT
141
100
  metadata:
142
101
  allowed_push_host: https://rubygems.org
102
+ rubygems_mfa_required: 'true'
143
103
  post_install_message:
144
104
  rdoc_options: []
145
105
  require_paths:
@@ -148,14 +108,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
108
  requirements:
149
109
  - - ">="
150
110
  - !ruby/object:Gem::Version
151
- version: 2.4.0
111
+ version: 2.6.0
152
112
  required_rubygems_version: !ruby/object:Gem::Requirement
153
113
  requirements:
154
114
  - - ">="
155
115
  - !ruby/object:Gem::Version
156
116
  version: '0'
157
117
  requirements: []
158
- rubygems_version: 3.1.4
118
+ rubygems_version: 3.2.15
159
119
  signing_key:
160
120
  specification_version: 4
161
121
  summary: Datarockets style guides and shared style configs