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 +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +26 -1
- data/Gemfile +2 -0
- data/README.md +11 -2
- data/RELEASING.md +1 -1
- data/config/base.yml +15 -2
- data/config/rails-locales.yml +2 -0
- data/config/rails.yml +3 -0
- data/datarockets-style.gemspec +7 -4
- data/lib/datarockets_style/cop/layout/array_alignment_extended.rb +5 -4
- data/lib/datarockets_style/cop/rspec/prefer_before_over_setup.rb +1 -1
- data/lib/datarockets_style/cop/style/nested_interpolation.rb +3 -1
- data/lib/datarockets_style/formatter/todo_list_formatter/report_summary.rb +2 -0
- data/lib/datarockets_style/formatter/todo_list_formatter.rb +2 -0
- data/lib/datarockets_style/version.rb +3 -1
- data/lib/datarockets_style.rb +2 -0
- metadata +15 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6270a40b4ee5b048f1e8df9b7771556a66cc0ff086b9e5198e1b2b2220d99113
|
4
|
+
data.tar.gz: e1d537d012304fdcf3d0439d8fa36625823da85930e31304ffa8f1ff4b839f91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67361be1894556117a361d9d2a7f5f82be094d61c5b16df15f2248fd5f41c7f669b6a864415d153d94cf3c94002f0bf936a3accb55c3fb765054a36c2a364c55
|
7
|
+
data.tar.gz: 5da0e3a48096c6189decf5692f0d3a258cd572310ccd2553edbc713c97a727e25bd785e4dec621f712a6fa048065fa79cf334815b3642e84acbb9961980cbd89
|
data/.rubocop.yml
CHANGED
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.
|
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
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.
|
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.
|
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
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
|
-
|
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:
|
168
|
+
Enabled: true
|
156
169
|
|
157
170
|
Style/NestedInterpolation:
|
158
171
|
Enabled: true
|
data/config/rails.yml
CHANGED
data/datarockets-style.gemspec
CHANGED
@@ -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.
|
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.
|
34
|
-
spec.add_dependency "rubocop-rails", "~> 2.
|
35
|
-
spec.add_dependency "rubocop-rspec", "~> 2.
|
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::
|
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
|
-
|
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
|
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."
|
19
|
+
MSG = "Redundant nested interpolation."
|
18
20
|
|
19
21
|
def on_interpolation(node)
|
20
22
|
node.each_descendant(:dstr) do |descendant_node|
|
data/lib/datarockets_style.rb
CHANGED
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.
|
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:
|
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.
|
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.
|
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:
|
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:
|
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.
|
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.
|
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
|
-
|
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.
|
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: []
|