decidim-dev 0.26.8 → 0.26.9
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/config/environment.rb +3 -0
- data/config/locales/cs.yml +4 -4
- data/config/locales/de.yml +1 -1
- data/config/locales/eu.yml +14 -8
- data/config/locales/pt-BR.yml +6 -0
- data/config/locales/sq-AL.yml +1 -0
- data/config/locales/sv.yml +1 -0
- data/config/locales/th-TH.yml +1 -0
- data/lib/decidim/dev/test/rspec_support/geocoder.rb +4 -4
- data/lib/decidim/dev/version.rb +1 -1
- metadata +20 -7
- data/lib/decidim/dev/test/rspec_support/summary_notification.rb +0 -51
- data/lib/rubocop/cop/decidim/hash_shorthand_syntax_backports.rb +0 -175
- data/lib/rubocop/cop/decidim.rb +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4f0ecb7ea62101dcbfb23c680215480aa30347d63a8e6bf761242e570905d8e
|
|
4
|
+
data.tar.gz: 2813fd9504741b8181d000db7c971bd83fd159ab399d8e43b219a13a59e85175
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f5f706144e6452fa33af9419b7454fa1c7f465170ee7d64d8d0b9140b62fb6500f349f63dd6c512bf3ae1cc2dfd46080554972e933c3e85f2b503cba6e67e74
|
|
7
|
+
data.tar.gz: '055957ada7b160781d95d5aacfa771701cca93005400fcf3417c40a4e9c7ae3643f6d30ebf60f8cdd8d136babf77eb3057681bc4905dc5822fc2f60e7ebc87ab'
|
data/config/environment.rb
CHANGED
data/config/locales/cs.yml
CHANGED
|
@@ -23,9 +23,9 @@ cs:
|
|
|
23
23
|
readonly_attribute: Atribut pouze pro čtení
|
|
24
24
|
test: Zkouška A
|
|
25
25
|
test_choices:
|
|
26
|
-
a:
|
|
27
|
-
b:
|
|
28
|
-
c:
|
|
26
|
+
a: Možnost A
|
|
27
|
+
b: Možnost B
|
|
28
|
+
c: Možnost C
|
|
29
29
|
test_options:
|
|
30
30
|
bar: Bar
|
|
31
31
|
baz: Baz
|
|
@@ -56,7 +56,7 @@ cs:
|
|
|
56
56
|
unearned_own: Dosud jste nevytvořili žádné testy.
|
|
57
57
|
resource_links:
|
|
58
58
|
test_link:
|
|
59
|
-
dummy_resource_dummy: Související
|
|
59
|
+
dummy_resource_dummy: Související testovací soubor
|
|
60
60
|
statistics:
|
|
61
61
|
bar: Bar
|
|
62
62
|
dummies_count_high: Figuríny vysoké
|
data/config/locales/de.yml
CHANGED
data/config/locales/eu.yml
CHANGED
|
@@ -2,8 +2,8 @@ eu:
|
|
|
2
2
|
activemodel:
|
|
3
3
|
attributes:
|
|
4
4
|
dummy_resource:
|
|
5
|
-
created_at:
|
|
6
|
-
decidim_scope_id:
|
|
5
|
+
created_at: Sortua
|
|
6
|
+
decidim_scope_id: Esparrua
|
|
7
7
|
field: Nire eremua
|
|
8
8
|
start_date: Hasiera data
|
|
9
9
|
title: Izenburua
|
|
@@ -14,8 +14,14 @@ eu:
|
|
|
14
14
|
dummy:
|
|
15
15
|
settings:
|
|
16
16
|
global:
|
|
17
|
+
guided: Input gidatua
|
|
18
|
+
guided_help: Laguntza-testua
|
|
19
|
+
guided_readonly: Input desgaitua
|
|
20
|
+
guided_rich: Input gidatu aberastua
|
|
21
|
+
guided_rich_help_html: HTML<strong>ayuda</strong> testua
|
|
22
|
+
guided_rich_readonly_html: HTML<strong>laguntza</strong>testua input desgaiturako
|
|
17
23
|
readonly_attribute: Soilik irakurtzeko atributua
|
|
18
|
-
test:
|
|
24
|
+
test: Proba bat
|
|
19
25
|
test_choices:
|
|
20
26
|
a: A aukera
|
|
21
27
|
b: B aukera
|
|
@@ -35,22 +41,22 @@ eu:
|
|
|
35
41
|
dummy:
|
|
36
42
|
admin:
|
|
37
43
|
exports:
|
|
38
|
-
dummies:
|
|
44
|
+
dummies: Probak
|
|
39
45
|
gamification:
|
|
40
46
|
badges:
|
|
41
47
|
test:
|
|
42
48
|
conditions:
|
|
43
49
|
- Erabili probako ingurunea erabakitzeko.
|
|
44
|
-
description:
|
|
50
|
+
description: Parte-hartzaileek garaikur hau lortzen dute probak sortzeagatik.
|
|
45
51
|
description_another: Erabiltzaile honek %{score} proba egin ditu.
|
|
46
52
|
description_own: '%{score} proba sortu dituzu.'
|
|
47
|
-
name:
|
|
53
|
+
name: Probak
|
|
48
54
|
next_level_in: Sortu %{score} proba gehiago hurrengo mailara iristeko!
|
|
49
55
|
unearned_another: Erabiltzaile honek ez du proba oraindik sortu.
|
|
50
|
-
unearned_own: Oraindik ez duzu
|
|
56
|
+
unearned_own: Oraindik ez duzu probarik sortu.
|
|
51
57
|
resource_links:
|
|
52
58
|
test_link:
|
|
53
|
-
dummy_resource_dummy: '
|
|
59
|
+
dummy_resource_dummy: ' Honekin lotutako proba'
|
|
54
60
|
statistics:
|
|
55
61
|
bar: Bar
|
|
56
62
|
dummies_count_high: Dummies altua
|
data/config/locales/pt-BR.yml
CHANGED
|
@@ -14,6 +14,12 @@ pt-BR:
|
|
|
14
14
|
dummy:
|
|
15
15
|
settings:
|
|
16
16
|
global:
|
|
17
|
+
guided: Entrada guiada
|
|
18
|
+
guided_help: Texto de ajuda
|
|
19
|
+
guided_readonly: Entrada desabilitada
|
|
20
|
+
guided_rich: Entrada de rich text guiada
|
|
21
|
+
guided_rich_help_html: HTML <strong>ajuda</strong> texto
|
|
22
|
+
guided_rich_readonly_html: HTML <strong>ajuda</strong> texto para entrada desativada
|
|
17
23
|
readonly_attribute: Atributo somente leitura
|
|
18
24
|
test: Teste A
|
|
19
25
|
test_choices:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sq:
|
data/config/locales/sv.yml
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
th:
|
|
@@ -47,7 +47,7 @@ module Decidim::Map::Provider
|
|
|
47
47
|
def self.add_stub(address, coordinates)
|
|
48
48
|
stubs.push(
|
|
49
49
|
properties: address.is_a?(Hash) ? address : { street: address },
|
|
50
|
-
geometry: { coordinates: coordinates }
|
|
50
|
+
geometry: { coordinates: coordinates.reverse }
|
|
51
51
|
)
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -121,7 +121,7 @@ RSpec.configure do |config|
|
|
|
121
121
|
country: "Country1"
|
|
122
122
|
},
|
|
123
123
|
geometry: {
|
|
124
|
-
coordinates: [
|
|
124
|
+
coordinates: [2.234, 1.123]
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
127
|
{
|
|
@@ -132,7 +132,7 @@ RSpec.configure do |config|
|
|
|
132
132
|
country: "Country2"
|
|
133
133
|
},
|
|
134
134
|
geometry: {
|
|
135
|
-
coordinates: [
|
|
135
|
+
coordinates: [4.456, 3.345]
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
138
|
{
|
|
@@ -144,7 +144,7 @@ RSpec.configure do |config|
|
|
|
144
144
|
country: "Country3"
|
|
145
145
|
},
|
|
146
146
|
geometry: {
|
|
147
|
-
coordinates: [
|
|
147
|
+
coordinates: [6.678, 5.567]
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
]
|
data/lib/decidim/dev/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-dev
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.26.
|
|
4
|
+
version: 0.26.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2023-
|
|
13
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: capybara
|
|
@@ -32,14 +32,14 @@ dependencies:
|
|
|
32
32
|
requirements:
|
|
33
33
|
- - '='
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: 0.26.
|
|
35
|
+
version: 0.26.9
|
|
36
36
|
type: :runtime
|
|
37
37
|
prerelease: false
|
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
39
|
requirements:
|
|
40
40
|
- - '='
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: 0.26.
|
|
42
|
+
version: 0.26.9
|
|
43
43
|
- !ruby/object:Gem::Dependency
|
|
44
44
|
name: factory_bot_rails
|
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -54,6 +54,20 @@ dependencies:
|
|
|
54
54
|
- - "~>"
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
56
|
version: '4.8'
|
|
57
|
+
- !ruby/object:Gem::Dependency
|
|
58
|
+
name: axe-core-api
|
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - "~>"
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: 4.7.0
|
|
64
|
+
type: :runtime
|
|
65
|
+
prerelease: false
|
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - "~>"
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: 4.7.0
|
|
57
71
|
- !ruby/object:Gem::Dependency
|
|
58
72
|
name: axe-core-rspec
|
|
59
73
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -486,9 +500,11 @@ files:
|
|
|
486
500
|
- config/locales/sk.yml
|
|
487
501
|
- config/locales/sl.yml
|
|
488
502
|
- config/locales/so-SO.yml
|
|
503
|
+
- config/locales/sq-AL.yml
|
|
489
504
|
- config/locales/sr-CS.yml
|
|
490
505
|
- config/locales/sv.yml
|
|
491
506
|
- config/locales/sw-KE.yml
|
|
507
|
+
- config/locales/th-TH.yml
|
|
492
508
|
- config/locales/ti-ER.yml
|
|
493
509
|
- config/locales/tr-TR.yml
|
|
494
510
|
- config/locales/uk.yml
|
|
@@ -580,7 +596,6 @@ files:
|
|
|
580
596
|
- lib/decidim/dev/test/rspec_support/rake_tasks.rb
|
|
581
597
|
- lib/decidim/dev/test/rspec_support/react_select.rb
|
|
582
598
|
- lib/decidim/dev/test/rspec_support/route_helpers.rb
|
|
583
|
-
- lib/decidim/dev/test/rspec_support/summary_notification.rb
|
|
584
599
|
- lib/decidim/dev/test/rspec_support/time_helpers.rb
|
|
585
600
|
- lib/decidim/dev/test/rspec_support/timezone.rb
|
|
586
601
|
- lib/decidim/dev/test/rspec_support/translation_helpers.rb
|
|
@@ -592,8 +607,6 @@ files:
|
|
|
592
607
|
- lib/decidim/dev/test/spec_helper.rb
|
|
593
608
|
- lib/decidim/dev/test/w3c_rspec_validators_overrides.rb
|
|
594
609
|
- lib/decidim/dev/version.rb
|
|
595
|
-
- lib/rubocop/cop/decidim.rb
|
|
596
|
-
- lib/rubocop/cop/decidim/hash_shorthand_syntax_backports.rb
|
|
597
610
|
- lib/tasks/generators.rake
|
|
598
611
|
- lib/tasks/locale_checker.rake
|
|
599
612
|
homepage: https://github.com/decidim/decidim
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RSpec::Core
|
|
4
|
-
module Notifications
|
|
5
|
-
class SummaryNotification
|
|
6
|
-
# Override the original method to add the full path to the spec file and the correct rspec command to rerun the failed spec
|
|
7
|
-
# The goal is to be able to copy-paste the command to rerun the failed spec without having to manually add the full path to the spec file
|
|
8
|
-
#
|
|
9
|
-
# So, instead of:
|
|
10
|
-
# > rspec ./spec/system/registration_spec.rb:27
|
|
11
|
-
#
|
|
12
|
-
# We get:
|
|
13
|
-
# > bin/rspec ./decidim-core/spec/system/registration_spec.rb:27
|
|
14
|
-
#
|
|
15
|
-
# Original code in rspec-core: https://github.com/rspec/rspec-core/blob/8caecca0b9b299ccbaa5c7ea5dd885ab42cd57d3/lib/rspec/core/notifications.rb#L365
|
|
16
|
-
def colorized_rerun_commands(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
|
17
|
-
rspec_command = running_with_rspec_wrapper? ? "bin/rspec" : "rspec"
|
|
18
|
-
"\nFailed examples:\n\n" +
|
|
19
|
-
failed_examples.map do |example|
|
|
20
|
-
colorizer.wrap("#{rspec_command} #{rerun_argument_for(example)}", RSpec.configuration.failure_color) + " " +
|
|
21
|
-
colorizer.wrap("# #{example.full_description}", RSpec.configuration.detail_color)
|
|
22
|
-
end.join("\n")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
def running_with_rspec_wrapper?
|
|
28
|
-
$0 == "bin/rspec"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def rerun_argument_for(example)
|
|
32
|
-
if running_with_rspec_wrapper?
|
|
33
|
-
location = location_rerun_argument_for_decidim(example)
|
|
34
|
-
else
|
|
35
|
-
location = example.location_rerun_argument
|
|
36
|
-
end
|
|
37
|
-
return location unless duplicate_rerun_locations.include?(location)
|
|
38
|
-
|
|
39
|
-
conditionally_quote(example.id)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def location_rerun_argument_for_decidim(example)
|
|
43
|
-
absolute_file_path = example.metadata[:absolute_file_path]
|
|
44
|
-
file_path = example.metadata[:file_path][1..-1]
|
|
45
|
-
module_dir = absolute_file_path.gsub(file_path, "").split("/")[-1]
|
|
46
|
-
|
|
47
|
-
"./#{module_dir}#{file_path}:#{example.metadata[:line_number]}"
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Originally copied from https://github.com/koic/rubocop/blob/master/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
|
|
5
|
-
# Copyright (c) 2012-22 Bozhidar Batsov
|
|
6
|
-
# MIT License
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
module RuboCop
|
|
10
|
-
module Cop
|
|
11
|
-
# This module checks for Ruby 3.1's hash value omission syntax.
|
|
12
|
-
#
|
|
13
|
-
# For using this on Decidim, we have added the Decidim namespace and also the Backports prefix
|
|
14
|
-
# to the module name
|
|
15
|
-
module Decidim
|
|
16
|
-
module HashShorthandSyntaxBackports
|
|
17
|
-
OMIT_HASH_VALUE_MSG = "Omit the hash value."
|
|
18
|
-
EXPLICIT_HASH_VALUE_MSG = "Include the hash value."
|
|
19
|
-
DO_NOT_MIX_MSG_PREFIX = "Do not mix explicit and implicit hash values."
|
|
20
|
-
DO_NOT_MIX_OMIT_VALUE_MSG = "#{DO_NOT_MIX_MSG_PREFIX} #{OMIT_HASH_VALUE_MSG}".freeze
|
|
21
|
-
DO_NOT_MIX_EXPLICIT_VALUE_MSG = "#{DO_NOT_MIX_MSG_PREFIX} #{EXPLICIT_HASH_VALUE_MSG}".freeze
|
|
22
|
-
|
|
23
|
-
def on_hash_for_mixed_shorthand(hash_node)
|
|
24
|
-
return if ignore_mixed_hash_shorthand_syntax?(hash_node)
|
|
25
|
-
|
|
26
|
-
hash_value_type_breakdown = breakdown_value_types_of_hash(hash_node)
|
|
27
|
-
|
|
28
|
-
if hash_with_mixed_shorthand_syntax?(hash_value_type_breakdown)
|
|
29
|
-
mixed_shorthand_syntax_check(hash_value_type_breakdown)
|
|
30
|
-
else
|
|
31
|
-
no_mixed_shorthand_syntax_check(hash_value_type_breakdown)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def on_pair(node)
|
|
36
|
-
return if ignore_hash_shorthand_syntax?(node)
|
|
37
|
-
|
|
38
|
-
hash_key_source = node.key.source
|
|
39
|
-
|
|
40
|
-
if enforced_shorthand_syntax == "always"
|
|
41
|
-
return if node.value_omission? || require_hash_value?(hash_key_source, node)
|
|
42
|
-
|
|
43
|
-
message = OMIT_HASH_VALUE_MSG
|
|
44
|
-
replacement = "#{hash_key_source}:"
|
|
45
|
-
self.config_to_allow_offenses = { "Enabled" => false }
|
|
46
|
-
else
|
|
47
|
-
return unless node.value_omission?
|
|
48
|
-
|
|
49
|
-
message = EXPLICIT_HASH_VALUE_MSG
|
|
50
|
-
replacement = "#{hash_key_source}: #{hash_key_source}"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
register_offense(node, message, replacement)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
private
|
|
57
|
-
|
|
58
|
-
def register_offense(node, message, replacement)
|
|
59
|
-
add_offense(node.value, message:) do |corrector|
|
|
60
|
-
corrector.replace(node, replacement)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def ignore_mixed_hash_shorthand_syntax?(hash_node)
|
|
65
|
-
target_ruby_version <= 3.0 || enforced_shorthand_syntax != "consistent" ||
|
|
66
|
-
!hash_node.hash_type?
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def ignore_hash_shorthand_syntax?(pair_node)
|
|
70
|
-
target_ruby_version <= 3.0 || enforced_shorthand_syntax == "either" ||
|
|
71
|
-
enforced_shorthand_syntax == "consistent" ||
|
|
72
|
-
!pair_node.parent.hash_type?
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def enforced_shorthand_syntax
|
|
76
|
-
cop_config.fetch("EnforcedShorthandSyntax", "always")
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def require_hash_value?(hash_key_source, node)
|
|
80
|
-
return true if !node.key.sym_type? || require_hash_value_for_around_hash_literal?(node)
|
|
81
|
-
|
|
82
|
-
hash_value = node.value
|
|
83
|
-
return true unless hash_value.send_type? || hash_value.lvar_type?
|
|
84
|
-
|
|
85
|
-
hash_key_source != hash_value.source || hash_key_source.end_with?("!", "?")
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def require_hash_value_for_around_hash_literal?(node)
|
|
89
|
-
return false unless (ancestor = node.parent.parent)
|
|
90
|
-
return false if ancestor.send_type? && ancestor.method?(:[])
|
|
91
|
-
|
|
92
|
-
!node.parent.braces? && !use_element_of_hash_literal_as_receiver?(ancestor, node.parent) &&
|
|
93
|
-
(use_modifier_form_without_parenthesized_method_call?(ancestor) ||
|
|
94
|
-
without_parentheses_call_expr_follows?(ancestor))
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def use_element_of_hash_literal_as_receiver?(ancestor, parent)
|
|
98
|
-
# `{value:}.do_something` is a valid syntax.
|
|
99
|
-
ancestor.send_type? && ancestor.receiver == parent
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def use_modifier_form_without_parenthesized_method_call?(ancestor)
|
|
103
|
-
return false if ancestor.respond_to?(:parenthesized?) && ancestor.parenthesized?
|
|
104
|
-
|
|
105
|
-
ancestor.ancestors.any? { |node| node.respond_to?(:modifier_form?) && node.modifier_form? }
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def without_parentheses_call_expr_follows?(ancestor)
|
|
109
|
-
return false unless ancestor.respond_to?(:parenthesized?) && !ancestor.parenthesized?
|
|
110
|
-
|
|
111
|
-
right_sibling = ancestor.right_sibling
|
|
112
|
-
right_sibling ||= ancestor.each_ancestor.find do |node|
|
|
113
|
-
node.assignment? || node.send_type?
|
|
114
|
-
end&.right_sibling
|
|
115
|
-
|
|
116
|
-
!!right_sibling
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def breakdown_value_types_of_hash(hash_node)
|
|
120
|
-
hash_node.pairs.group_by do |pair_node|
|
|
121
|
-
if pair_node.value_omission?
|
|
122
|
-
:value_omitted
|
|
123
|
-
elsif require_hash_value?(pair_node.key.source, pair_node)
|
|
124
|
-
:value_needed
|
|
125
|
-
else
|
|
126
|
-
:value_omittable
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
def hash_with_mixed_shorthand_syntax?(hash_value_type_breakdown)
|
|
132
|
-
hash_value_type_breakdown.keys.size > 1
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown)
|
|
136
|
-
hash_value_type_breakdown[:value_needed]&.any?
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
def each_omitted_value_pair(hash_value_type_breakdown, &)
|
|
140
|
-
hash_value_type_breakdown[:value_omitted]&.each(&)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def each_omittable_value_pair(hash_value_type_breakdown, &)
|
|
144
|
-
hash_value_type_breakdown[:value_omittable]&.each(&)
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def mixed_shorthand_syntax_check(hash_value_type_breakdown)
|
|
148
|
-
if hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown)
|
|
149
|
-
each_omitted_value_pair(hash_value_type_breakdown) do |pair_node|
|
|
150
|
-
hash_key_source = pair_node.key.source
|
|
151
|
-
replacement = "#{hash_key_source}: #{hash_key_source}"
|
|
152
|
-
register_offense(pair_node, DO_NOT_MIX_EXPLICIT_VALUE_MSG, replacement)
|
|
153
|
-
end
|
|
154
|
-
else
|
|
155
|
-
each_omittable_value_pair(hash_value_type_breakdown) do |pair_node|
|
|
156
|
-
hash_key_source = pair_node.key.source
|
|
157
|
-
replacement = "#{hash_key_source}:"
|
|
158
|
-
register_offense(pair_node, DO_NOT_MIX_OMIT_VALUE_MSG, replacement)
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def no_mixed_shorthand_syntax_check(hash_value_type_breakdown)
|
|
164
|
-
return if hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown)
|
|
165
|
-
|
|
166
|
-
each_omittable_value_pair(hash_value_type_breakdown) do |pair_node|
|
|
167
|
-
hash_key_source = pair_node.key.source
|
|
168
|
-
replacement = "#{hash_key_source}:"
|
|
169
|
-
register_offense(pair_node, OMIT_HASH_VALUE_MSG, replacement)
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
end
|