diff --git a/.github/workflows/check_md_links.yml b/.github/workflows/check_md_links.yml new file mode 100644 index 00000000..c54aac1c --- /dev/null +++ b/.github/workflows/check_md_links.yml @@ -0,0 +1,18 @@ +name: Check Markdown links + +# checking for any dead links in markdown files + +on: + push: + branches: + - master + - dev + pull_request: + branches: '*' + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@v1 \ No newline at end of file diff --git a/.github/workflows/miss_hit.yml b/.github/workflows/miss_hit.yml new file mode 100644 index 00000000..d4cb7ae8 --- /dev/null +++ b/.github/workflows/miss_hit.yml @@ -0,0 +1,39 @@ +name: miss_hit + +on: + push: + branches: + - master + - dev + pull_request: + branches: '*' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 1 + + - name: Set up Python 3.6 + uses: actions/setup-python@v2 + with: + python-version: 3.6 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip3 install install miss_hit + + - name: Miss_hit code quality + run: | + mh_metric . --ci + + - name: Miss_hit code style + run: | + mh_style . diff --git a/.gitignore b/.gitignore index da011f09..3a9f5620 100644 --- a/.gitignore +++ b/.gitignore @@ -7,13 +7,14 @@ # exclude content of logfiles folders *output* -*.tsv *.mat # exclude temp files from tests and coverage *test_code_report.txt *coverage* +*filteredBy* + tests/*.nii* tests/*.json* tests/*.tsv* diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..6e0d1ce8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,13 @@ +{ + "parser": "markdown", + "proseWrap": "always", + "tabWidth": 2, + "overrides": [ + { + "files": "*.md", + "options": { + "tabWidth": 4 + } + } + ] +} diff --git a/.remarkrc b/.remarkrc new file mode 100644 index 00000000..201ce70e --- /dev/null +++ b/.remarkrc @@ -0,0 +1,11 @@ +{ + "plugins": [ + "preset-lint-consistent", + "preset-lint-markdown-style-guide", + "preset-lint-recommended", + ["lint-no-duplicate-headings", false], + ["lint-list-item-indent", "tab-size"], + ["lint-maximum-line-length", true], + ["lint-maximum-heading-length", false] + ] +} diff --git a/.travis.yml b/.travis.yml index 73839af7..d5cfa910 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,19 @@ dist: bionic # Language and version -language: python -python: - - "3.6" # current default Python on Travis CI +language: node_js +node_js: + - "10" cache: apt: true # only works with Pro version + directories: + - node_modules # NPM packages for the remark markdown linter + +branches: + only: # only run the CI for those branches + - master + - dev env: global: # Define environment variables for bash @@ -26,9 +33,7 @@ before_install: - travis_retry sudo apt-get -y install nodejs - travis_retry sudo apt-get -y install npm # Install BIDS-Validator - - sudo npm install -g bids-validator - # Install miss_hit linter - - pip3 install miss_hit + - sudo npm install -g bids-validator@1.5.4 install: # make octave file the JSONio submodule @@ -43,9 +48,15 @@ before_script: jobs: include: + - name: "BIDS validator: create and check dataset" script: octave $OCTFLAGS --eval "test_makeRawDataset" && bids-validator `pwd`/output/raw/ --ignoreNiftiHeaders - - name: "miss_hit: checking code quality" - script: mh_metric . --ci - - name: "miss_hit: checking code style" - script: mh_style . + + - name: "Check markdown" + before_script: + - npm install `cat npm-requirements.txt` + script: + - remark README.md --frail + - remark ./notebooks/ --frail + - remark ./tests/ --frail + - remark ./docs/ --frail diff --git a/README.md b/README.md index 4db24351..1a21bbd2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + + **Try it** [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/cpp-lln-lab/CPP_BIDS/master?filepath=notebooks%2Fbasic_usage.ipynb) @@ -5,7 +7,7 @@ **Unit tests and coverage** [![](https://img.shields.io/badge/Octave-CI-blue?logo=Octave&logoColor=white)](https://github.com/cpp-lln-lab/CPP_BIDS/actions) -![](https://github.com/cpp-lln-lab/CPP_BIDS/workflows/CI/badge.svg) +![](https://github.com/cpp-lln-lab/CPP_BIDS/workflows/CI/badge.svg) [![codecov](https://codecov.io/gh/cpp-lln-lab/CPP_BIDS/branch/master/graph/badge.svg)](https://codecov.io/gh/cpp-lln-lab/CPP_BIDS) @@ -15,64 +17,81 @@ **Contributors** -[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) + +* * * ---- - # CPP_BIDS - -* 1. [Output format](#Outputformat) - * 1.1. [Modality agnostic aspect](#Modalityagnosticaspect) -* 2. [Documentation](#Documentation) -* 3. [Contributing](#Contributing) - * 3.1. [Guidestyle](#Guidestyle) - * 3.2. [BIDS naming convention](#BIDSnamingconvention) - * 3.3. [Contributors ✨](#Contributors) + + +- [CPP_BIDS](#cpp_bids) +- [Output format](#output-format) + - [Modality agnostic aspect](#modality-agnostic-aspect) +- [Documentation](#documentation) +- [Contributing](#contributing) + - [Guidestyle](#guidestyle) + - [BIDS naming convention](#bids-naming-convention) + - [Change log](#change-log) + - [Contributors ✨](#contributors-) + + - - + -A set of function for matlab and octave to create [BIDS-compatible](https://bids-specification.readthedocs.io/en/stable/) folder structure and filenames for the output of behavioral, EEG, fMRI, eyetracking studies. +A set of function for matlab and octave to create +[BIDS-compatible](https://bids-specification.readthedocs.io/en/stable/) folder +structure and filenames for the output of behavioral, EEG, fMRI, eyetracking +studies. -## 1. Output format +## Output format -### 1.1. Modality agnostic aspect +### Modality agnostic aspect -Subjects, session and run number labels will be numbers with zero padding up to 3 values (e.g subject 1 will become `sub-001`). +Subjects, session and run number labels will be numbers with zero padding up to +3 values (e.g subject 1 will become `sub-001`). -A session folder will ALWAYS be created even if not requested (default will be `ses-001`). +A session folder will ALWAYS be created even if not requested (default will be +`ses-001`). Task labels will be printed in camelCase in the filenames. -Time stamps are added directly in the filename by adding a suffix `_date-YYYYMMDDHHMM` which makes the file name non-BIDS compliant. This was added to prevent overwriting files in case a certain run needs to be done a second time because of a crash (Some of us are paranoid about keeping even cancelled runs during my experiments). This suffix should be removed to make the data set BIDS compliant. See `convertSourceToRaw.m` for more details. +Time stamps are added directly in the filename by adding a suffix +`_date-YYYYMMDDHHMM` which makes the file name non-BIDS compliant. This was +added to prevent overwriting files in case a certain run needs to be done a +second time because of a crash (Some of us are paranoid about keeping even +cancelled runs during my experiments). This suffix should be removed to make the +data set BIDS compliant. See `convertSourceToRaw.m` for more details. For example: -``` +```bash sub-090/ses-003/sub-090_ses-003_task-auditoryTask_run-023_events_date-202007291536.tsv ``` -## 2. Documentation +## Documentation -- [Installation](./docs/installation.md) -- [How to use it: jupyter notebooks](./notebooks) -- [Functions description](./docs/functions_description.md) +- [Installation](./docs/installation.md) +- [How to use it: jupyter notebooks](./notebooks) +- [Functions description](./docs/functions-description.md) -## 3. Contributing +## Contributing Feel free to open issues to report a bug and ask for improvements. -### 3.1. Guidestyle +### Guidestyle - We use camelCase. -- We keep the McCabe complexity as reported by the [check_my_code function](https://github.com/Remi-Gau/check_my_code) below 15. -- We use the [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) to automatically fix some linting issues. -### 3.2. BIDS naming convention +- We keep the McCabe complexity as reported by the + [check_my_code function](https://github.com/Remi-Gau/check_my_code) + below 15. + +- We use the + [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) + to automatically fix some linting issues. + +### BIDS naming convention Here are the naming templates used. @@ -104,16 +123,13 @@ The format used by the MATLAB toolbox EEGLAB (Each recording consisting of a .se Biosemi data format (Each recording consisting of a .bdf file) --> - - - MEG ??? - Eyetracker -current format -`_recording-eyetracking_physio.tsv.gz` +current format `_recording-eyetracking_physio.tsv.gz` future BEP format in a dedicated eyetracker folder `sub-[_ses-