diff --git a/Gemfile b/Gemfile index 95a22d14..c9da2f51 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 80b407c5..c6828896 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,6 +37,8 @@ GEM 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) @@ -61,6 +63,14 @@ 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) concurrent-ruby (~> 1.0) @@ -70,6 +80,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) memoist (0.16.2) + mercenary (0.4.0) middleman (4.3.11) coffee-script (~> 2.2) haml (>= 4.0.5) @@ -141,6 +152,7 @@ GEM rack (2.2.6.4) rack-livereload (0.3.17) rack + rainbow (3.1.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) @@ -156,17 +168,23 @@ 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) + 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) + 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 diff --git a/config.rb b/config.rb index 4c658a71..46bb32b6 100644 --- a/config.rb +++ b/config.rb @@ -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, + :check_internal_hash => 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://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 \ No newline at end of file diff --git a/config/tech-docs.yml b/config/tech-docs.yml index 0809e7a5..ff5993fd 100644 --- a/config/tech-docs.yml +++ b/config/tech-docs.yml @@ -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 diff --git a/source/manuals/programming-languages/java.html.md.erb b/source/manuals/programming-languages/java.html.md.erb index ab74a78a..bedc75e3 100644 --- a/source/manuals/programming-languages/java.html.md.erb +++ b/source/manuals/programming-languages/java.html.md.erb @@ -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. diff --git a/source/manuals/programming-languages/nodejs/index.html.md.erb b/source/manuals/programming-languages/nodejs/index.html.md.erb index e3f3985e..9344ae5b 100644 --- a/source/manuals/programming-languages/nodejs/index.html.md.erb +++ b/source/manuals/programming-languages/nodejs/index.html.md.erb @@ -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. diff --git a/source/manuals/programming-languages/ruby.html.md.erb b/source/manuals/programming-languages/ruby.html.md.erb index 3b8c264b..8d701376 100644 --- a/source/manuals/programming-languages/ruby.html.md.erb +++ b/source/manuals/programming-languages/ruby.html.md.erb @@ -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 diff --git a/source/partials/_nav-version-control-deployments.html.erb b/source/partials/_nav-version-control-deployments.html.erb index a0faff31..91313e89 100644 --- a/source/partials/_nav-version-control-deployments.html.erb +++ b/source/partials/_nav-version-control-deployments.html.erb @@ -1,5 +1,5 @@