decidim-dev 0.27.4 → 0.27.5
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 +15 -9
- 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 +7 -8
- 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: 97a5308fe5acbd383f506e3b3ab5fe6a9101f162547ec3f3bc9d1b89e92e8083
|
|
4
|
+
data.tar.gz: a834814950d0ecb210cbcaa47e7643324ec688c8ba2a87d69d1aa3832228b53b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9eeba596be6522a72d056d3a4339fe2cb75b5f945d3136bdc0c5ae536e830bdc8fee747453562b75845892b9f6d99bdf2430a1c0cccfd94d45bce6f5e0081d3b
|
|
7
|
+
data.tar.gz: 921b38d3e4cd49b1c2e5ea9af6e1fb6a269a9440c37b086cb058e90e1525883499bc25cbab1da149e58ee32851baf0ef6cd3773ebb417572309b7a61cc119c3a
|
data/config/environment.rb
CHANGED
data/config/locales/cs.yml
CHANGED
|
@@ -24,9 +24,9 @@ cs:
|
|
|
24
24
|
readonly_attribute: Atribut pouze pro čtení
|
|
25
25
|
test: Zkouška A
|
|
26
26
|
test_choices:
|
|
27
|
-
a:
|
|
28
|
-
b:
|
|
29
|
-
c:
|
|
27
|
+
a: Možnost A
|
|
28
|
+
b: Možnost B
|
|
29
|
+
c: Možnost C
|
|
30
30
|
test_options:
|
|
31
31
|
bar: Bar
|
|
32
32
|
baz: Baz
|
|
@@ -57,7 +57,7 @@ cs:
|
|
|
57
57
|
unearned_own: Dosud jste nevytvořili žádné testy.
|
|
58
58
|
resource_links:
|
|
59
59
|
test_link:
|
|
60
|
-
dummy_resource_dummy: Související
|
|
60
|
+
dummy_resource_dummy: Související testovací soubor
|
|
61
61
|
statistics:
|
|
62
62
|
bar: Bar
|
|
63
63
|
dummies_count_high: Figuríny vysoké
|
data/config/locales/de.yml
CHANGED
data/config/locales/eu.yml
CHANGED
|
@@ -3,8 +3,8 @@ eu:
|
|
|
3
3
|
activemodel:
|
|
4
4
|
attributes:
|
|
5
5
|
dummy_resource:
|
|
6
|
-
created_at:
|
|
7
|
-
decidim_scope_id:
|
|
6
|
+
created_at: Sortua
|
|
7
|
+
decidim_scope_id: Esparrua
|
|
8
8
|
field: Nire eremua
|
|
9
9
|
start_date: Hasiera data
|
|
10
10
|
title: Izenburua
|
|
@@ -15,8 +15,14 @@ eu:
|
|
|
15
15
|
dummy:
|
|
16
16
|
settings:
|
|
17
17
|
global:
|
|
18
|
+
guided: Input gidatua
|
|
19
|
+
guided_help: Laguntza-testua
|
|
20
|
+
guided_readonly: Input desgaitua
|
|
21
|
+
guided_rich: Input gidatu aberastua
|
|
22
|
+
guided_rich_help_html: HTML<strong>ayuda</strong> testua
|
|
23
|
+
guided_rich_readonly_html: HTML<strong>laguntza</strong>testua input desgaiturako
|
|
18
24
|
readonly_attribute: Soilik irakurtzeko atributua
|
|
19
|
-
test:
|
|
25
|
+
test: Proba bat
|
|
20
26
|
test_choices:
|
|
21
27
|
a: A aukera
|
|
22
28
|
b: B aukera
|
|
@@ -36,22 +42,22 @@ eu:
|
|
|
36
42
|
dummy:
|
|
37
43
|
admin:
|
|
38
44
|
exports:
|
|
39
|
-
dummies:
|
|
45
|
+
dummies: Probak
|
|
40
46
|
gamification:
|
|
41
47
|
badges:
|
|
42
48
|
test:
|
|
43
49
|
conditions:
|
|
44
50
|
- Erabili probako ingurunea erabakitzeko.
|
|
45
|
-
description:
|
|
51
|
+
description: Parte-hartzaileek garaikur hau lortzen dute probak sortzeagatik.
|
|
46
52
|
description_another: Erabiltzaile honek %{score} proba egin ditu.
|
|
47
53
|
description_own: '%{score} proba sortu dituzu.'
|
|
48
|
-
name:
|
|
54
|
+
name: Probak
|
|
49
55
|
next_level_in: Sortu %{score} proba gehiago hurrengo mailara iristeko!
|
|
50
|
-
unearned_another: Erabiltzaile honek ez du
|
|
51
|
-
unearned_own: Oraindik ez duzu
|
|
56
|
+
unearned_another: Erabiltzaile honek ez du probarik sortu oraindik.
|
|
57
|
+
unearned_own: Oraindik ez duzu probarik sortu.
|
|
52
58
|
resource_links:
|
|
53
59
|
test_link:
|
|
54
|
-
dummy_resource_dummy: ' Honi
|
|
60
|
+
dummy_resource_dummy: ' Honi lotutakoa'
|
|
55
61
|
statistics:
|
|
56
62
|
bar: Bar
|
|
57
63
|
dummies_count_high: Dummies altua
|
data/config/locales/pt-BR.yml
CHANGED
|
@@ -15,6 +15,12 @@ pt-BR:
|
|
|
15
15
|
dummy:
|
|
16
16
|
settings:
|
|
17
17
|
global:
|
|
18
|
+
guided: Entrada guiada
|
|
19
|
+
guided_help: Texto de ajuda
|
|
20
|
+
guided_readonly: Entrada desabilitada
|
|
21
|
+
guided_rich: Entrada de rich text guiada
|
|
22
|
+
guided_rich_help_html: HTML <strong>ajuda</strong> texto
|
|
23
|
+
guided_rich_readonly_html: HTML <strong>ajuda</strong> texto para entrada desativada
|
|
18
24
|
readonly_attribute: Atributo somente leitura
|
|
19
25
|
test: Teste A
|
|
20
26
|
test_choices:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sq:
|
data/config/locales/sv.yml
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
th:
|
|
@@ -49,7 +49,7 @@ module Decidim::Map::Provider
|
|
|
49
49
|
def self.add_stub(address, coordinates)
|
|
50
50
|
stubs.push(
|
|
51
51
|
properties: address.is_a?(Hash) ? address : { street: address },
|
|
52
|
-
geometry: { coordinates: coordinates }
|
|
52
|
+
geometry: { coordinates: coordinates.reverse }
|
|
53
53
|
)
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -125,7 +125,7 @@ RSpec.configure do |config|
|
|
|
125
125
|
country: "Country1"
|
|
126
126
|
},
|
|
127
127
|
geometry: {
|
|
128
|
-
coordinates: [
|
|
128
|
+
coordinates: [2.234, 1.123]
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
{
|
|
@@ -136,7 +136,7 @@ RSpec.configure do |config|
|
|
|
136
136
|
country: "Country2"
|
|
137
137
|
},
|
|
138
138
|
geometry: {
|
|
139
|
-
coordinates: [
|
|
139
|
+
coordinates: [4.456, 3.345]
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
{
|
|
@@ -148,7 +148,7 @@ RSpec.configure do |config|
|
|
|
148
148
|
country: "Country3"
|
|
149
149
|
},
|
|
150
150
|
geometry: {
|
|
151
|
-
coordinates: [
|
|
151
|
+
coordinates: [6.678, 5.567]
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
]
|
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.27.
|
|
4
|
+
version: 0.27.5
|
|
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-20 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.27.
|
|
35
|
+
version: 0.27.5
|
|
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.27.
|
|
42
|
+
version: 0.27.5
|
|
43
43
|
- !ruby/object:Gem::Dependency
|
|
44
44
|
name: factory_bot_rails
|
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -486,9 +486,11 @@ files:
|
|
|
486
486
|
- config/locales/sk.yml
|
|
487
487
|
- config/locales/sl.yml
|
|
488
488
|
- config/locales/so-SO.yml
|
|
489
|
+
- config/locales/sq-AL.yml
|
|
489
490
|
- config/locales/sr-CS.yml
|
|
490
491
|
- config/locales/sv.yml
|
|
491
492
|
- config/locales/sw-KE.yml
|
|
493
|
+
- config/locales/th-TH.yml
|
|
492
494
|
- config/locales/ti-ER.yml
|
|
493
495
|
- config/locales/tr-TR.yml
|
|
494
496
|
- config/locales/uk.yml
|
|
@@ -591,7 +593,6 @@ files:
|
|
|
591
593
|
- lib/decidim/dev/test/rspec_support/rake_tasks.rb
|
|
592
594
|
- lib/decidim/dev/test/rspec_support/route_helpers.rb
|
|
593
595
|
- lib/decidim/dev/test/rspec_support/screenshot_helper.rb
|
|
594
|
-
- lib/decidim/dev/test/rspec_support/summary_notification.rb
|
|
595
596
|
- lib/decidim/dev/test/rspec_support/time_helpers.rb
|
|
596
597
|
- lib/decidim/dev/test/rspec_support/timezone.rb
|
|
597
598
|
- lib/decidim/dev/test/rspec_support/translation_helpers.rb
|
|
@@ -603,8 +604,6 @@ files:
|
|
|
603
604
|
- lib/decidim/dev/test/spec_helper.rb
|
|
604
605
|
- lib/decidim/dev/test/w3c_rspec_validators_overrides.rb
|
|
605
606
|
- lib/decidim/dev/version.rb
|
|
606
|
-
- lib/rubocop/cop/decidim.rb
|
|
607
|
-
- lib/rubocop/cop/decidim/hash_shorthand_syntax_backports.rb
|
|
608
607
|
- lib/tasks/generators.rake
|
|
609
608
|
- lib/tasks/lighthouse_report.rake
|
|
610
609
|
- lib/tasks/locale_checker.rake
|
|
@@ -627,7 +626,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
627
626
|
- !ruby/object:Gem::Version
|
|
628
627
|
version: '0'
|
|
629
628
|
requirements: []
|
|
630
|
-
rubygems_version: 3.
|
|
629
|
+
rubygems_version: 3.4.22
|
|
631
630
|
signing_key:
|
|
632
631
|
specification_version: 4
|
|
633
632
|
summary: Decidim dev tools
|
|
@@ -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
|