This commit is contained in:
japborst
2022-09-27 17:00:56 +02:00
parent 6c519323da
commit c84dae914b
10 changed files with 10 additions and 113 deletions

View File

@@ -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

View File

@@ -1 +0,0 @@
There's not much use to keep empty methods.

View File

@@ -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.

View File

@@ -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() {}
\`\`\`
<a href="https://github.com/PicnicSupermarket/error-prone-support/blob/master/${BUGPATTERN}" class="fs-3 btn external" target="_blank">
View source code on GitHub
<svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg>
</a>
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() {}
\`\`\`
<a href="https://github.com/PicnicSupermarket/error-prone-support/blob/master/${TEMPLATE}" class="fs-3 btn external" target="_blank">
View source code on GitHub
<svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg>
</a>
EOF
done
}
# Do it
configure
generate_homepage
generate_bugpattern_docs
generate_refaster_docs

2
website/.gitignore vendored
View File

@@ -12,5 +12,3 @@ vendor/
# Generated content
*.bak
index.md
bugpatterns/
refastertemplates/

View File

@@ -1,5 +1,7 @@
---
layout: default
title: Page not found
permalink: /404.html
nav_exclude: true
search_exclude: true
---

View File

@@ -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

View File

@@ -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;

View File

@@ -4,3 +4,5 @@ title: Bug Patterns
nav_order: 2
has_children: true
---
# Bug Patterns

View File

@@ -4,3 +4,5 @@ title: Refaster templates
nav_order: 2
has_children: true
---
# Refaster templates