1
0
mirror of https://github.com/corona-warn-app/cwa-documentation synced 2024-11-29 12:44:27 +01:00

NPM only linting (#360)

* opting for npm-only version

* Disabling Tests with too many issues for now

* running the right spellcheck

* Fixing broken documentation link

* Disabling spellchecking until fixed for existing docs
This commit is contained in:
Thomas Kowark 2020-07-05 16:07:53 +02:00 committed by GitHub
parent 02caed10d1
commit 2f16aa4e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 106 deletions

View File

@ -17,24 +17,24 @@ jobs:
- name: Install npm dependencies - name: Install npm dependencies
if: always() if: always()
run: | run: |
make install npm install
- name: Linting markdown #- name: Linting markdown
if: always() # if: always()
run: | # run: |
make markdownlint # npm run-script markdownlint
- name: Checking for broken links - name: Checking for broken links
if: always() if: always()
run: | run: |
make checklinks npm run-script checklinks
- name: Spellchecking english #- name: Spellchecking english
if: always() # if: always()
run: | # run: |
make spellcheck-en # npm run-script spellcheck
- name: Detect inconsiderate language #- name: Detect inconsiderate language
if: always() # if: always()
run: | # run: |
make detect-inconsiderate-language # npm run-script detect-inconsiderate-language

View File

@ -2,10 +2,10 @@
## tl;dr ## tl;dr
**You will need to use following `make targets` before creating a pull request!** **You will need to use following `npm scripts` before creating a pull request!**
1. `make install` 1. `npm install`
2. `make check` 2. `npm test`
## Features ## Features
@ -37,38 +37,24 @@ For linting and all the checks you need several npm packages. The following
command installs all necessary npm dependencies: command installs all necessary npm dependencies:
```shell ```shell
make install npm install
``` ```
This installs all dependencies into a local `node_modules` folder. `Make` adds This installs all dependencies into a local `node_modules` folder.
this to your execution path automatically. If you install the modules somewhere
else please make sure this folder is in your execution path. On macOS or Linux
you probably need to export your Path like this:
```shell
export PATH=my/path/to/node_modules/.bin:$PATH
```
## Checks ## Checks
To enforce good spelling and specification conformity there are several checks To enforce good spelling and specification conformity there are several checks
as `Makefile` targets defined. To run all checks please execute: defined as `npm run-script` targets. To run all checks please execute:
```shell ```shell
make check npm test
```
As an alternative to make it is possible to utilize *npm-run-all* for testing:
```shell
npm run-script test
``` ```
### Individual checks ### Individual checks
If you want to run individual checks see the targets and the description below. If you want to run individual checks see the targets and the description below.
There are always Makefile targets. If you prefer npm for testing you can run Every individual check can be run like so:
every individual check like so:
```shell ```shell
npm runscript my-individual-check npm runscript my-individual-check
@ -80,7 +66,7 @@ See the package-json file for help.
Markdown linting. See the rules [here](https://github.com/DavidAnson/markdownlint). Markdown linting. See the rules [here](https://github.com/DavidAnson/markdownlint).
```shell ```shell
make markdownlint npm run-script markdownlint
``` ```
##### Overrides ##### Overrides
@ -124,7 +110,7 @@ documentation mentioned above.
Spell checking in American English (en_US). Spell checking in American English (en_US).
```shell ```shell
make spellcheck-en npm run-script spellcheck
``` ```
##### German ##### German
@ -133,11 +119,11 @@ Not implemented yet.
##### Overrides ##### Overrides
Add any additional words to the .spelling file and use the make target to sort Add any additional words to the .spelling file and use the target to sort
and clean them before adding these to master. and clean them before adding these to master.
```shell ```shell
make format-spelling npm run-script format-spelling
``` ```
Please note sometimes overriding is not the way to go. For example there may be Please note sometimes overriding is not the way to go. For example there may be
@ -149,7 +135,7 @@ documents should stick to one variation.
All cross references and external URLs are resolved. All cross references and external URLs are resolved.
```shell ```shell
make checklinks npm run-script checklinks
``` ```
#### Inconsiderate language scanner #### Inconsiderate language scanner
@ -159,5 +145,5 @@ non-natives to detect words that could be inconsiderate. This utilizes
[alex](https://github.com/get-alex/alex) [alex](https://github.com/get-alex/alex)
```shell ```shell
make detect-inconsiderate-language npm run-script detect-inconsiderate-language
``` ```

View File

@ -1,34 +0,0 @@
.PHONY: all install check markdownlint clean checklinks spellcheck-en spellcheck detect-inconsiderate-language
SHELL := /bin/bash
export PATH := ./node_modules/.bin:$(PATH)
install:
# https://stackoverflow.com/a/56254478
npm ci
check: markdownlint checklinks spellcheck format-spelling detect-inconsiderate-language
spellcheck: spellcheck-en
spellcheck-en:
mdspell '**/*.md' --en-us -t -n -a --report \
'!**/node_modules/**/*.md' \
'!**/.github/**/*.md' \
'!**/translations/**/*.md'
markdownlint:
markdownlint '**/*.md' --ignore node_modules
checklinks:
# https://github.com/tcort/markdown-link-check/issues/57
find . -not -path "*node_modules*" -not -path "*.github*" -name \*.md | \
xargs -n 1 markdown-link-check
detect-inconsiderate-language:
alex
format-spelling:
sort < .spelling | sort | uniq | tee .spelling.tmp > /dev/null && mv .spelling.tmp .spelling
clean:
rm -rf node_modules

View File

@ -200,7 +200,7 @@ Both, Apple and Google allow to define a low and a high threshold for the attenu
- Low threshold <= attenuation < high threshold - Low threshold <= attenuation < high threshold
- High threshold <= attenuation - High threshold <= attenuation
While in the Google implementation of the Exposure Notification Framework, those buckets are contained within the `ExposureSummary` (`attenuationDurations`), Apple has added them to the [`metadata`](https://developer.apple.com/documentation/exposurenotification/enexposureinfo/3586326-metadataenexposureinfo) attribute of the [`ENExposureInfo`](https://developer.apple.com/documentation/exposurenotification/enexposureinfo). While in the Google implementation of the Exposure Notification Framework, those buckets are contained within the `ExposureSummary` (`attenuationDurations`), Apple has added them to the [`metadata`](https://developer.apple.com/documentation/exposurenotification/enexposureinfo/3586326-metadata) attribute of the [`ENExposureInfo`](https://developer.apple.com/documentation/exposurenotification/enexposureinfo).
In the latter implementation, the [`attenuationDurations`](https://developer.apple.com/documentation/exposurenotification/enexposureinfo/3586325-attenuationdurations) of the `ENExposureInfo` contains two buckets around a fixed threshold of 50. In the latter implementation, the [`attenuationDurations`](https://developer.apple.com/documentation/exposurenotification/enexposureinfo/3586325-attenuationdurations) of the `ENExposureInfo` contains two buckets around a fixed threshold of 50.
### Risk Score Calculation ### Risk Score Calculation