govuk_publishing_components 23.11.0 → 23.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -0
- data/app/models/govuk_publishing_components/audit_applications.rb +12 -5
- data/app/models/govuk_publishing_components/audit_comparer.rb +12 -0
- data/app/views/govuk_publishing_components/audit/show.html.erb +15 -0
- data/config/locales/cy.yml +1 -1
- data/config/locales/en.yml +1 -1
- data/lib/govuk_publishing_components/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: bfc403e4ae4e502dac4d0bbc51a5e3c0e454097ea602ef00a1cf0fd3e1ff98fb
|
4
|
+
data.tar.gz: 2b19a5969e18d37c3643fc800fb24a549487af3443074e7729d541184e16c315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e9e7ee289c6a1cb4be8fdfba47fe6ca937654ee7fb379c8b1c2b88ff9a2cb890187a9ff7a2b5f850f17ef051f2b6d6e89fc3541acd8317aa7e991f52e6d10a0
|
7
|
+
data.tar.gz: e35c4c8554dbac78e610c31423d3b7e97f1bc8bfce31a32d3340ce99424d034694fbe868f0d70358d56b61604bfe5374d7be1d20b911b67539c6c9b93f1038a0
|
@@ -21,12 +21,15 @@ module GovukPublishingComponents
|
|
21
21
|
collections-publisher
|
22
22
|
content-data-admin
|
23
23
|
content-publisher
|
24
|
+
datagovuk_find
|
24
25
|
email-alert-frontend
|
25
26
|
feedback
|
26
27
|
finder-frontend
|
27
28
|
frontend
|
28
29
|
government-frontend
|
29
30
|
govspeak-preview
|
31
|
+
govuk-account-manager-prototype
|
32
|
+
govuk-coronavirus-vulnerable-people-form
|
30
33
|
info-frontend
|
31
34
|
licence-finder
|
32
35
|
manuals-frontend
|
@@ -7,6 +7,7 @@ module GovukPublishingComponents
|
|
7
7
|
application_found = application_exists(path)
|
8
8
|
components_found = []
|
9
9
|
@gem_style_references = []
|
10
|
+
@jquery_references = []
|
10
11
|
|
11
12
|
if application_found
|
12
13
|
templates = Dir["#{path}/app/views/**/*.erb"]
|
@@ -65,6 +66,7 @@ module GovukPublishingComponents
|
|
65
66
|
application_found: application_found,
|
66
67
|
components_found: components_found,
|
67
68
|
gem_style_references: @gem_style_references.flatten.uniq.sort,
|
69
|
+
jquery_references: @jquery_references.flatten.uniq.sort,
|
68
70
|
}
|
69
71
|
end
|
70
72
|
|
@@ -76,8 +78,14 @@ module GovukPublishingComponents
|
|
76
78
|
files.each do |file|
|
77
79
|
src = File.read(file)
|
78
80
|
components_found << find_match(find, src, type)
|
79
|
-
|
80
|
-
|
81
|
+
|
82
|
+
if type == "javascripts"
|
83
|
+
jquery_references = find_code_references(file, src, /\$\(/)
|
84
|
+
@jquery_references << jquery_references if jquery_references
|
85
|
+
else
|
86
|
+
gem_style_references = find_code_references(file, src, /gem-c-[-_a-zA-Z]+/)
|
87
|
+
@gem_style_references << gem_style_references if gem_style_references
|
88
|
+
end
|
81
89
|
rescue StandardError
|
82
90
|
puts "File #{file} not found"
|
83
91
|
end
|
@@ -99,11 +107,10 @@ module GovukPublishingComponents
|
|
99
107
|
all_matches
|
100
108
|
end
|
101
109
|
|
102
|
-
def
|
103
|
-
find_gem_classes = /gem-c-[-_a-zA-Z]+/
|
110
|
+
def find_code_references(file, src, regex)
|
104
111
|
clean_file_path = /(?<=#{Regexp.escape(@path)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
|
105
112
|
|
106
|
-
return file[clean_file_path] if
|
113
|
+
return file[clean_file_path] if regex.match?(src)
|
107
114
|
end
|
108
115
|
|
109
116
|
def clean_file_name(name)
|
@@ -37,6 +37,7 @@ module GovukPublishingComponents
|
|
37
37
|
warnings << warn_about_missing_components(result[:components_found])
|
38
38
|
warnings << warn_about_missing_assets(result[:components_found])
|
39
39
|
warnings << warn_about_style_overrides(result[:gem_style_references])
|
40
|
+
warnings << warn_about_jquery_references(result[:jquery_references])
|
40
41
|
warnings = warnings.flatten
|
41
42
|
|
42
43
|
data << {
|
@@ -67,6 +68,7 @@ module GovukPublishingComponents
|
|
67
68
|
warnings: warnings,
|
68
69
|
warning_count: warnings.length,
|
69
70
|
gem_style_references: result[:gem_style_references],
|
71
|
+
jquery_references: result[:jquery_references],
|
70
72
|
}
|
71
73
|
else
|
72
74
|
data << {
|
@@ -163,6 +165,16 @@ module GovukPublishingComponents
|
|
163
165
|
warnings
|
164
166
|
end
|
165
167
|
|
168
|
+
def warn_about_jquery_references(results)
|
169
|
+
warnings = []
|
170
|
+
|
171
|
+
results.each do |result|
|
172
|
+
warnings << create_warning("Possible jQuery", result)
|
173
|
+
end
|
174
|
+
|
175
|
+
warnings
|
176
|
+
end
|
177
|
+
|
166
178
|
def find_missing(needle, haystack)
|
167
179
|
(haystack - needle).flatten.sort
|
168
180
|
end
|
@@ -109,6 +109,21 @@
|
|
109
109
|
<% end %>
|
110
110
|
</ul>
|
111
111
|
<% end %>
|
112
|
+
|
113
|
+
<% if application[:jquery_references].any? %>
|
114
|
+
<%= render "govuk_publishing_components/components/heading", {
|
115
|
+
text: "jQuery references",
|
116
|
+
font_size: "m",
|
117
|
+
margin_bottom: 4,
|
118
|
+
heading_level: 3,
|
119
|
+
} %>
|
120
|
+
<p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
|
121
|
+
<ul class="govuk-list govuk-list--bullet">
|
122
|
+
<% application[:jquery_references].each do |ref| %>
|
123
|
+
<li><%= ref %></li>
|
124
|
+
<% end %>
|
125
|
+
</ul>
|
126
|
+
<% end %>
|
112
127
|
<% else %>
|
113
128
|
<p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
|
114
129
|
<% end %>
|
data/config/locales/cy.yml
CHANGED
data/config/locales/en.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 23.11.
|
4
|
+
version: 23.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|