Skip to content

Commit

Permalink
Fix all remark warnings (cvat-ai#3261)
Browse files Browse the repository at this point in the history
* Fix all issues reported by remark

* Move remark dependencies from the workflow definition into package.json

This enables the transitive dependencies to be pinned, just like for all
other packages.

* Add additional remark plugins

These are needed to correctly parse certain constructs in Markdown files
(such as tables and YAML frontmatter), and without them, remark produces
invalid warnings on some files.

* Update the remark-lint preset versions

The previous versions reference the old version of the
`remark-lint-table-cell-padding` plugin, which doesn't work correctly with
the current version of `remark-parse` (and thus produces spurious warnings).

* GitHub Actions: run remark on all Markdown files, not just changed ones

This way, if a PR updates the remark configuration and that causes new errors
to appear, those errors will show up in that PR, instead of the (unrelated) PR
that next updates the affected files.

There is no runtime cost to this, because remark takes approximately 1 second
to check all files.
  • Loading branch information
Roman Donchenko authored May 31, 2021
1 parent 4960260 commit 2597546
Show file tree
Hide file tree
Showing 49 changed files with 1,385 additions and 725 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,16 @@ jobs:

- name: Run checks
run: |
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
PR_FILES=$(curl -s -X GET -G $URL | jq -r '.[] | select(.status != "removed") | .filename')
for files in $PR_FILES; do
extension="${files##*.}"
if [[ $extension == 'md' ]]; then
changed_files_remark+=" ${files}"
fi
done
npm ci
mkdir -p remark_report
if [[ ! -z ${changed_files_remark} ]]; then
npm ci
npm install [email protected] [email protected]
mkdir -p remark_report
echo "Remark version: "`npx remark --version`
echo "The files will be checked: "`echo ${changed_files_remark}`
npx remark --quiet --report json --no-stdout ${changed_files_remark} 2> ./remark_report/remark_report.json
get_report=`cat ./remark_report/remark_report.json | jq -r '.[] | select(.messages | length > 0)'`
if [[ ! -z ${get_report} ]]; then
pip install json2html
python ./tests/json_to_html.py ./remark_report/remark_report.json
exit 1
fi
else
echo "No files with the \"md\" extension found"
echo "Remark version: "`npx remark --version`
npx remark --quiet --report json --no-stdout . 2> ./remark_report/remark_report.json
get_report=`cat ./remark_report/remark_report.json | jq -r '.[] | select(.messages | length > 0)'`
if [[ ! -z ${get_report} ]]; then
pip install json2html
python ./tests/json_to_html.py ./remark_report/remark_report.json
exit 1
fi
- name: Upload artifacts
Expand Down
2 changes: 2 additions & 0 deletions .remarkrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
exports.settings = { bullet: '*', paddedTable: false };

exports.plugins = [
'remark-frontmatter',
'remark-gfm',
'remark-preset-lint-recommended',
'remark-preset-lint-consistent',
['remark-lint-list-item-indent', 'space'],
Expand Down
164 changes: 82 additions & 82 deletions CHANGELOG.md

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ Good bug reports are extremely helpful - thank you!

Guidelines for bug reports:

1. **Use the GitHub issue search** — check if the issue has already been
reported.
1. **Use the GitHub issue search** — check if the issue has already been
reported.

1. **Check if the issue has been fixed** — try to reproduce it using the
latest `develop` branch in the repository.
1. **Check if the issue has been fixed** — try to reproduce it using the
latest `develop` branch in the repository.

1. **Isolate the problem** — ideally create a reduced test case.
1. **Isolate the problem** — ideally create a reduced test case.

A good bug report shouldn't leave others needing to chase you up for more
information. Please try to be as detailed as possible in your report. What is
Expand Down Expand Up @@ -358,52 +358,52 @@ accurate comments, etc.) and any other requirements (such as test coverage).
Follow this process if you'd like your work considered for inclusion in the
project:

1. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the project, clone your fork,
and configure the remotes:
1. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the project, clone your fork,
and configure the remotes:

```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/<repo-name>
# Navigate to the newly cloned directory
cd <repo-name>
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
```
```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/<repo-name>
# Navigate to the newly cloned directory
cd <repo-name>
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
```

1. If you cloned a while ago, get the latest changes from upstream:
1. If you cloned a while ago, get the latest changes from upstream:

```bash
git checkout <dev-branch>
git pull upstream <dev-branch>
```
```bash
git checkout <dev-branch>
git pull upstream <dev-branch>
```

1. Create a new topic branch (off the main project development branch) to
contain your feature, change, or fix:
1. Create a new topic branch (off the main project development branch) to
contain your feature, change, or fix:

```bash
git checkout -b <topic-branch-name>
```
```bash
git checkout -b <topic-branch-name>
```

1. Commit your changes in logical chunks. Please adhere to these [git commit
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
or your code is unlikely be merged into the main project. Use Git's
[interactive rebase](https://docs.github.com/en/github/using-git/about-git-rebase)
feature to tidy up your commits before making them public.
1. Commit your changes in logical chunks. Please adhere to these [git commit
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
or your code is unlikely be merged into the main project. Use Git's
[interactive rebase](https://docs.github.com/en/github/using-git/about-git-rebase)
feature to tidy up your commits before making them public.

1. Locally merge (or rebase) the upstream development branch into your topic branch:
1. Locally merge (or rebase) the upstream development branch into your topic branch:

```bash
git pull [--rebase] upstream <dev-branch>
```
```bash
git pull [--rebase] upstream <dev-branch>
```

1. Push your topic branch up to your fork:
1. Push your topic branch up to your fork:

```bash
git push origin <topic-branch-name>
```
```bash
git push origin <topic-branch-name>
```

1. [Open a Pull Request](hhttps://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
with a clear title and description.
1. [Open a Pull Request](hhttps://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
with a clear title and description.

**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
license your work under the same license as that used by the project.
84 changes: 42 additions & 42 deletions cvat-data/src/js/3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,52 @@ So, we have solved to write patch file for this library.
It modifies source code a little to support our scenario of using.

### How to build awc.wasm and Decoder.js
1. Clone Emscripten SDK, install and activate the latest fastcomp SDK:
```sh
git clone https://github.com/emscripten-core/emsdk.git && cd emsdk
```
```sh
./emsdk install latest-fastcomp
```
```sh
./emsdk activate latest-fastcomp
```
1. Clone Emscripten SDK, install and activate the latest fastcomp SDK:
```sh
git clone https://github.com/emscripten-core/emsdk.git && cd emsdk
```
```sh
./emsdk install latest-fastcomp
```
```sh
./emsdk activate latest-fastcomp
```

1. Clone Broadway.js
```sh
git clone https://github.com/mbebenita/Broadway.git && cd Broadway/Decoder
```
1. Clone Broadway.js
```sh
git clone https://github.com/mbebenita/Broadway.git && cd Broadway/Decoder
```

1. Edit `make.py`:
- Remove or comment the following options:
`'-s', 'NO_BROWSER=1',`\
`'-s', 'PRECISE_I64_MATH=0',`
- Remove `"HEAP8", "HEAP16", "HEAP32"` from the `EXPORTED_FUNCTIONS` list.
- Increase total memory to make possible decode 4k videos
(or try to enable `ALLOW_MEMORY_GROWTH`, but this option has not been tested):\
`'-s', 'TOTAL_MEMORY=' + str(100*1024*1024),`
- Add the following options:\
`'-s', "ENVIRONMENT='worker'",`\
`'-s', 'WASM=1',`
1. Edit `make.py`:
- Remove or comment the following options:
`'-s', 'NO_BROWSER=1',`\
`'-s', 'PRECISE_I64_MATH=0',`
- Remove `"HEAP8", "HEAP16", "HEAP32"` from the `EXPORTED_FUNCTIONS` list.
- Increase total memory to make possible decode 4k videos
(or try to enable `ALLOW_MEMORY_GROWTH`, but this option has not been tested):\
`'-s', 'TOTAL_MEMORY=' + str(100*1024*1024),`
- Add the following options:\
`'-s', "ENVIRONMENT='worker'",`\
`'-s', 'WASM=1',`

1. Activate emsdk environment and build Broadway.js:
```sh
. /tmp/emsdk/emsdk_env.sh
```
```sh
python2 make.py
```
1. Activate emsdk environment and build Broadway.js:
```sh
. /tmp/emsdk/emsdk_env.sh
```
```sh
python2 make.py
```

1. Copy the following files to cvat-data 3rdparty source folder:
```sh
cd ..
```
```sh
cp Player/avc.wasm Player/Decoder.js Player/mp4.js <CVAT_FOLDER>/cvat-data/src/
```
```sh
js/3rdparty
```
1. Copy the following files to cvat-data 3rdparty source folder:
```sh
cd ..
```
```sh
cp Player/avc.wasm Player/Decoder.js Player/mp4.js <CVAT_FOLDER>/cvat-data/src/
```
```sh
js/3rdparty
```

### How work with a patch file
```bash
Expand Down
6 changes: 4 additions & 2 deletions cvat/apps/dataset_repo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ The SSH protocol is used for an authorization.

### Using

- Put a private SSH key into the `ssh` directory. The public key corresponding to this private key should be attached to an github user.
- Put a private SSH key into the `ssh` directory.
The public key corresponding to this private key should be attached to an github user.
- If you don't put any custom key, it will generated automatically.
- Setup a repository URL and a path (which is relative for a repository) in the create task dialog.
- Annotate a task.
- Press the button "Git Repository Sync" on the dashboard.
- In the dialog window press the button "Sync" and waiting for some time.
- An annotation will be dumped, archived and pushed to the attached remote repository. You can do a pull request manually.
- An annotation will be dumped, archived and pushed to the attached remote repository.
You can do a pull request manually.
10 changes: 5 additions & 5 deletions helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
helm repo update
helm dependency update
```
4. (Optional) Install ingress of your choice (for example: https://github.com/kubernetes/ingress-nginx)
5. (Optional) Create certificates for https (for example: https://github.com/jetstack/cert-manager/ )
4. (Optional) Install ingress of your choice (for example: <https://github.com/kubernetes/ingress-nginx>)
5. (Optional) Create certificates for https (for example: <https://github.com/jetstack/cert-manager/>)
6. (Optional) Create values.override.yaml and override there parameters you want
7. Change postgresql password as described below
8. Add ingress to values.override.yaml(example also below)
Expand Down Expand Up @@ -43,7 +43,7 @@ postgresql:
## How to describe ingress:
Just set `ingress.enabled:` to `true`, then copy example, uncomment it and change values there
## How to understand what diff will be inflicted by 'helm upgrade'?
You can use https://github.com/databus23/helm-diff#install for that
You can use <https://github.com/databus23/helm-diff#install> for that
## I want to use my own postgresql/redis with your chart.
Just set `postgresql.enabled` or `redis.enabled` to `false`, as described below.
Then - put your instance params to "external" field
Expand All @@ -53,6 +53,6 @@ Then reference it in helm update/install command using `-f` flag
## Why you used external charts to provide redis and postgres?
Because they definitely know what they do better then we are, so we are getting more quality and less support
## What is kubernetes and how it is working?
See https://kubernetes.io/
See <https://kubernetes.io/>
## What is helm and how it is working?
See https://helm.sh/
See <https://helm.sh/>
Loading

0 comments on commit 2597546

Please sign in to comment.