Skip to content

Commit

Permalink
Update markdown lint and linkchecker (#521)
Browse files Browse the repository at this point in the history
* update CI and scripts

Signed-off-by: Nicolas MASSART <[email protected]>

* fix MD

and ignore log files

Signed-off-by: Nicolas MASSART <[email protected]>

* remove previously commited logs

Signed-off-by: Nicolas MASSART <[email protected]>

* fix package path

Signed-off-by: Nicolas MASSART <[email protected]>

* update link checker conf

Signed-off-by: Nicolas MASSART <[email protected]>

* restored some link exclusions

probably ddos protection on etherescan
and internal postman link is in an include making path wrong
when checked separately

Signed-off-by: Nicolas MASSART <[email protected]>
  • Loading branch information
NicolasMassart authored Sep 24, 2020
1 parent a5461b0 commit 82e8ca4
Show file tree
Hide file tree
Showing 62 changed files with 684 additions and 269 deletions.
26 changes: 15 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ executors:
shell_executor:
docker:
- image: circleci/buildpack-deps:buster-scm
ruby_executor:
docker:
- image: circleci/ruby:2-stretch

jobs:
dco:
Expand Down Expand Up @@ -50,7 +47,7 @@ jobs:
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r CI/requirements.txt
pip install -q -r CI/requirements.txt
- save_cache:
paths:
- ./venv
Expand Down Expand Up @@ -86,40 +83,47 @@ jobs:
command: 'sudo npm install -g npm@latest'
- restore_cache:
keys:
- deps-{{ checksum "package.json" }}
- deps-{{ checksum "package-lock.json" }}
- run:
name: Install dependencies
command: |
npm install
npm ci
- run:
name: Run markdown link checker
command: |
npm run test:links
- save_cache:
paths:
- ./node_modules
key: deps-{{ checksum "package.json" }}
key: deps-{{ checksum "package-lock.json" }}
- store_artifacts:
path: ./linkchecker.out
destination: linkchecker.out

markdownlint:
executor: ruby_executor
executor: node_executor
steps:
- checkout
- restore_cache:
keys:
- deps-{{ checksum "package-lock.json" }}
- run:
name: Install dependencies
command: |
gem install mdl
npm ci
- run:
shell: /bin/bash #this is a non breaking command so it will always return success
name: Run Markdownlint info checks
command: |
mdl --ignore-front-matter --style ./CI/markdownlint/info_style.rb . | tee ./markdownlint_info.out
npm run test:markdown:info
- run:
name: Run Markdownlint
command: |
mdl --ignore-front-matter --style ./CI/markdownlint/style.rb . | tee ./markdownlint.out
npm run test:markdown
- save_cache:
paths:
- ./node_modules
key: deps-{{ checksum "package-lock.json" }}
- store_artifacts:
path: ./markdownlint.out
destination: ./markdownlint.out
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ env/
node_modules/
.circleci/process.yml
.DS_Store
*.log
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
For changes see the Hyperledger Besu
[CHANGELOG.md](https://github.com/hyperledger/besu/blob/master/CHANGELOG.md)
[CHANGELOG.md](https://github.com/hyperledger/besu/blob/master/CHANGELOG.md)
18 changes: 4 additions & 14 deletions CI/linkchecker/link_check_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,12 @@
"pattern": "^http(s)?://127.0.0.1"
},
{
"pattern": "^http(s)?://.+.etherscan.io/txs\\?block="
},
{
"pattern": "^http(s)?://.+.etherscan.io/tx/0x"
},
{
"pattern": "^http(s)?://.+.etherscan.io/address/0x"
},
{
"pattern": "^http(s)?://.+.blockscout.com/"
"pattern": "^http(s)?://.+.etherscan.io/"
},
{
"pattern": "/postman/.+.json"
},
{
"pattern": "https://remix.ethereum.org/"
}
]
],
"aliveStatusCodes":[200, 206],
"retryOn429":true
}
15 changes: 0 additions & 15 deletions CI/markdownlint/info_style.rb

This file was deleted.

23 changes: 23 additions & 0 deletions CI/markdownlint/lint-base-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
default: true
no-trailing-punctuation:
punctuation: '.,;:!'
ul-indent:
indent: 4

no-bare-urls: false
code-block-style: false
line-length: false

# excluded rule for as kramdown has a bug.
# see https://github.com/markdownlint/markdownlint/issues/294#issuecomment-600600407
# these are now in info style.
# to be put back in error style once bug fixed.
single-h1: false
no-space-in-code: false
no-duplicate-header: false
first-line-h1: false

# Because I hate HTML but sometimes a table is hard to format in MD
# now in info style.
no-inline-html: false

20 changes: 20 additions & 0 deletions CI/markdownlint/lint-info-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
line-length:
line_length: 100
code_blocks: false
tables: false

no-bare-urls: false

# excluded rule for error as kramdown has a bug.
# see https://github.com/markdownlint/markdownlint/issues/294#issuecomment-600600407
# these are now in this info style.
# to be put back in error style once bug fixed.
single-h1: true
no-space-in-code: true
no-duplicate-header:
allow_different_nesting: true
first-line-h1: true

# Because I hate HTML but sometimes a table is hard to format in MD
no-inline-html: true

21 changes: 0 additions & 21 deletions CI/markdownlint/style.rb

This file was deleted.

2 changes: 1 addition & 1 deletion CI/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Go to the besu-doc project root directory and run one of the following scripts:
* `CI/scripts/test_links.sh` tests the internal and external links in the doc. If a link is
incorrect or the targeted web page is unavailable (for external sites), the test will fail and
display the faulty link.
* `CI/scripts/test_lint.sh` tests the Markdown syntax for issues. Sometimes they are not visible
* `CI/scripts/test_markdown_syntax.sh` tests the Markdown syntax for issues. Sometimes they are not visible
but making sure the markdown is correct helps to make it readable and bug free.
* `CI/scripts/test_all.sh` runs all the tests in one pass.

Expand Down
29 changes: 29 additions & 0 deletions CI/scripts/run_job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -o pipefail

if [ -z "$1" ]
then
echo "No job mame supplied. See .circleci/config.yml for job names."
exit 1
else
JOB=$1
fi

exec < /dev/tty

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
LOGFILE=${DIR}/${JOB}.log

echo -e "\rRunning ${JOB} test job, please wait.\r"

circleci config process .circleci/config.yml > .circleci/process.yml && circleci local execute -c .circleci/process.yml --job $JOB > ${LOGFILE} 2>&1

if [ "$?" -eq "0" ]
then
echo -e "\r✓ ${JOB} test job succeeded\r"
exit 0
else
echo -e "\r✖ ${JOB} test job failed. See ${LOGFILE}"
exit 1
fi
19 changes: 15 additions & 4 deletions CI/scripts/test_all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!/usr/bin/env bash
CI/scripts/test_build.sh
CI/scripts/test_guidelines.sh
CI/scripts/test_links.sh
CI/scripts/test_lint.sh

echo -e "\r================================="
echo -e "\rRunning all tests jobs, please wait."
echo -e "\r================================="

CI/scripts/run_job.sh build & buildPID=$!
CI/scripts/run_job.sh vale & guidelinesPID=$!
CI/scripts/run_job.sh linkchecker & linksPID=$!
CI/scripts/run_job.sh markdownlint & syntaxPID=$!

wait $buildPID $linksPID $syntaxPID $guidelinesPID

echo -e "\r================================="
echo -e "\rAll tests jobs completed."
echo -e "\r================================="
3 changes: 2 additions & 1 deletion CI/scripts/test_build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env bash
circleci config process .circleci/config.yml > .circleci/process.yml && circleci local execute -c .circleci/process.yml --job build

CI/scripts/run_job.sh build
3 changes: 2 additions & 1 deletion CI/scripts/test_guidelines.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env bash
circleci config process .circleci/config.yml > .circleci/process.yml && circleci local execute -c .circleci/process.yml --job vale

CI/scripts/run_job.sh vale
3 changes: 2 additions & 1 deletion CI/scripts/test_links.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env bash
circleci config process .circleci/config.yml > .circleci/process.yml && circleci local execute -c .circleci/process.yml --job linkchecker

CI/scripts/run_job.sh linkchecker
2 changes: 0 additions & 2 deletions CI/scripts/test_lint.sh

This file was deleted.

3 changes: 3 additions & 0 deletions CI/scripts/test_markdown_syntax.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

CI/scripts/run_job.sh markdownlint
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ The other way is to file a confidential security bug in our

The process by which the Hyperledger Security Team handles security bugs is documented further in
our [Defect Response page](https://wiki.hyperledger.org/display/SEC/Defect+Response) on our
[wiki](https://wiki.hyperledger.org).
[wiki](https://wiki.hyperledger.org).
2 changes: 1 addition & 1 deletion docs/Concepts/Consensus-Protocols/Comparing-PoA.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ operating in adversarial environments.
Reaching consensus and adding blocks is faster in Clique networks. For Clique, the probability of a
fork increases as the number of validators increases.

For IBFT 2.0, the time to add new blocks increases as the number of validators increases.
For IBFT 2.0, the time to add new blocks increases as the number of validators increases.
2 changes: 1 addition & 1 deletion docs/Concepts/Mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Ethminer has been used with Hyperledger Besu to mine blocks on the [Ropsten test
[ETC mainnet (uncle block only)](https://etc.tokenview.com/en/uncleblock/10555173) and Mordor ETC testnet.

!!! note
Some mining software supports the `getwork` scheme as the `http` scheme.
Some mining software supports the `getwork` scheme as the `http` scheme.
1 change: 0 additions & 1 deletion docs/Concepts/Monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ logging enables:

For an overview of monitoring Hyperledger Besu, view
[this recording](https://www.youtube.com/watch?v=7BuutRe0I28&feature=youtu.be).

2 changes: 1 addition & 1 deletion docs/Concepts/Network-vs-Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ include `evmStackSize` or specify the
Specify node settings on the command line or in the
[node configuration file](../HowTo/Configure/Using-Configuration-File.md). For example, enable
[JSON-RPC API methods](../Reference/API-Methods.md) or specify the
[data directory](../Reference/CLI/CLI-Syntax.md#data-path) for the node.
[data directory](../Reference/CLI/CLI-Syntax.md#data-path) for the node.
2 changes: 1 addition & 1 deletion docs/Concepts/Plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Each plugin in the directory has the following lifecycle events:

!!! note

The order in which Besu calls plugins during lifecycle events is not guaranteed.
The order in which Besu calls plugins during lifecycle events is not guaranteed.
1 change: 0 additions & 1 deletion docs/Concepts/Privacy/Private-Transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,3 @@ for the private transaction with the incorrect nonce.
<!-- links ---->

[privacy marker transaction]: ../../Concepts/Privacy/Private-Transaction-Processing.md

2 changes: 1 addition & 1 deletion docs/Concepts/Protocol-Upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ example, [Istanbul](https://eips.ethereum.org/EIPS/eip-1679).
For compatibility with future protocol upgrades, do not hardcode any gas price assumptions.

Implementing upgradeable contracts enables contracts to be upgraded if a protocol upgrade does
include breaking changes.
include breaking changes.
2 changes: 1 addition & 1 deletion docs/Concepts/TLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ or server ([Orion](https://docs.orion.pegasys.tech/en/latest/Concepts/TLS-Commun

You must store private keys and certificates in password-protected PKCS #12 keystore files.

Use the command line options to [enable and configure](../HowTo/Configure/Configure-TLS.md) TLS.
Use the command line options to [enable and configure](../HowTo/Configure/Configure-TLS.md) TLS.
2 changes: 1 addition & 1 deletion docs/HowTo/Backup/Backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ The process for finding peers after restarting is the same as for
[finding peers after upgrading and restarting].

<!-- Links -->
[finding peers after upgrading and restarting]: ../Upgrade/Upgrade-Node.md#finding-peers-on-restarting
[finding peers after upgrading and restarting]: ../Upgrade/Upgrade-Node.md#finding-peers-on-restarting
2 changes: 1 addition & 1 deletion docs/HowTo/Configure/Configure-Mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ have been used to mine on public networks with Hyperledger Besu:

* **Ropsten**: [`0x2f14582947E292a2eCd20C430B46f2d27CFE213c`](https://ropsten.etherscan.io/address/0x2f14582947E292a2eCd20C430B46f2d27CFE213c#mine)
* **ETC**: [`0x3125309aa670f5e60493b50884a7e7abf9ebb701`](https://etc.tokenview.com/en/address/0x3125309aa670f5e60493b50884a7e7abf9ebb701)
* **Mordor**: `0x2f14582947E292a2eCd20C430B46f2d27CFE213c`
* **Mordor**: `0x2f14582947E292a2eCd20C430B46f2d27CFE213c`
2 changes: 1 addition & 1 deletion docs/HowTo/Configure/Configure-TLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ The command line:

<!-- Links -->
[Configure the client for TLS]: https://docs.ethsigner.pegasys.tech/en/latest/HowTo/Configure-TLS/#server-tls-connection
[Configure the server to allow TLS communication]: https://docs.orion.pegasys.tech/en/latest/Tutorials/TLS/
[Configure the server to allow TLS communication]: https://docs.orion.pegasys.tech/en/latest/Tutorials/TLS/
2 changes: 1 addition & 1 deletion docs/HowTo/Configure/Consensus-Protocols/Clique.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ Define the number of blocks between epoch transitions in the genesis file.

<!-- Acronyms and Definitions -->

*[vanity data]: Signers can include anything they like as vanity data.
*[vanity data]: Signers can include anything they like as vanity data.
2 changes: 1 addition & 1 deletion docs/HowTo/Configure/Consensus-Protocols/QuorumIBFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ To connect to a Quorum IBFT 1.0 network:
```

1. When starting Besu, specify the IBFT 1.0 genesis file using the
[`--genesis-file`](../../../Reference/CLI/CLI-Syntax.md#genesis-file) option.
[`--genesis-file`](../../../Reference/CLI/CLI-Syntax.md#genesis-file) option.
2 changes: 1 addition & 1 deletion docs/HowTo/Configure/Contracts-in-Genesis.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ The contract code in the genesis file defines the:
* Address
* Balance
* Bytecode
* Key value pairs for contract storage.
* Key value pairs for contract storage.
2 changes: 1 addition & 1 deletion docs/HowTo/Configure/Passing-JVM-Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ setting it before starting Besu.
```bash
BESU_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 \
besu --network=rinkeby
```
```
2 changes: 1 addition & 1 deletion docs/HowTo/Deploy/Ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ For more information, see the
!!! important

We strongly recommend automating network creation. Automating makes updates easier and ensures
your configuration is synchronized across the network.
your configuration is synchronized across the network.
2 changes: 1 addition & 1 deletion docs/HowTo/Deploy/Bootnodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ command line option for each node to include the new bootnodes.
When adding bootnodes, you do not need to restart running nodes. By updating the
[`--bootnodes`](../../Reference/CLI/CLI-Syntax.md#bootnodes) option, the next time you restart the
nodes (for example, when [upgrading](../Upgrade/Upgrade-Node.md)), the nodes connect to the new
bootnodes.
bootnodes.
Loading

0 comments on commit 82e8ca4

Please sign in to comment.