Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAU: Check internal and external links #701

Merged
merged 9 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
# Include the tech docs gem
gem 'govuk_tech_docs'

# Include linter to check for dead internal links
gem 'html-proofer', '~> 3.19.4'
105 changes: 64 additions & 41 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
GEM
mrwilson marked this conversation as resolved.
Show resolved Hide resolved
remote: https://rubygems.org/
specs:
activesupport (5.2.8.1)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.8.1)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
autoprefixer-rails (10.4.7.0)
autoprefixer-rails (10.4.13.0)
execjs (~> 2)
backports (3.23.0)
backports (3.24.1)
chronic (0.10.2)
chunky_png (1.4.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
commonmarker (0.23.7)
commonmarker (0.23.9)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
Expand All @@ -30,19 +30,21 @@ GEM
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
concurrent-ruby (1.2.0)
contracts (0.13.0)
concurrent-ruby (1.2.2)
contracts (0.16.1)
dotenv (2.8.1)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
erubis (2.7.0)
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.8.1)
fast_blank (1.0.1)
fastimage (2.2.6)
ffi (1.15.5)
govuk_tech_docs (3.3.0)
govuk_tech_docs (3.3.1)
autoprefixer-rails (~> 10.2)
chronic (~> 0.10.2)
middleman (~> 4.0)
Expand All @@ -61,57 +63,68 @@ GEM
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.6.0)
html-proofer (3.19.4)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogiri (~> 1.13)
parallel (~> 1.10)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
http_parser.rb (0.8.0)
i18n (0.9.5)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
kramdown (2.4.0)
rexml
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
memoist (0.16.2)
middleman (4.3.11)
mercenary (0.4.0)
middleman (4.4.3)
coffee-script (~> 2.2)
haml (>= 4.0.5)
haml (>= 4.0.5, < 6.0)
kramdown (>= 2.3.0)
middleman-cli (= 4.3.11)
middleman-core (= 4.3.11)
middleman-cli (= 4.4.3)
middleman-core (= 4.4.3)
middleman-autoprefixer (2.10.0)
autoprefixer-rails (>= 9.1.4)
middleman-core (>= 3.3.3)
middleman-cli (4.3.11)
middleman-cli (4.4.3)
thor (>= 0.17.0, < 2.0)
middleman-compass (4.0.1)
compass (>= 1.0.0, < 2.0.0)
middleman-core (>= 4.0.0)
middleman-core (4.3.11)
activesupport (>= 4.2, < 6.0)
addressable (~> 2.3)
middleman-core (4.4.3)
activesupport (>= 6.1, < 7.1)
addressable (~> 2.4)
backports (~> 3.6)
bundler
contracts (~> 0.13.0)
bundler (~> 2.0)
contracts (~> 0.13)
dotenv
erubis
execjs (~> 2.0)
fast_blank
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 0.9.0)
listen (~> 3.0.0)
i18n (~> 1.6.0)
listen (~> 3.0)
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
padrino-helpers (~> 0.15.0)
parallel
rack (>= 1.4.5, < 3)
sassc (~> 2.0)
servolux
tilt (~> 2.0.9)
toml
uglifier (~> 3.0)
webrick
middleman-livereload (3.4.7)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
rack-livereload (~> 0.3.15)
middleman-search-gds (0.11.1)
middleman-search-gds (0.11.2)
execjs (~> 2.6)
middleman-core (>= 3.2)
nokogiri (~> 1.6)
Expand All @@ -122,25 +135,26 @@ GEM
middleman-core (>= 3.2)
rouge (~> 3.2)
mini_portile2 (2.8.1)
minitest (5.17.0)
minitest (5.18.0)
multi_json (1.15.0)
nokogiri (1.14.0)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
openapi3_parser (0.9.2)
commonmarker (~> 0.17)
padrino-helpers (0.13.3.4)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.4)
padrino-helpers (0.15.3)
i18n (>= 0.6.7, < 2)
padrino-support (= 0.15.3)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.4)
activesupport (>= 3.1)
parallel (1.22.1)
padrino-support (0.15.3)
parallel (1.23.0)
parslet (2.0.0)
public_suffix (5.0.1)
racc (1.6.2)
rack (2.2.6.4)
rack (2.2.7)
rack-livereload (0.3.17)
rack
rainbow (3.1.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand All @@ -156,17 +170,26 @@ GEM
rack (>= 2.2.4, < 4)
temple (0.10.0)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.11)
tzinfo (1.2.10)
thread_safe (~> 0.1)
toml (0.3.0)
parslet (>= 1.8.0, < 3.0.0)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
webrick (1.8.1)
yell (2.2.2)

PLATFORMS
ruby

DEPENDENCIES
govuk_tech_docs
html-proofer (~> 3.19.4)
tzinfo-data
wdm (~> 0.1.0)

BUNDLED WITH
2.1.4
26 changes: 26 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
require 'govuk_tech_docs'

# Check for broken links
require 'html-proofer'

GovukTechDocs.configure(self)

set :layout, 'custom'

after_build do |builder|
begin
proofer = HTMLProofer.check_directory(config[:build_dir],
{ :assume_extension => true,
:allow_hash_href => true,
:empty_alt_ignore => true,
:file_ignore => [
/search/ # Provided by tech-docs gem but has a "broken" link from html-proofer's point of view
],
:url_ignore => [
"https://github.com/alphagov/centralised-security-logging-service",
"https://gdshelpdesk.digital.cabinet-office.gov.uk",
"https://gds-way.cloudapps.digital/standards/secrets-acl.html",
/https:\/\/github.com\//
]
})

proofer.run
rescue RuntimeError => e
abort e.to_s
end
end
5 changes: 2 additions & 3 deletions config/tech-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ default_owner_slack: '#gds-way'
owner_slack_workspace: gds

redirects:
/standards/publish-opensource-code.html: /standards/source-code/#publish-open-source-code
/standards/git.html: /standards/source-code/#working-with-git
/standards/source-code.html: /standards/source-code/
/standards/publish-opensource-code.html: /standards/source-code/index.html#publish-open-source-code
/standards/git.html: /standards/source-code/working-with-git.html
/standards/testing-with-rspec.html: /manuals/programming-languages/ruby.html#testing-with-rspec
/standards/secrets-ACL.html: /standards/secrets-acl.html
2 changes: 1 addition & 1 deletion source/manuals/programming-languages/java.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ If you are starting a new Java project, do not use anything older than the lates

If you are currently using an older LTS version of Java, you should be planning to upgrade to something newer. Different Java vendors have different support lifecycles for different Java releases.

Recent versions of the [Oracle JDK can be used free of charge](https://blogs.oracle.com/java/post/free-java-license) for commercial and production purposes under the terms of a bespoke licence. OpenJDK is open source under the [GPLv2 with the Classpath Exception](https://openjdk.java.net/legal/gplv2+ce.html) but Oracle only provide general-availability [OpenJDK builds](https://jdk.java.net/) for the latest release.
Recent versions of the [Oracle JDK can be used free of charge](https://www.oracle.com/downloads/licenses/no-fee-license.html) for commercial and production purposes under the terms of a bespoke licence. OpenJDK is open source under the [GPLv2 with the Classpath Exception](https://openjdk.java.net/legal/gplv2+ce.html) but Oracle only provide general-availability [OpenJDK builds](https://jdk.java.net/) for the latest release.

The [Adoptium](https://adoptium.net/) (formerly AdoptOpenJDK) project (part of the [Eclipse Foundation](https://www.eclipse.org/)) provides fully open-source TCK-certified pre-built OpenJDK binaries under the name Eclipse Temurin. For LTS releases (such as Java 8, 11 and 17), Adoptium have committed to releasing free updates for several years.

Expand Down
3 changes: 0 additions & 3 deletions source/manuals/programming-languages/nodejs/index.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ the main [programming languages manual page](../../programming-languages.html).
The advice here is specifically about Node.js. Generic guidelines on writing
code are out of scope.

If you want to contribute to this document please see the [Updating this
manual](#updating-this-manual) section below.

Most guidelines listed here are recommendations, and the authors acknowledge
that there will sometimes be valid exceptions.

Expand Down
2 changes: 2 additions & 0 deletions source/manuals/programming-languages/ruby.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ applications we have chosen [Sinatra] before - however this
should be approached with caution as these can easily become large applications
over time that are less conventionally organised than Rails applications.

## Testing with RSpec

For testing, the [RSpec] framework is the conventional and preferred choice.
RSpec provides an expressive syntax that lends itself to producing readable
tests. For testing functionality from a user's perspective it is preferred
Expand Down
1 change: 1 addition & 0 deletions source/partials/_nav-version-control-deployments.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<ul>
<li><a href="/standards/source-code/">How to store source code</a></li>
<li><a href="/standards/source-code/index.html">How to store source code</a></li>
mrwilson marked this conversation as resolved.
Show resolved Hide resolved
<li><a href="/standards/pull-requests.html">Using Pull Requests</a></li>
<li><a href="/manuals/readme-guidance.html">Writing READMEs</a></li>
<li><a href="/manuals/release-notes.html">Writing release notes</a></li>
Expand Down
2 changes: 1 addition & 1 deletion source/standards/continuous-delivery.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Find out more about continuous delivery from:
- [Trunk Based Development][] - a source control branching method

[Continuous delivery]: https://www.continuousdelivery.com
[feature-flagging]: https://featureflags.io/2016/10/28/continuous-delivery-coding-patterns-feature-toggles/
[feature-flagging]: https://martinfowler.com/articles/feature-toggles.html
[modular architectures]: https://continuousdelivery.com/implementing/architecture/
[production monitoring and alerting]: https://gds-way.cloudapps.digital/standards/monitoring.html
[Pull Requests]: https://gds-way.cloudapps.digital/standards/pull-requests.html
Expand Down
4 changes: 2 additions & 2 deletions source/standards/optimise-frontend-perf.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For example:
|---|---|---|
|#High|Position styles correctly|Set styles at the top of the page and `defer` scripts |
||Minimise HTTP requests|Minimise tiling icons, CSS and JavaScript files to reduce size and loading time [HTTP/1.1 only]|
||Compress static resources|Use [minification][], [Gzip][], and [Brotli][] to compress CSS and JavaScript code|
||Compress static resources|Use minification, [Gzip][], and [Brotli][] to compress CSS and JavaScript code|
||Set correct Headers|Set correct [Cache-Control][] and [ETag][] headers on assets for optimal caching|
|#Medium|Look for empty image `src` attributes|Avoid using empty image `src` attributes as some browsers always send requests to them, resulting in additional traffic|
||Include `width` and `height` attributes on images to minimise layout thrashing | Make sure to include these attributes to improve visual stability and the [Cumulative Layout Shift (CLS)][] metric
Expand Down Expand Up @@ -96,7 +96,7 @@ You can find out more about improving your website’s frontend performance by r
The Service Manual has more suggestions about [how you can test frontend performance][].

[frontend performance]: https://www.gov.uk/service-manual/technology/how-to-test-frontend-performance
[minification]: https://minifycode.com/
[minification]: https://web.dev/reduce-network-payloads-using-text-compression/
mrwilson marked this conversation as resolved.
Show resolved Hide resolved
[Gzip]: https://web.dev/optimizing-content-efficiency-optimize-encoding-and-transfer/#text_compression_with_gzip
[Cache-Control]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
[ETag]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
Expand Down
4 changes: 2 additions & 2 deletions source/standards/principle-least-access.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ If you’re using the gds-users account to log into your AWS accounts, you shoul

- [NCSC - 10 steps to cyber security](https://www.ncsc.gov.uk/collection/10-steps)
- [NCSC - privileged user management](https://www.ncsc.gov.uk/guidance/introduction-identity-and-access-management#section_6)
- [NIST Special Publication 800-53 - AC-6 least privilege][polp]
- [NCSC - preventing lateral movement][polp]

[polp]: https://csrc.nist.gov/Projects/risk-management/sp800-53-controls/release-search#!/control?version=5.1&number=AC-6
mrwilson marked this conversation as resolved.
Show resolved Hide resolved
[polp]: https://www.ncsc.gov.uk/guidance/preventing-lateral-movement