Skip to content

Commit

Permalink
Merge pull request #128 from cpp-lln-lab/dev
Browse files Browse the repository at this point in the history
candidate for v1.1.0
  • Loading branch information
Remi-Gau authored Oct 14, 2020
2 parents cfa1f86 + 8edca58 commit 9536de7
Show file tree
Hide file tree
Showing 85 changed files with 1,572 additions and 662 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/check_md_links.yml
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions .github/workflows/miss_hit.yml
Original file line number Diff line number Diff line change
@@ -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 .
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parser": "markdown",
"proseWrap": "always",
"tabWidth": 2,
"overrides": [
{
"files": "*.md",
"options": {
"tabWidth": 4
}
}
]
}
11 changes: 11 additions & 0 deletions .remarkrc
Original file line number Diff line number Diff line change
@@ -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]
]
}
24 changes: 14 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@
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

# Install the miss_hit linter
before_install:
- pip3 install miss_hit
branches:
only: # only run the CI for those branches
- master
- dev

# Lists all the tasks we will do
jobs:
include:
- 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 . --frail

139 changes: 90 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,65 @@
[![codecov](https://codecov.io/gh/cpp-lln-lab/CPP_PTB/branch/master/graph/badge.svg)](https://codecov.io/gh/cpp-lln-lab/CPP_PTB)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

# CPP_PTB

<!-- lint disable -->

<!-- TOC -->

- [CPP_PTB](#cpp_ptb)
- [Requirements](#requirements)
- [Documentation](#documentation)
- [Content](#content)
- [How to install](#how-to-install)
- [Download with git](#download-with-git)
- [Add as a submodule](#add-as-a-submodule)
- [Example for submodule usage](#example-for-submodule-usage)
- [Direct download](#direct-download)
- [Add CPP_PTB globally to the matlab path](#add-cpp_ptb-globally-to-the-matlab-path)
- [Code style guide](#code-style-guide)
- [Unit tests](#unit-tests)
- [Contributors ✨](#contributors-)
- [CPP_PTB](#cpp_ptb)
- [Requirements](#requirements)
- [Documentation](#documentation)
- [Content](#content)
- [How to install](#how-to-install)
- [Download with git](#download-with-git)
- [Add as a submodule](#add-as-a-submodule)
- [Example for submodule usage](#example-for-submodule-usage)
- [Direct download](#direct-download)
- [Add CPP_PTB globally to the matlab path](#add-cpp_ptb-globally-to-the-matlab-path)
- [Code style guide](#code-style-guide)
- [Unit tests](#unit-tests)
- [Contributors ✨](#contributors-)

<!-- /TOC -->

<!-- lint enable -->

This is the Crossmodal Perception and Plasticity lab (CPP) PsychToolBox (PTB) toolbox.
This is the Crossmodal Perception and Plasticity lab (CPP) PsychToolBox (PTB)
toolbox.

Those functions are mostly wrappers around some PTB functions to facilitate their use and their reuse (#DontRepeatYourself)
Those functions are mostly wrappers around some PTB functions to facilitate
their use and their reuse (#DontRepeatYourself)

## Requirements

Make sure that the following toolboxes are installed and added to the matlab / octave path.
Make sure that the following toolboxes are installed and added to the matlab /
octave path.

For instructions see the following links:

<!-- lint disable -->

| Requirements | Used version |
|----------------------------------------------------------|--------------|
| -------------------------------------------------------- | ------------ |
| [PsychToolBox](http://psychtoolbox.org/) | >=3.0.14 |
| [Matlab](https://www.mathworks.com/products/matlab.html) | >=2015b |
| or [Octave](https://www.gnu.org/software/octave/) | 4.? |

<!-- lint enable -->

Tested:

- matlab 2015b or octave 4.2.2 and PTB 3.0.14.

## Documentation

All the documentation is accessible [here](./docs/00_index.md).
All the documentation is accessible [here](./docs/00-index.md).

## Content

Expand All @@ -75,7 +88,7 @@ All the documentation is accessible [here](./docs/00_index.md).

### Download with git

``` bash
```bash
cd fullpath_to_directory_where_to_install
# use git to download the code
git clone https://github.com/cpp-lln-lab/CPP_PTB.git
Expand All @@ -84,12 +97,15 @@ cd CPP_PTB
```

Then get the latest commit to stay up to date:

```bash
# from the directory where you downloaded the code
git pull origin master
```

To work with a specific version, create a branch at a specific version tag number
To work with a specific version, create a branch at a specific version tag
number

```bash
# creating and checking out a branch that will be called version1 at the version tag v1.0.0
git checkout -b version1 v1.0.0
Expand All @@ -99,14 +115,15 @@ git checkout -b version1 v1.0.0

Add it as a submodule in the repo you are working on.

``` bash
```bash
cd fullpath_to_directory_where_to_install
# use git to download the code
git submodule add https://github.com/cpp-lln-lab/CPP_PTB.git
```

To get the latest commit you then need to update the submodule with the information
on its remote repository and then merge those locally.
To get the latest commit you then need to update the submodule with the
information on its remote repository and then merge those locally.

```bash
git submodule update --remote --merge
```
Expand All @@ -115,10 +132,14 @@ Remember that updates to submodules need to be committed as well.

#### Example for submodule usage

So say you want to clone a repo that has some nested submodules, then you would type this to get the content of all the submodules at once (here with my experiment repo):
``` bash
So say you want to clone a repo that has some nested submodules, then you would
type this to get the content of all the submodules at once (here with my
experiment repo):

```bash
git clone --recurse-submodules https://github.com/user_name/yourExperiment.git
```

This would be the way to do it "by hand"

```bash
Expand All @@ -141,19 +162,20 @@ git submodule foreach --recursive 'git submodule update'

Download the code. Unzip. And add to the matlab path.

Pick a specific version:

https://github.com/cpp-lln-lab/CPP_PTB/releases
Pick a specific version from
[here](https://github.com/cpp-lln-lab/CPP_PTB/releases).

Or take the latest commit (NOT RECOMMENDED):

https://github.com/cpp-lln-lab/CPP_PTB/archive/master.zip
Or take
[the latest commit](https://github.com/cpp-lln-lab/CPP_PTB/archive/master.zip) -
NOT RECOMMENDED.

### Add CPP_PTB globally to the matlab path

This is NOT RECOMMENDED as this might create conflicts if you use different versions of CPP_PTB as sub-modules.
This is NOT RECOMMENDED as this might create conflicts if you use different
versions of CPP_PTB as sub-modules.

Also note that this might not work at all if you have not set a command line alias to start Matlab from a terminal window by just typing `matlab`. :wink:
Also note that this might not work at all if you have not set a command line
alias to start Matlab from a terminal window by just typing `matlab`. :wink:

```bash
# from within the CPP_PTB folder
Expand All @@ -162,34 +184,49 @@ matlab -nojvm -nosplash -r "addpath(genpath(fullfile(pwd, 'src'))); savepath();

## Code style guide

We use the `camelCase` to more easily differentiates our functions from the ones from PTB that use a `PascalCase`.
We use the `camelCase` to more easily differentiates our functions from the ones
from PTB that use a `PascalCase`.

In practice, we use the following regular expression for function names: `[a-z]+(([A-Z]|[0-9]){1}[a-z]+)*`.
In practice, we use the following regular expression for function names:
`[a-z]+(([A-Z]|[0-9]){1}[a-z]+)*`.

> Regular expressions look scary but are SUPER useful to sort through filenames:
> - A quick [intro to regular expression](https://www.rexegg.com/)
> - And many websites allow you to "design and test" your regular expression:
> - [regexr](https://regexr.com/)
> - [regexper](https://regexper.com/#%5Ba-z%5D%2B%28%28%5BA-Z%5D%7C%5B0-9%5D%29%7B1%7D%5Ba-z%5D%2B%29)
> - ...
We keep the McCabe complexity below 15 as reported by the [check_my_code function](https://github.com/Remi-Gau/check_my_code) or the [MISS_HIT code checker](https://florianschanda.github.io/miss_hit). A couple of code quality metrics are also checked automatically by MISS_HIT (avoiding functions with too many nested `if` blocks).

We use the [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) to automatically fix some linting issues.

The code style and quality is also checked during the [continuous integration](./.travis.yml).
>
> - A quick [intro to regular expression](https://www.rexegg.com/)
>
> - And many websites allow you to "design and test" your regular expression:
> - [regexper](https://regexper.com/#%5Ba-z%5D%2B%28%28%5BA-Z%5D%7C%5B0-9%5D%29%7B1%7D%5Ba-z%5D%2B%29)
> - ...
We keep the McCabe complexity below 15 as reported by the
[check_my_code function](https://github.com/Remi-Gau/check_my_code) or the
[MISS_HIT code checker](https://florianschanda.github.io/miss_hit). A couple of
code quality metrics are also checked automatically by MISS_HIT (avoiding
functions with too many nested `if` blocks).

We use the
[MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html)
to automatically fix some linting issues.

The code style and quality is also checked during the
[continuous integration](./.travis.yml).

## Unit tests

Unit tests are run with the mox unit toolbox and automated with github action on Octave.
Unit tests are run with the mox unit toolbox and automated with github action on
Octave.

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->

<!-- prettier-ignore-start -->

<!-- markdownlint-disable -->

<table>
<tr>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars3.githubusercontent.com/u/6961185?v=4" width="100px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_PTB/commits?author=Remi-Gau" title="Code">💻</a> <a href="#design-Remi-Gau" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_PTB/commits?author=Remi-Gau" title="Documentation">📖</a> <a href="https://github.com/cpp-lln-lab/CPP_PTB/issues?q=author%3ARemi-Gau" title="Bug reports">🐛</a> <a href="#userTesting-Remi-Gau" title="User Testing">📓</a> <a href="#ideas-Remi-Gau" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-Remi-Gau" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-Remi-Gau" title="Maintenance">🚧</a> <a href="https://github.com/cpp-lln-lab/CPP_PTB/commits?author=Remi-Gau" title="Tests">⚠️</a> <a href="#question-Remi-Gau" title="Answering Questions">💬</a></td>
Expand All @@ -199,7 +236,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
</table>

<!-- markdownlint-enable -->

<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the
[all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!
2 changes: 2 additions & 0 deletions demos/CPP_checkAbortDemo.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
% (C) Copyright 2020 CPP_PTB developers

% add parent directory to the path (to make sure we can access the CPP_PTB
% functions)
addpath(fullfile(pwd, '..'));
Expand Down
Loading

0 comments on commit 9536de7

Please sign in to comment.