From c84dae914b7e42be24ffaa2efd03beb4f3342583 Mon Sep 17 00:00:00 2001 From: japborst Date: Tue, 27 Sep 2022 17:00:56 +0200 Subject: [PATCH] Tweaks --- .github/workflows/deploy-website.yaml | 4 +- docs/bugpatterns/EmptyMethod.md | 1 - docs/refastertemplates/BigDecimalTemplates.md | 12 --- generate-docs.sh | 93 ------------------- website/.gitignore | 2 - website/404.md | 2 + website/_config.yml | 1 + website/_sass/custom/custom.scss | 4 +- website/bugpatterns.md | 2 + website/refastertemplates.md | 2 + 10 files changed, 10 insertions(+), 113 deletions(-) delete mode 100644 docs/bugpatterns/EmptyMethod.md delete mode 100644 docs/refastertemplates/BigDecimalTemplates.md diff --git a/.github/workflows/deploy-website.yaml b/.github/workflows/deploy-website.yaml index 2e0a5750e3..f294138ef5 100644 --- a/.github/workflows/deploy-website.yaml +++ b/.github/workflows/deploy-website.yaml @@ -1,9 +1,7 @@ name: Update `error-prone.picnic.tech` website contents on: push: - #branches: [$default-branch] - branches: - - 'sschroevers/deploy-to-github-pages' + branches: [$default-branch] workflow_dispatch: permissions: contents: read diff --git a/docs/bugpatterns/EmptyMethod.md b/docs/bugpatterns/EmptyMethod.md deleted file mode 100644 index db69b306d8..0000000000 --- a/docs/bugpatterns/EmptyMethod.md +++ /dev/null @@ -1 +0,0 @@ -There's not much use to keep empty methods. diff --git a/docs/refastertemplates/BigDecimalTemplates.md b/docs/refastertemplates/BigDecimalTemplates.md deleted file mode 100644 index f203dc47ca..0000000000 --- a/docs/refastertemplates/BigDecimalTemplates.md +++ /dev/null @@ -1,12 +0,0 @@ -## Problem - -The results of the `BigDecimal` constructor can be somewhat unpredictable. One -might assume that writing `new BigDecimal(0.1)` in Java creates a `BigDecimal` -which is exactly equal to `0.1` (an unscaled value of `1`, with a scale of -`1`), but it is actually equal to -`0.1000000000000000055511151231257827021181583404541015625`. - -This is because -`0.1` cannot be represented exactly as a `double` (or, for that matter, as a -binary fraction of any finite length). Thus, the value that is being passed in -to the constructor is not exactly equal to `0.1`, appearances notwithstanding. diff --git a/generate-docs.sh b/generate-docs.sh index 66afe97a1d..c5a07f3137 100755 --- a/generate-docs.sh +++ b/generate-docs.sh @@ -1,14 +1,6 @@ #!/usr/bin/env bash WEBSITE_FOLDER="website" -DOCS_FOLDER="docs" - -BUGPATTERN_FOLDER="${WEBSITE_FOLDER}/bugpatterns" -BUGPATTERN_DOCS_FOLDER="${DOCS_FOLDER}/bugpatterns" - -REFASTER_FOLDER="${WEBSITE_FOLDER}/refastertemplates" -REFASTER_DOCS_FOLDER="${DOCS_FOLDER}/refastertemplates" - HOMEPAGE="${WEBSITE_FOLDER}/index.md" configure() { @@ -21,7 +13,6 @@ generate_homepage() { echo "Generating ${HOMEPAGE}" cat > "${HOMEPAGE}" << EOF --- -# Do not modify. This file is generated. layout: default title: Home nav_order: 1 @@ -38,90 +29,6 @@ EOF sed $SEDOPTION 's/srcset="/srcset="assets\/images\//g' ${HOMEPAGE} } -generate_bugpattern_docs() { - BUGPATTERNS=$(find error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns -type f -iname "*.java" ! -iname "package-info.java") - for BUGPATTERN in $BUGPATTERNS; do - NAME=$(basename "${BUGPATTERN}" ".java") - FILENAME="${BUGPATTERN_FOLDER}/${NAME}.md" - - EXTRA_DOCS=$(cat "${BUGPATTERN_DOCS_FOLDER}/${NAME}.md" 2>/dev/null) - - echo "Generating ${FILENAME}" - cat > "${FILENAME}" << EOF ---- -layout: default -title: ${NAME} -parent: Bug Patterns -nav_order: 1 ---- - -# ${NAME} - -Simplification -{: .label .label-blue } - -Suggestion -{: .label .label-yellow } - -${EXTRA_DOCS} - -## Samples - -\`\`\`java -public static void sample() {} -\`\`\` - - - View source code on GitHub - - -EOF - done -} - -generate_refaster_docs() { - TEMPLATES=$(find error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates -type f -iname "*.java" ! -iname "package-info.java") - for TEMPLATE in $TEMPLATES; do - NAME=$(basename "${TEMPLATE}" ".java") - FILENAME="${REFASTER_FOLDER}/${NAME}.md" - - EXTRA_DOCS=$(cat "${REFASTER_DOCS_FOLDER}/${NAME}.md" 2>/dev/null) - - echo "Generating ${FILENAME}" - cat > "${FILENAME}" << EOF ---- -layout: default -title: ${NAME} -parent: Refaster templates -nav_order: 1 ---- - -# ${NAME} - -Style -{: .label .label-blue } - -Error -{: .label .label-red } - -${EXTRA_DOCS} - -## Samples - -\`\`\`java -public static void sample() {} -\`\`\` - - - View source code on GitHub - - -EOF - done -} - # Do it configure generate_homepage -generate_bugpattern_docs -generate_refaster_docs diff --git a/website/.gitignore b/website/.gitignore index 6df4eb2123..0ca0f15875 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -12,5 +12,3 @@ vendor/ # Generated content *.bak index.md -bugpatterns/ -refastertemplates/ diff --git a/website/404.md b/website/404.md index 1f5ca4b3b9..3e2aac8f9e 100644 --- a/website/404.md +++ b/website/404.md @@ -1,5 +1,7 @@ --- layout: default +title: Page not found +permalink: /404.html nav_exclude: true search_exclude: true --- diff --git a/website/_config.yml b/website/_config.yml index df1f3cf466..bc2c21c151 100644 --- a/website/_config.yml +++ b/website/_config.yml @@ -29,6 +29,7 @@ nav_external_links: url: https://github.com/PicnicSupermarket/error-prone-support hide_icon: false +# Author configuration. twitter: username: picnic card: summary diff --git a/website/_sass/custom/custom.scss b/website/_sass/custom/custom.scss index 2911e2156d..04d153d8ef 100644 --- a/website/_sass/custom/custom.scss +++ b/website/_sass/custom/custom.scss @@ -1,6 +1,6 @@ // We should override $nav-width(-md), however this breaks code highlighting and other styles. -// This appears an issue wrt the recommended way: -// https://github.com/just-the-docs/just-the-docs/issues/982 +// This appears an issue wrt the recommended way. +// See: https://github.com/just-the-docs/just-the-docs/issues/982 @include mq(lg) { .side-bar { min-width: 400px; diff --git a/website/bugpatterns.md b/website/bugpatterns.md index daeeb81132..51ce7bf7da 100644 --- a/website/bugpatterns.md +++ b/website/bugpatterns.md @@ -4,3 +4,5 @@ title: Bug Patterns nav_order: 2 has_children: true --- + +# Bug Patterns diff --git a/website/refastertemplates.md b/website/refastertemplates.md index a9b592dae3..66cecf9001 100644 --- a/website/refastertemplates.md +++ b/website/refastertemplates.md @@ -4,3 +4,5 @@ title: Refaster templates nav_order: 2 has_children: true --- + +# Refaster templates