From 3bdb0251c7fb52f5fd7f4f93d023df7a6ed2904b Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Sat, 28 Sep 2024 08:26:45 +0000 Subject: [PATCH] sty --- .github/validation.yml | 23 +++++++++++++++++++++++ .github/workflows/check-md-links.yaml | 20 ++++++++++++++++++++ .gitignore | 7 +++++++ .pre-commit-config.yaml | 26 +++++++++++++++++--------- .remarkrc | 18 ++++++++++++++++++ CONTRIBUTING.md | 16 +++++++++++----- Makefile | 8 ++++++++ npm-requirements.txt | 6 ++++++ 8 files changed, 110 insertions(+), 14 deletions(-) create mode 100644 .github/validation.yml create mode 100644 .github/workflows/check-md-links.yaml create mode 100644 .gitignore create mode 100644 .remarkrc create mode 100644 Makefile create mode 100644 npm-requirements.txt diff --git a/.github/validation.yml b/.github/validation.yml new file mode 100644 index 0000000..34cd154 --- /dev/null +++ b/.github/validation.yml @@ -0,0 +1,23 @@ +--- +name: Validation + +on: + push: + branches: [main] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Markdown formatting + remark: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 14 + - name: Run markdown style checks + run: make remark diff --git a/.github/workflows/check-md-links.yaml b/.github/workflows/check-md-links.yaml new file mode 100644 index 0000000..445f7c6 --- /dev/null +++ b/.github/workflows/check-md-links.yaml @@ -0,0 +1,20 @@ +--- +name: Check Markdown links + +on: + push: + branches: [main] + pull_request: + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: no + use-verbose-mode: no + config-file: md_link_check_config.json + folder-path: docs + file-path: ./README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aafba66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# folders +*.DS_Store +tmp + +# node +node_modules +package*json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2efc720..c5e84c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,24 @@ +--- # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - - repo: https://github.com/pre-commit/pre-commit-hooks +- repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-json - - id: check-added-large-files - - id: check-case-conflict - - repo: https://github.com/codespell-project/codespell + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-json + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: mixed-line-ending +- repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: - - id: codespell + - id: codespell +- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.3 + hooks: + - id: yamlfmt + args: [--mapping, '4', --sequence, '4', --offset, '0'] diff --git a/.remarkrc b/.remarkrc new file mode 100644 index 0000000..b0a518d --- /dev/null +++ b/.remarkrc @@ -0,0 +1,18 @@ +{ + "plugins": [ + "preset-lint-markdown-style-guide", + "preset-lint-recommended", + "remark-gfm", + ["lint-no-duplicate-headings", false], + ["lint-list-item-indent", "tab-size"], + ["lint-emphasis-marker", "consistent"], + ["lint-maximum-line-length", 500], + ["lint-maximum-heading-length", false], + ["lint-no-shortcut-reference-link", false], + ["remark-lint-unordered-list-marker-style", "-"], + ["lint-no-trailing-spaces"], + ["remark-lint-code-block-style", false], + ["lint-no-undefined-references", false], + ["remark-lint-heading-style", false] + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75899f6..387a6b1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -111,7 +111,7 @@ The current list of labels are > Git hook scripts are useful for identifying simple issues before submission to code review. -For more information on Git hooks, see: https://pre-commit.com/. +For more information on Git hooks and pre-commit, check the pre-commit [documentation](https://pre-commit.com/). Several of the BIDS repositories have a `.pre-commit-config.yaml` configuration at the root of the repository. @@ -136,14 +136,14 @@ To uninstall the pre-commit hooks, run `pre-commit uninstall`. We appreciate all contributions to BIDS. **THANK YOU** for helping us build these useful resources. -#### 1. Comment on an existing issue or open a new issue referencing your addition +### 1. Comment on an existing issue or open a new issue referencing your addition This allows other members of the BIDS team to confirm that you aren't overlapping with work that's currently underway and that everyone is on the same page with the goal of the work you're going to carry out. -#### 2. [Fork](https://help.github.com/articles/fork-a-repo/) [this repository](https://github.com/bids-standard/bids-specification) to your profile +### 2. [Fork](https://help.github.com/articles/fork-a-repo/) [this repository](https://github.com/bids-standard/bids-specification) to your profile This is now your own unique copy of a repository. Changes here won't affect anyone else's work, @@ -152,14 +152,14 @@ so it's a safe space to explore edits to the specification! Make sure to [keep your fork up to date](https://help.github.com/articles/syncing-a-fork/) with the upstream repository, otherwise you can end up with lots of dreaded [merge conflicts](https://help.github.com/articles/about-merge-conflicts/). -#### 3. Make the changes you've discussed +### 3. Make the changes you've discussed Try to keep the changes focused. If you submit a large amount of work in all in one go, it will be much more work for whomever is reviewing your pull request. Please detail the changes you are attempting to make. -#### 4. Submit a [pull request](https://help.github.com/articles/about-pull-requests/) +### 4. Submit a [pull request](https://help.github.com/articles/about-pull-requests/) Please keep the title of your pull request short but informative in case it appears in a changelog. @@ -168,12 +168,18 @@ Use one of the following prefixes in the title of your pull request: - `[ENH]` - enhancement of the repository that adds a new feature + - `[FIX]` - fix of a typo, a bug, or language clarification + - `[INFRA]` - changes to the infrastructure: for example automating the specification release. + - `[MISC]` - everything else that cannot fit into another category + - `[REF]` - Refactoring + - `[SCHEMA]` - changes to the BIDS schema and/or related code + - `[STY]` - Stylistic change or code formatting. If you are opening a pull request to obtain early feedback, diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5bf7aac --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +package.json: + npm install `cat npm-requirements.txt` + +# Linting +remark: package.json + npx remark \ + ./CONTRIBUTING.md \ + --rc-path .remarkrc diff --git a/npm-requirements.txt b/npm-requirements.txt new file mode 100644 index 0000000..c783ce3 --- /dev/null +++ b/npm-requirements.txt @@ -0,0 +1,6 @@ +remark-cli@9.0.0 +remark-gfm@1 +remark-preset-lint-recommended@5.0.0 +remark-preset-lint-markdown-style-guide@4.0.0 +remark-lint-no-trailing-spaces@2 +all-contributors-cli