decidim-dev 0.26.5 → 0.26.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/packs/entrypoints/decidim_dev_test_custom_map.js +1 -0
- data/app/packs/src/decidim/dev/test/custom_map_factory.js +55 -0
- data/config/assets.rb +2 -1
- data/config/environment.rb +0 -0
- data/config/locales/ar.yml +18 -0
- data/config/locales/de.yml +8 -0
- data/config/locales/fa-IR.yml +1 -0
- data/config/locales/kaa.yml +1 -0
- data/config/locales/ro-RO.yml +5 -0
- data/config/locales/zh-TW.yml +63 -0
- data/lib/decidim/dev/test/rspec_support/component_context.rb +20 -0
- data/lib/decidim/dev/test/rspec_support/summary_notification.rb +51 -0
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/rubocop/cop/decidim/hash_shorthand_syntax_backports.rb +175 -0
- data/lib/rubocop/cop/decidim.rb +9 -0
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34e28be72e1e7f3a59d2ff86f1b9afac792207a77e77bd200e557720f094b08b
|
4
|
+
data.tar.gz: 4530c0fa9d56be4d72dc3f31bace2ed02e641998fc8b0016a379f853107f79c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2cea558c636573b7b627a7bc8f4e125b324104cdc382d5cfd7abffe26f839d5835a2b18a9b85dfcdb897d4df20774e674071a31940ef27215db99835dd4933
|
7
|
+
data.tar.gz: 627c66d6aa499d678edae2b95353dd71a920c636d548fa29199dfb315db2a264ae44fc7ccf26a2fc31e897a9c44ca48275f745bd33f98aeac379725b007c086b
|
@@ -0,0 +1 @@
|
|
1
|
+
import "src/decidim/dev/test/custom_map_factory";
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/**
|
2
|
+
* Example of a custom map controller and how to override the
|
3
|
+
* `createMapController` factory method. To use it in the ERB view, add the
|
4
|
+
* following snippet to any view:
|
5
|
+
*
|
6
|
+
* <%= dynamic_map_for type: "custom", markers: [{ title: "Test 1", latitude: 41.385063, longitude: 2.173404 }], popup_template_id: "custom-popup" do %>
|
7
|
+
* <% javascript_pack_tag("decidim_dev_test_custom_map") %>
|
8
|
+
* <template id="custom-popup">
|
9
|
+
* <div>
|
10
|
+
* <h3>${title}</h3>
|
11
|
+
* </div>
|
12
|
+
* </template>
|
13
|
+
* <% end %>
|
14
|
+
*/
|
15
|
+
|
16
|
+
import MapMarkersController from "src/decidim/map/controller/markers";
|
17
|
+
|
18
|
+
const appendToBody = (content) => {
|
19
|
+
const p = document.createElement("p");
|
20
|
+
p.innerHTML = content;
|
21
|
+
document.body.appendChild(p);
|
22
|
+
}
|
23
|
+
|
24
|
+
class CustomMapController extends MapMarkersController {
|
25
|
+
start() {
|
26
|
+
this.markerClusters = null;
|
27
|
+
this.addMarkers(this.config.markers);
|
28
|
+
|
29
|
+
appendToBody("Custom map started");
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
const origCreateMapController = window.Decidim.createMapController;
|
34
|
+
|
35
|
+
const createMapController = (mapId, config) => {
|
36
|
+
if (config.type === "custom") {
|
37
|
+
return new CustomMapController(mapId, config);
|
38
|
+
}
|
39
|
+
|
40
|
+
return origCreateMapController(mapId, config);
|
41
|
+
}
|
42
|
+
|
43
|
+
window.Decidim.createMapController = createMapController;
|
44
|
+
|
45
|
+
// Prevent external requests to the Here URLs during tests
|
46
|
+
if (L.TileLayer.HERE) {
|
47
|
+
L.TileLayer.HERE.prototype.onAdd = function(map) {};
|
48
|
+
}
|
49
|
+
|
50
|
+
// Test that the map events are working correctly
|
51
|
+
$("[data-decidim-map]").on("ready.decidim", (ev, _map, mapConfig) => {
|
52
|
+
appendToBody("Custom map ready");
|
53
|
+
});
|
54
|
+
|
55
|
+
appendToBody("LOADED");
|
data/config/assets.rb
CHANGED
@@ -4,5 +4,6 @@ base_path = File.expand_path("..", __dir__)
|
|
4
4
|
|
5
5
|
Decidim::Webpacker.register_path("#{base_path}/app/packs")
|
6
6
|
Decidim::Webpacker.register_entrypoints(
|
7
|
-
decidim_dev: "#{base_path}/app/packs/entrypoints/decidim_dev.js"
|
7
|
+
decidim_dev: "#{base_path}/app/packs/entrypoints/decidim_dev.js",
|
8
|
+
decidim_dev_test_custom_map: "#{base_path}/app/packs/entrypoints/decidim_dev_test_custom_map.js"
|
8
9
|
)
|
File without changes
|
data/config/locales/ar.yml
CHANGED
@@ -3,6 +3,7 @@ ar:
|
|
3
3
|
attributes:
|
4
4
|
dummy_resource:
|
5
5
|
created_at: أنشئت في
|
6
|
+
decidim_scope_id: نطاق
|
6
7
|
field: مجالي
|
7
8
|
start_date: تاريخ البداية
|
8
9
|
title: العنوان
|
@@ -13,12 +14,29 @@ ar:
|
|
13
14
|
dummy:
|
14
15
|
settings:
|
15
16
|
global:
|
17
|
+
guided: المدخلات الموجهة
|
18
|
+
guided_help: نص المساعدة
|
19
|
+
guided_readonly: تعطيل الإدخال
|
20
|
+
guided_rich: مدخلات غنية موجهة
|
21
|
+
guided_rich_help_html: HTML<strong>مساعدة</strong>نص
|
22
|
+
guided_rich_readonly_html: HTML <strong>مساعدة</strong> للمدخلات المعطلة
|
23
|
+
readonly_attribute: سمة القراءة فقط
|
24
|
+
test: فحص
|
25
|
+
test_choices:
|
26
|
+
a: خيار أ
|
27
|
+
b: خيار ب
|
28
|
+
c: خيار ج
|
16
29
|
test_options:
|
17
30
|
bar: شريط
|
31
|
+
baz: الباز
|
18
32
|
foo: فو
|
19
33
|
step:
|
34
|
+
endorsements_blocked: تم حظر التأييدات
|
35
|
+
endorsements_enabled: تم تمكين التأييدات
|
36
|
+
readonly_step_attribute: سمة خطوة للقراءة فقط
|
20
37
|
test_options:
|
21
38
|
bar: شريط
|
39
|
+
baz: الباز
|
22
40
|
foo: فو
|
23
41
|
dummy:
|
24
42
|
admin:
|
data/config/locales/de.yml
CHANGED
@@ -14,6 +14,12 @@ de:
|
|
14
14
|
dummy:
|
15
15
|
settings:
|
16
16
|
global:
|
17
|
+
guided: Geführte Eingabe
|
18
|
+
guided_help: Hilfetext
|
19
|
+
guided_readonly: Deaktivierte Eingabe
|
20
|
+
guided_rich: Geführte reiche Eingabe
|
21
|
+
guided_rich_help_html: HTML <strong>Hilfe</strong> Text
|
22
|
+
guided_rich_readonly_html: HTML <strong>Hilfe</strong> Text für deaktivierte Eingabe
|
17
23
|
readonly_attribute: Attribut schreibgeschützt
|
18
24
|
test: Test A
|
19
25
|
test_choices:
|
@@ -22,6 +28,7 @@ de:
|
|
22
28
|
c: Wahl C
|
23
29
|
test_options:
|
24
30
|
bar: Bar
|
31
|
+
baz: Baz
|
25
32
|
foo: Foo
|
26
33
|
step:
|
27
34
|
endorsements_blocked: Befürwortungen blockiert
|
@@ -29,6 +36,7 @@ de:
|
|
29
36
|
readonly_step_attribute: Schritt-Attribut schreibgeschützt
|
30
37
|
test_options:
|
31
38
|
bar: Bar
|
39
|
+
baz: Baz
|
32
40
|
foo: Foo
|
33
41
|
dummy:
|
34
42
|
admin:
|
@@ -0,0 +1 @@
|
|
1
|
+
fa:
|
@@ -0,0 +1 @@
|
|
1
|
+
kaa:
|
data/config/locales/ro-RO.yml
CHANGED
@@ -14,7 +14,12 @@ ro:
|
|
14
14
|
dummy:
|
15
15
|
settings:
|
16
16
|
global:
|
17
|
+
guided: Introducere ghidată
|
17
18
|
guided_help: Text de ajutor
|
19
|
+
guided_readonly: Intrare dezactivată
|
20
|
+
guided_rich: Introducere ghidată a conținutului bogat
|
21
|
+
guided_rich_help_html: <strong>Ajutor</strong> text pentru HTML
|
22
|
+
guided_rich_readonly_html: <strong>Ajutor</strong> HTML text pentru intrare dezactivată
|
18
23
|
readonly_attribute: Atribut Readonly
|
19
24
|
test: Un test
|
20
25
|
test_choices:
|
data/config/locales/zh-TW.yml
CHANGED
@@ -1 +1,64 @@
|
|
1
1
|
zh-TW:
|
2
|
+
activemodel:
|
3
|
+
attributes:
|
4
|
+
dummy_resource:
|
5
|
+
created_at: 建立於
|
6
|
+
decidim_scope_id: 範圍
|
7
|
+
field: 我的欄位
|
8
|
+
start_date: 開始日期
|
9
|
+
title: 標題
|
10
|
+
translatable_text: 可翻譯的文字
|
11
|
+
updated_at: 更新於
|
12
|
+
decidim:
|
13
|
+
components:
|
14
|
+
dummy:
|
15
|
+
settings:
|
16
|
+
global:
|
17
|
+
guided: 導引輸入
|
18
|
+
guided_help: 說明文字
|
19
|
+
guided_readonly: 禁用輸入
|
20
|
+
guided_rich: 導引豐富輸入
|
21
|
+
guided_rich_help_html: HTML <strong>說明</strong> 文字
|
22
|
+
guided_rich_readonly_html: 禁用輸入 HTML <strong>說明</strong> 文字
|
23
|
+
readonly_attribute: 唯讀屬性
|
24
|
+
test: A 測試
|
25
|
+
test_choices:
|
26
|
+
a: A選項
|
27
|
+
b: B選項
|
28
|
+
c: C選項
|
29
|
+
test_options:
|
30
|
+
bar: Bar
|
31
|
+
baz: Baz
|
32
|
+
foo: Foo
|
33
|
+
step:
|
34
|
+
endorsements_blocked: 封鎖支持
|
35
|
+
endorsements_enabled: 啟用支持
|
36
|
+
readonly_step_attribute: 唯讀步驟屬性
|
37
|
+
test_options:
|
38
|
+
bar: Bar
|
39
|
+
baz: Baz
|
40
|
+
foo: Foo
|
41
|
+
dummy:
|
42
|
+
admin:
|
43
|
+
exports:
|
44
|
+
dummies: 測試帳戶
|
45
|
+
gamification:
|
46
|
+
badges:
|
47
|
+
test:
|
48
|
+
conditions:
|
49
|
+
- 在Decidim中使用測試環境。
|
50
|
+
description: 參與者通過建立測試可獲得此徽章。
|
51
|
+
description_another: 此參與者已建立了 %{score} 個測試。
|
52
|
+
description_own: 您已建立了 %{score} 個測試。
|
53
|
+
name: 測試
|
54
|
+
next_level_in: 再建立 %{score} 個測試即可達到下一個等級!
|
55
|
+
unearned_another: 這個參與者尚未創建任何測試。
|
56
|
+
unearned_own: 您尚未建立任何測試。
|
57
|
+
resource_links:
|
58
|
+
test_link:
|
59
|
+
dummy_resource_dummy: 相關的測試帳戶
|
60
|
+
statistics:
|
61
|
+
bar: Bar
|
62
|
+
dummies_count_high: 高級測試帳戶
|
63
|
+
dummies_count_medium: 中級測試帳戶
|
64
|
+
foo: Foo
|
@@ -1,5 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
shared_examples "has mandatory config setting" do |mandatory_field|
|
4
|
+
let(:edit_component_path) do
|
5
|
+
Decidim::EngineRouter.admin_proxy(component.participatory_space).edit_component_path(component.id)
|
6
|
+
end
|
7
|
+
|
8
|
+
before do
|
9
|
+
visit edit_component_path
|
10
|
+
component.update(settings: { mandatory_field => "" })
|
11
|
+
visit edit_component_path
|
12
|
+
end
|
13
|
+
|
14
|
+
it "does not allow updating the component" do
|
15
|
+
click_button "Update"
|
16
|
+
|
17
|
+
within ".#{mandatory_field}_container" do
|
18
|
+
expect(page).to have_content("There's an error in this field")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
3
23
|
shared_context "with a component" do
|
4
24
|
let(:manifest) { Decidim.find_component_manifest(manifest_name) }
|
5
25
|
let(:user) { create :user, :confirmed, organization: organization }
|
@@ -0,0 +1,51 @@
|
|
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
|
data/lib/decidim/dev/version.rb
CHANGED
@@ -0,0 +1,175 @@
|
|
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
|
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.8
|
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-07-27 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.8
|
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.8
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: factory_bot_rails
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -408,15 +408,18 @@ files:
|
|
408
408
|
- app/mailers/decidim/dummy_resources/dummy_resource_mailer.rb
|
409
409
|
- app/packs/entrypoints/decidim_dev.js
|
410
410
|
- app/packs/entrypoints/decidim_dev.scss
|
411
|
+
- app/packs/entrypoints/decidim_dev_test_custom_map.js
|
411
412
|
- app/packs/images/decidim/decidim_dev_dummy.svg
|
412
413
|
- app/packs/images/decidim/gamification/badges/decidim_gamification_badges_test.svg
|
413
414
|
- app/packs/src/decidim/dev/accessibility.js
|
415
|
+
- app/packs/src/decidim/dev/test/custom_map_factory.js
|
414
416
|
- app/packs/stylesheets/decidim/dev.scss
|
415
417
|
- app/packs/stylesheets/decidim/dev/_accessibility.scss
|
416
418
|
- app/views/decidim/dummy_resource/_linked_dummys.html.erb
|
417
419
|
- app/views/decidim/dummy_resources/dummy_resources/foo.html.erb
|
418
420
|
- app/views/decidim/dummy_resources/dummy_resources/show.html.erb
|
419
421
|
- config/assets.rb
|
422
|
+
- config/environment.rb
|
420
423
|
- config/locales/am-ET.yml
|
421
424
|
- config/locales/ar-SA.yml
|
422
425
|
- config/locales/ar.yml
|
@@ -439,6 +442,7 @@ files:
|
|
439
442
|
- config/locales/et-EE.yml
|
440
443
|
- config/locales/et.yml
|
441
444
|
- config/locales/eu.yml
|
445
|
+
- config/locales/fa-IR.yml
|
442
446
|
- config/locales/fi-pl.yml
|
443
447
|
- config/locales/fi-plain.yml
|
444
448
|
- config/locales/fi.yml
|
@@ -457,6 +461,7 @@ files:
|
|
457
461
|
- config/locales/it.yml
|
458
462
|
- config/locales/ja.yml
|
459
463
|
- config/locales/ka-GE.yml
|
464
|
+
- config/locales/kaa.yml
|
460
465
|
- config/locales/ko-KR.yml
|
461
466
|
- config/locales/ko.yml
|
462
467
|
- config/locales/lb-LU.yml
|
@@ -575,6 +580,7 @@ files:
|
|
575
580
|
- lib/decidim/dev/test/rspec_support/rake_tasks.rb
|
576
581
|
- lib/decidim/dev/test/rspec_support/react_select.rb
|
577
582
|
- lib/decidim/dev/test/rspec_support/route_helpers.rb
|
583
|
+
- lib/decidim/dev/test/rspec_support/summary_notification.rb
|
578
584
|
- lib/decidim/dev/test/rspec_support/time_helpers.rb
|
579
585
|
- lib/decidim/dev/test/rspec_support/timezone.rb
|
580
586
|
- lib/decidim/dev/test/rspec_support/translation_helpers.rb
|
@@ -586,6 +592,8 @@ files:
|
|
586
592
|
- lib/decidim/dev/test/spec_helper.rb
|
587
593
|
- lib/decidim/dev/test/w3c_rspec_validators_overrides.rb
|
588
594
|
- lib/decidim/dev/version.rb
|
595
|
+
- lib/rubocop/cop/decidim.rb
|
596
|
+
- lib/rubocop/cop/decidim/hash_shorthand_syntax_backports.rb
|
589
597
|
- lib/tasks/generators.rake
|
590
598
|
- lib/tasks/locale_checker.rake
|
591
599
|
homepage: https://github.com/decidim/decidim
|