rubocop-sorted 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +1 -0
- data/lib/rubocop/cop/sorted/sort_hash_keys.rb +12 -34
- data/lib/rubocop/sorted/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe1c4a383131699f151d38e89657bb112a73fa20fa99d8b8c8188bfbc29ecdba
|
4
|
+
data.tar.gz: dfd8c4582e824077a99573959237fb05d34ab063fcd22cd37f017d52478e78cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d71a1c0300f6ea3a18fd8f95042ba5366571dcae0f7046f95d02931c4f18bfb20c5e94c594aab0ac0b9c0aff80540d2ea1416e880fec0fab7cbd5388c9e1302
|
7
|
+
data.tar.gz: 1c4d911517a3fd628a7c12738fa2c75e51079b7944758969e94fde1f2f9023edd8bf57009baf940bb40bd5db156f43800e8e8827d29a10a1e70687d55aeb5b21
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Rubocop::Sorted
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/rubocop-sorted)
|
3
4
|

|
4
5
|
|
5
6
|
[Rubocop](https://github.com/rubocop/rubocop) extension used to enforce that the keys of a hash are sorted alphabetically
|
@@ -3,44 +3,22 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module Sorted
|
6
|
-
#
|
7
|
-
# `
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# @safety
|
11
|
-
# Delete this section if the cop is not unsafe (`Safe: false` or
|
12
|
-
# `SafeAutoCorrect: false`), or use it to explain how the cop is
|
13
|
-
# unsafe.
|
14
|
-
#
|
15
|
-
# @example EnforcedStyle: bar (default)
|
16
|
-
# # Description of the `bar` style.
|
17
|
-
#
|
18
|
-
# # bad
|
19
|
-
# bad_bar_method
|
6
|
+
# Checks that the keys of a hash are sorted alphabetically when enabled.
|
7
|
+
# The configuration option `VariableNamesToCheck` can be set to an array
|
8
|
+
# of strings. Only hashes assigned to variables matching the supplied
|
9
|
+
# names will be inspected. By default, this option is not set.
|
20
10
|
#
|
21
11
|
# # bad
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# # good
|
28
|
-
# good_bar_method(args)
|
29
|
-
#
|
30
|
-
# @example EnforcedStyle: foo
|
31
|
-
# # Description of the `foo` style.
|
32
|
-
#
|
33
|
-
# # bad
|
34
|
-
# bad_foo_method
|
35
|
-
#
|
36
|
-
# # bad
|
37
|
-
# bad_foo_method(args)
|
38
|
-
#
|
39
|
-
# # good
|
40
|
-
# good_foo_method
|
12
|
+
# hash = {
|
13
|
+
# z: 1,
|
14
|
+
# a: 2
|
15
|
+
# }
|
41
16
|
#
|
42
17
|
# # good
|
43
|
-
#
|
18
|
+
# hash = {
|
19
|
+
# a: 2,
|
20
|
+
# z: 1
|
21
|
+
# }
|
44
22
|
#
|
45
23
|
class SortHashKeys < Base
|
46
24
|
extend AutoCorrector
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-sorted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HeroProtagonist
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|