govuk_tech_docs 6.4.0.beta → 6.4.1.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/.github/dependabot.yml +15 -14
- data/.github/workflows/npm-vulnerability-scanner.yaml +55 -0
- data/.github/workflows/pipeline.yaml +9 -3
- data/.github/workflows/publish-gem.yaml +9 -0
- data/.github/workflows/publish-github-pages.yaml +1 -1
- data/.github/workflows/ruby-vulnerability-scanner.yaml +44 -0
- data/.github/workflows/test.yaml +1 -0
- data/CHANGELOG.md +7 -1
- data/README.md +3 -0
- data/documentation/config/tech-docs.yml +1 -1
- data/documentation/source/configure_project/global_configuration/index.html.md.erb +9 -1
- data/lib/govuk_tech_docs/contribution_banner.rb +15 -3
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/tasks/lint.rake +87 -13
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/_index.import.scss +2 -0
- data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +2 -0
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_mixin.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_feedback.import.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_index.import.scss +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_index.scss +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_mixin.scss +48 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_mixin.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_index.import.scss +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_index.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_language-navigation.import.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_mixin.scss +68 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_mixin.scss +48 -3
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.mixin.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.mixin.scss +1 -0
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +16 -2
- data/package-lock.json +60 -60
- data/package.json +1 -1
- metadata +11 -2
- data/.github/workflows/dependency-review.yaml +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f326d15a8bd80fdec03049e06969fa49df12a72e1379c0638c32b6438553491
|
|
4
|
+
data.tar.gz: a51886d4182c8938ae188075568fd92028bf1899b410d0caaff864612ec17763
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48c680742a7eb673015b3d4c0d0e84d11e2f3bd220ba99a50aace843c110d8eb756ec3ed599242e9290e2f9ab407090115961f685407d44edd6545b4186f2d87
|
|
7
|
+
data.tar.gz: 223a5bf9bfa71d7977a83d5fc1c8f45d3aec88e0f7270688c0d03d7f6eb1952aa540a2424fe938992b8a0c455c52a37b3d437500fdec3deffb4a2ecc049b4b8a
|
data/.github/dependabot.yml
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
-
|
|
6
1
|
version: 2
|
|
7
2
|
updates:
|
|
8
3
|
# 1. Update Ruby dependencies (Gemfile/gemspec) in the root
|
|
@@ -12,9 +7,11 @@ updates:
|
|
|
12
7
|
interval: "weekly"
|
|
13
8
|
day: "monday"
|
|
14
9
|
time: "06:00"
|
|
10
|
+
# Essential for gem projects without a Gemfile.lock:
|
|
11
|
+
versioning-strategy: "increase"
|
|
15
12
|
commit-message:
|
|
16
13
|
prefix: chore
|
|
17
|
-
open-pull-requests-limit:
|
|
14
|
+
open-pull-requests-limit: 5
|
|
18
15
|
groups:
|
|
19
16
|
prod-safe-updates:
|
|
20
17
|
dependency-type: "production"
|
|
@@ -23,9 +20,15 @@ updates:
|
|
|
23
20
|
update-types:
|
|
24
21
|
- "minor"
|
|
25
22
|
- "patch"
|
|
23
|
+
dev-safe-updates:
|
|
24
|
+
dependency-type: "development"
|
|
25
|
+
patterns:
|
|
26
|
+
- "*"
|
|
27
|
+
update-types:
|
|
28
|
+
- "minor"
|
|
29
|
+
- "patch"
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
# 2. Update GitHub Actions (keeps your CI workflows secure)
|
|
31
|
+
# 2. Update GitHub Actions
|
|
29
32
|
- package-ecosystem: "github-actions"
|
|
30
33
|
directory: "/"
|
|
31
34
|
schedule:
|
|
@@ -39,15 +42,15 @@ updates:
|
|
|
39
42
|
patterns:
|
|
40
43
|
- "*"
|
|
41
44
|
|
|
45
|
+
# 3. Update npm dependencies
|
|
42
46
|
- package-ecosystem: "npm"
|
|
43
|
-
directory: "/"
|
|
47
|
+
directory: "/"
|
|
44
48
|
schedule:
|
|
45
49
|
interval: "weekly"
|
|
46
50
|
day: "monday"
|
|
47
51
|
time: "06:00"
|
|
48
|
-
open-pull-requests-limit:
|
|
52
|
+
open-pull-requests-limit: 5
|
|
49
53
|
groups:
|
|
50
|
-
# Group all "development" dependencies (linters, test runners, etc.)
|
|
51
54
|
dev-dependencies:
|
|
52
55
|
dependency-type: "development"
|
|
53
56
|
patterns:
|
|
@@ -55,12 +58,10 @@ updates:
|
|
|
55
58
|
update-types:
|
|
56
59
|
- "patch"
|
|
57
60
|
- "minor"
|
|
58
|
-
# Group all "production" dependencies (react, express, etc.)
|
|
59
|
-
# but ONLY for minor/patch versions to avoid breaking changes
|
|
60
61
|
prod-safe-updates:
|
|
61
62
|
dependency-type: "production"
|
|
62
63
|
patterns:
|
|
63
64
|
- "*"
|
|
64
65
|
update-types:
|
|
65
66
|
- "patch"
|
|
66
|
-
- "minor"
|
|
67
|
+
- "minor"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: NPM Audit Security Check
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
npm-audit:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout Code
|
|
15
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
cache: 'npm'
|
|
22
|
+
|
|
23
|
+
- name: Run NPM Audit & Generate Summary
|
|
24
|
+
run: |
|
|
25
|
+
# 1. Run npm audit in JSON mode to capture raw audit metadata
|
|
26
|
+
AUDIT_JSON=$(npm audit --audit-level=high --json 2>/dev/null) || true
|
|
27
|
+
|
|
28
|
+
# 2. Extract counts using node's built-in JSON parser
|
|
29
|
+
CRITICAL_COUNT=$(echo "$AUDIT_JSON" | node -e "let d=''; process.stdin.on('data', c => d += c); process.stdin.on('end', () => { try { console.log(JSON.parse(d).metadata.vulnerabilities.critical || 0) } catch { console.log(0) } })")
|
|
30
|
+
HIGH_COUNT=$(echo "$AUDIT_JSON" | node -e "let d=''; process.stdin.on('data', c => d += c); process.stdin.on('end', () => { try { console.log(JSON.parse(d).metadata.vulnerabilities.high || 0) } catch { console.log(0) } })")
|
|
31
|
+
|
|
32
|
+
# 3. Build GitHub Job Summary Markdown
|
|
33
|
+
echo "## 🛡️ NPM Dependency Audit Summary" >> $GITHUB_STEP_SUMMARY
|
|
34
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
35
|
+
|
|
36
|
+
if [ "$CRITICAL_COUNT" -eq 0 ] && [ "$HIGH_COUNT" -eq 0 ]; then
|
|
37
|
+
echo "✅ **No high or critical vulnerabilities found!** All JS packages passed security checks." >> $GITHUB_STEP_SUMMARY
|
|
38
|
+
else
|
|
39
|
+
echo "⚠️ **High/Critical Vulnerabilities Detected in npm Dependencies**" >> $GITHUB_STEP_SUMMARY
|
|
40
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
41
|
+
echo "| Vulnerability Severity | Total Count |" >> $GITHUB_STEP_SUMMARY
|
|
42
|
+
echo "| :--- | :--- |" >> $GITHUB_STEP_SUMMARY
|
|
43
|
+
echo "| 🔴 **Critical** | $CRITICAL_COUNT \vert{}" >> $GITHUB_STEP_SUMMARY
|
|
44
|
+
echo "| 🟠 **High** | $HIGH_COUNT \vert{}" >> $GITHUB_STEP_SUMMARY
|
|
45
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
46
|
+
echo "### Detailed Audit Report" >> $GITHUB_STEP_SUMMARY
|
|
47
|
+
echo '```text' >> $GITHUB_STEP_SUMMARY
|
|
48
|
+
# Output human-readable audit text into the summary block
|
|
49
|
+
npm audit --audit-level=high 2>/dev/null || true
|
|
50
|
+
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
51
|
+
|
|
52
|
+
# 4. Fail the workflow step
|
|
53
|
+
echo "::error::npm audit detected $CRITICAL_COUNT critical and $HIGH_COUNT high vulnerabilities."
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
@@ -6,13 +6,19 @@ on:
|
|
|
6
6
|
branches: [ "main"]
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
|
-
|
|
10
|
-
uses: ./.github/workflows/
|
|
9
|
+
npm-vulnerability-scanner:
|
|
10
|
+
uses: ./.github/workflows/npm-vulnerability-scanner.yaml
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
ruby-vulnerability-scanner:
|
|
15
|
+
needs: npm-vulnerability-scanner
|
|
16
|
+
uses: ./.github/workflows/ruby-vulnerability-scanner.yaml
|
|
11
17
|
permissions:
|
|
12
18
|
contents: read
|
|
13
19
|
|
|
14
20
|
test:
|
|
15
|
-
needs:
|
|
21
|
+
needs: ruby-vulnerability-scanner
|
|
16
22
|
uses: ./.github/workflows/test.yaml
|
|
17
23
|
permissions:
|
|
18
24
|
contents: read # Allows the action to check out your repository code
|
|
@@ -40,6 +40,15 @@ jobs:
|
|
|
40
40
|
ruby-version: '3'
|
|
41
41
|
bundler-cache: true
|
|
42
42
|
|
|
43
|
+
- name: Verify Secret Presence
|
|
44
|
+
run: |
|
|
45
|
+
if [ -z "${{ secrets.RUBYGEMS_API_KEY }}" ]; then
|
|
46
|
+
echo "Error: Secret is empty or missing from this context!"
|
|
47
|
+
exit 1
|
|
48
|
+
else
|
|
49
|
+
echo "Secret is populated."
|
|
50
|
+
fi
|
|
51
|
+
|
|
43
52
|
- name: Publish
|
|
44
53
|
env:
|
|
45
54
|
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Ruby vulnerability scanner
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
bundler-audit:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout Code
|
|
15
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
16
|
+
|
|
17
|
+
- name: Setup Ruby
|
|
18
|
+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: '3.3'
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Run Audit Check
|
|
24
|
+
run: |
|
|
25
|
+
gem install bundler-audit
|
|
26
|
+
|
|
27
|
+
# Run audit and save output to file (preventing immediate job failure via || true)
|
|
28
|
+
bundle-audit check --update > audit_results.txt || AUDIT_EXIT_CODE=$?
|
|
29
|
+
|
|
30
|
+
echo "## 🛡️ Ruby Dependency Audit Summary" >> $GITHUB_STEP_SUMMARY
|
|
31
|
+
|
|
32
|
+
if [ -z "$AUDIT_EXIT_CODE" ]; then
|
|
33
|
+
echo "::notice::No vulnerabilities found in Ruby dependencies."
|
|
34
|
+
echo "✅ **No vulnerabilities found!** All resolved gems from your `.gemspec` passed security checks." >> $GITHUB_STEP_SUMMARY
|
|
35
|
+
else
|
|
36
|
+
echo "⚠️ **Vulnerabilities Detected in Ruby Dependencies**" >> $GITHUB_STEP_SUMMARY
|
|
37
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
38
|
+
echo '```text' >> $GITHUB_STEP_SUMMARY
|
|
39
|
+
cat audit_results.txt >> $GITHUB_STEP_SUMMARY
|
|
40
|
+
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
41
|
+
|
|
42
|
+
# Fail the step if vulnerabilities were found
|
|
43
|
+
exit $AUDIT_EXIT_CODE
|
|
44
|
+
fi
|
data/.github/workflows/test.yaml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
## Unreleased changes
|
|
2
2
|
|
|
3
|
-
## 6.
|
|
3
|
+
## 6.4.1
|
|
4
|
+
|
|
5
|
+
- Bugfix: [Issue 283](https://github.com/alphagov/tech-docs-gem/issues/283) - correctly read report issue url (backwards compatible)
|
|
6
|
+
- Update: [Issue 543](https://github.com/alphagov/tech-docs-gem/issues/543) - allow full git urls as well as just repository name for report issue url
|
|
7
|
+
- [PR 542](https://github.com/alphagov/tech-docs-gem/pull/542) to improve vale linter handling and output when using rake task
|
|
8
|
+
|
|
9
|
+
## 6.4.0.beta
|
|
4
10
|
|
|
5
11
|
- [Remove govuk wrapper class](https://github.com/alphagov/tech-docs-gem/pull/530) that introduced extra padding
|
|
6
12
|
- Update[ template html syntax](https://github.com/alphagov/tech-docs-gem/pull/520) to more closely match gov.uk design template
|
data/README.md
CHANGED
|
@@ -45,6 +45,9 @@ The linting job can take the following optional parameters:
|
|
|
45
45
|
| `clean_build` | If true runs `bundle exec middleman build` to create a clean build. | 'true' |
|
|
46
46
|
| `full_output` | If true the full report is printed to the console, otherwise only the summary is displayed. | 'true' |
|
|
47
47
|
|
|
48
|
+
|
|
49
|
+
If running the linter causes timeouts or crashes, you can use `bundle exec tech_docs_jobs lint:debug`. You should use this locally, not as part of a pipeline.
|
|
50
|
+
|
|
48
51
|
## GOV.UK frontend
|
|
49
52
|
|
|
50
53
|
This gem uses [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend), part of
|
|
@@ -29,7 +29,7 @@ collapsible_nav: true
|
|
|
29
29
|
|
|
30
30
|
# Show links to contribute on GitHub
|
|
31
31
|
show_contribution_banner: true
|
|
32
|
-
github_repo: https://github.com/alphagov/tech-docs-gem
|
|
32
|
+
github_repo: https://github.com/alphagov/tech-docs-gem
|
|
33
33
|
|
|
34
34
|
# Enable search
|
|
35
35
|
enable_search: true
|
|
@@ -211,12 +211,20 @@ show_contribution_banner: true
|
|
|
211
211
|
|
|
212
212
|
### github_repo
|
|
213
213
|
|
|
214
|
-
Your documentation project's GitHub repository. You must
|
|
214
|
+
Your documentation project's GitHub repository. You must configure this if you have enabled [show_contribution_banner].
|
|
215
|
+
|
|
216
|
+
Set this to either the repository's `owner/name` or its full GitHub URL. Link to the repository itself, rather than a file or directory, because the contribution banner builds its links relative to this URL.
|
|
215
217
|
|
|
216
218
|
```yaml
|
|
217
219
|
github_repo: alphagov/example-repo
|
|
218
220
|
```
|
|
219
221
|
|
|
222
|
+
You can also use the full URL:
|
|
223
|
+
|
|
224
|
+
```yaml
|
|
225
|
+
github_repo: https://github.com/alphagov/example-repo
|
|
226
|
+
```
|
|
227
|
+
|
|
220
228
|
### github_branch
|
|
221
229
|
|
|
222
230
|
Your project's GitHub default branch name. You can change this if your default branch is not named main.
|
|
@@ -19,7 +19,8 @@ module GovukTechDocs
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def report_issue_url
|
|
22
|
-
url = config[:source_urls]&.[](:report_issue_url)
|
|
22
|
+
url = config[:tech_docs][:source_urls]&.[](:report_issue_url)
|
|
23
|
+
url ||= config[:source_urls]&.[](:report_issue_url)
|
|
23
24
|
params = {
|
|
24
25
|
body: "Problem with '#{current_page.data.title}' (#{config[:tech_docs][:host]}#{current_page.url})",
|
|
25
26
|
}
|
|
@@ -35,11 +36,22 @@ module GovukTechDocs
|
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def repo_url
|
|
38
|
-
|
|
39
|
+
github_repo = config[:tech_docs][:github_repo]
|
|
40
|
+
if github_repo.nil? || github_repo.empty?
|
|
41
|
+
raise ArgumentError, "github_repo value not found in config/tech-docs.yml"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
repo_url = if github_repo.match?(%r{\Ahttps://github\.com/}i)
|
|
45
|
+
github_repo
|
|
46
|
+
else
|
|
47
|
+
"https://github.com/#{github_repo}"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
repo_url.delete_suffix("/")
|
|
39
51
|
end
|
|
40
52
|
|
|
41
53
|
def repo_branch
|
|
42
|
-
config[:tech_docs][:github_branch] || "master"
|
|
54
|
+
config[:tech_docs][:github_branch] || "master"
|
|
43
55
|
end
|
|
44
56
|
|
|
45
57
|
private
|
data/lib/tasks/lint.rake
CHANGED
|
@@ -1,33 +1,107 @@
|
|
|
1
1
|
# Rakefile
|
|
2
2
|
require "json"
|
|
3
|
-
require "
|
|
3
|
+
require "timeout" # Built into standard Ruby
|
|
4
4
|
require_relative "./helpers/rake_utils"
|
|
5
5
|
require_relative "./helpers/vale_report"
|
|
6
6
|
|
|
7
7
|
namespace :lint do
|
|
8
|
-
|
|
9
|
-
desc "Run tech-docs-linter to check content against GOV.UK style guide."
|
|
8
|
+
desc "Run linter to check content against GOV.UK style guide."
|
|
10
9
|
task :vale, [:target, :clean_build, :full_output] do |_t, args|
|
|
11
10
|
args.with_defaults(target: "./build", clean_build: "true", full_output: "true")
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
Rake::Task["middleman:build"].invoke if args.clean_build == "true"
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
files = Dir.glob("#{args.target}/**/*.{html,md}")
|
|
15
|
+
puts "Running Vale against #{files.count} files...\n\n"
|
|
16
|
+
|
|
17
|
+
combined_json = {}
|
|
18
|
+
|
|
19
|
+
files.each do |file|
|
|
20
|
+
print "Linting #{file}... "
|
|
21
|
+
|
|
22
|
+
file_output = ""
|
|
23
|
+
|
|
24
|
+
# IO.popen runs the command and exposes the Process ID (PID)
|
|
25
|
+
IO.popen(["vale", "--config=#{vale_config_path}", "--output=JSON", file]) do |io|
|
|
26
|
+
begin
|
|
27
|
+
# If a file takes longer than 10 seconds, raise a timeout
|
|
28
|
+
Timeout.timeout(10) do
|
|
29
|
+
file_output = io.read
|
|
30
|
+
end
|
|
31
|
+
# If we reach here, it finished safely
|
|
32
|
+
puts "\e[32mDone\e[0m"
|
|
33
|
+
rescue Timeout::Error
|
|
34
|
+
# The regex hung. Send a SIGKILL to the Vale process to stop it chewing CPU
|
|
35
|
+
Process.kill("KILL", io.pid)
|
|
36
|
+
puts "\e[31mHUNG (Skipped due to timeout)\e[0m" # Red text
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Merge JSON only if we got a valid response (ignores timeouts)
|
|
41
|
+
unless file_output.strip.empty?
|
|
42
|
+
parsed_output = JSON.parse(file_output)
|
|
43
|
+
combined_json.merge!(parsed_output) unless parsed_output.empty?
|
|
44
|
+
end
|
|
17
45
|
end
|
|
18
46
|
|
|
19
|
-
|
|
47
|
+
puts "\nGenerating report..."
|
|
20
48
|
|
|
21
|
-
linter_report = ValeLinterReport.new(
|
|
49
|
+
linter_report = ValeLinterReport.new(combined_json.to_json)
|
|
22
50
|
linter_report.format_linter_output
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
end
|
|
51
|
+
|
|
52
|
+
puts linter_report.get_linter_full_report if args.full_output == "true"
|
|
26
53
|
puts linter_report.get_linter_summary_report
|
|
27
54
|
|
|
28
|
-
# finish with a Ci friendly json string
|
|
29
55
|
linter_report.linter_summary_report_json
|
|
30
|
-
# Always exit 0 so individual project pipelines can evaluate the data themselves
|
|
31
56
|
exit 0
|
|
32
57
|
end
|
|
58
|
+
|
|
59
|
+
desc "Debug Vale to find which rule hangs on a specific file."
|
|
60
|
+
require 'timeout'
|
|
61
|
+
|
|
62
|
+
desc "Debug specific Vale rules for regex hangs"
|
|
63
|
+
task :debug, [:rules] do |_, args|
|
|
64
|
+
# Accepts Rake args (rake "debug[Rule1,Rule2]") or ENV vars (rake debug RULES=Rule1,Rule2)
|
|
65
|
+
raw_input = args[:rules] || ENV['RULES']
|
|
66
|
+
|
|
67
|
+
if raw_input.nil? || raw_input.strip.empty?
|
|
68
|
+
abort "Please provide rules to test. \nUsage: rake \"debug[Rule1,Rule2]\" OR rake debug RULES=Rule1,Rule2"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Split by comma, remove whitespace, and drop any empty strings
|
|
72
|
+
rules = raw_input.split(',').map(&:strip).reject(&:empty?)
|
|
73
|
+
|
|
74
|
+
style_prefix = 'style-guide'
|
|
75
|
+
target_file = './build/search/index.html'
|
|
76
|
+
|
|
77
|
+
puts "Hunting for the hanging regex in #{target_file}..."
|
|
78
|
+
puts "Testing #{rules.size} rule(s): #{rules.join(', ')}\n\n"
|
|
79
|
+
|
|
80
|
+
rules.each do |rule_name|
|
|
81
|
+
full_rule = "#{style_prefix}.#{rule_name}"
|
|
82
|
+
print "Testing #{full_rule}... "
|
|
83
|
+
filter_string = ".Name=='#{full_rule}'"
|
|
84
|
+
|
|
85
|
+
# Run Vale for just this single rule
|
|
86
|
+
IO.popen(["vale", "--filter=#{filter_string}", "--output=line", target_file]) do |io|
|
|
87
|
+
begin
|
|
88
|
+
# If the regex loops catastrophically, it hits this 5-second limit
|
|
89
|
+
Timeout.timeout(5) do
|
|
90
|
+
io.read
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# If it finishes within 5 seconds, the rule is safe
|
|
94
|
+
puts "\e[32mPassed (No hang)\e[0m"
|
|
95
|
+
|
|
96
|
+
rescue Timeout::Error
|
|
97
|
+
# The regex froze! Kill the underlying process to save CPU and flag it
|
|
98
|
+
Process.kill("KILL", io.pid)
|
|
99
|
+
puts "\e[31m💥 HUNG! (This is the broken regex)\e[0m"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
exit 0
|
|
105
|
+
end
|
|
106
|
+
|
|
33
107
|
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
const version = '6.
|
|
7
|
+
const version = '6.5.1';
|
|
8
8
|
|
|
9
9
|
function getBreakpoint(name) {
|
|
10
10
|
const property = `--govuk-breakpoint-${name}`;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@import "error-message";
|
|
11
11
|
@import "error-summary";
|
|
12
12
|
@import "exit-this-page";
|
|
13
|
+
@import "feedback";
|
|
13
14
|
@import "fieldset";
|
|
14
15
|
@import "file-upload";
|
|
15
16
|
@import "footer";
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
@import "input";
|
|
20
21
|
@import "inset-text";
|
|
21
22
|
@import "label";
|
|
23
|
+
@import "language-navigation";
|
|
22
24
|
@import "notification-banner";
|
|
23
25
|
@import "pagination";
|
|
24
26
|
@import "panel";
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@use "error-message";
|
|
11
11
|
@use "error-summary";
|
|
12
12
|
@use "exit-this-page";
|
|
13
|
+
@use "feedback";
|
|
13
14
|
@use "fieldset";
|
|
14
15
|
@use "file-upload";
|
|
15
16
|
@use "footer";
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
@use "input";
|
|
20
21
|
@use "inset-text";
|
|
21
22
|
@use "label";
|
|
23
|
+
@use "language-navigation";
|
|
22
24
|
@use "notification-banner";
|
|
23
25
|
@use "pagination";
|
|
24
26
|
@use "panel";
|
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
color: base.govuk-functional-colour(surface-text);
|
|
18
18
|
background-color: base.govuk-functional-colour(surface-background);
|
|
19
|
+
|
|
20
|
+
@media print {
|
|
21
|
+
border-bottom-color: currentcolor;
|
|
22
|
+
color: base.govuk-functional-colour(print-text);
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
// Support older browsers which don't hide elements with the `hidden` attribute
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@use "../../base";
|
|
2
|
+
|
|
3
|
+
/// @access private
|
|
4
|
+
@mixin styles {
|
|
5
|
+
.govuk-feedback {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
// Tie left/right padding to page gutter as it stretches across the whole
|
|
8
|
+
// screen on smaller screens
|
|
9
|
+
padding: base.govuk-spacing(4) base.$govuk-gutter-half base.govuk-spacing(5);
|
|
10
|
+
border-top: 1px solid;
|
|
11
|
+
border-color: base.govuk-functional-colour("brand");
|
|
12
|
+
background-color: base.govuk-functional-colour("surface-background");
|
|
13
|
+
|
|
14
|
+
@media #{base.govuk-from-breakpoint(tablet)} {
|
|
15
|
+
padding-right: base.govuk-spacing(4);
|
|
16
|
+
padding-left: base.govuk-spacing(4);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Override $govuk-width-container's left and right margin as we want Feedback
|
|
20
|
+
// to go across the whole screen on smaller screens
|
|
21
|
+
@media #{base.govuk-until-breakpoint(tablet)} {
|
|
22
|
+
margin-right: 0;
|
|
23
|
+
margin-left: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media print {
|
|
27
|
+
border-color: currentcolor;
|
|
28
|
+
background-color: transparent;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.govuk-feedback__title {
|
|
33
|
+
@include base.govuk-font($size: 24, $weight: bold);
|
|
34
|
+
margin-top: 0;
|
|
35
|
+
color: base.govuk-functional-colour(text);
|
|
36
|
+
@include base.govuk-responsive-margin(1, "bottom");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Removes the bottom margin from the final child element eg: a paragraph
|
|
40
|
+
//
|
|
41
|
+
// Feedback body doesn't have any opinions about typography. Instead we defer
|
|
42
|
+
// to users to use typography classes in their input, or apply a `govuk-body`
|
|
43
|
+
// paragraph for if users pass `text`.
|
|
44
|
+
.govuk-feedback__body > :last-child {
|
|
45
|
+
margin-bottom: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
border-top-color: base.govuk-functional-colour(brand);
|
|
20
20
|
color: $govuk-footer-text;
|
|
21
21
|
background: base.govuk-functional-colour(template-background);
|
|
22
|
+
|
|
23
|
+
@media print {
|
|
24
|
+
border-top-color: currentcolor;
|
|
25
|
+
color: base.govuk-functional-colour(text);
|
|
26
|
+
background-color: transparent;
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
.govuk-footer__crown {
|