Skip to content

Commit

Permalink
codespell: add config and action to codespell the code to avoid known…
Browse files Browse the repository at this point in the history
… typos (#245)

* Add github action to codespell master on push and PRs

* Add rudimentary codespell config

* skips

* Fix ambigous (and some regular) typos

* [DATALAD RUNCMD] run codespell throughout

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
yarikoptic authored Jul 24, 2023
1 parent e29632f commit 1fbfeb4
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 22 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Last version before refactoring.

## 2.0.0 - 2019-03-10

- The anonymizer option no longer exists from the script dcm2bids. It is still possible to deface the anatomical nifti images using the "defaceTpl" key in the congifuration file.
- The anonymizer option no longer exists from the script dcm2bids. It is still possible to deface the anatomical nifti images using the "defaceTpl" key in the configuration file.
- Acquisitions are now sorted using the sidecar data instead of only the sidecar filename. The default behaviour is to sort by `SeriesNumber` then by `AcquisitionTime` then by the `SidecarFilename`. You can change this behaviour setting the key "compKeys" inside the configuration file.
- Add an option to use `re` for more flexibility for matching criteria. Set the key "searchMethod" to "re" in the config file. fnmatch is still the default.
- Design fix in matching with list in the sidecar.
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ seeking help on [Neurostars](https://neurostars.org/) or on
[GitHub](https://github.com/UNFmontreal/Dcm2Bids/issues).

We also encourage everybody regardless of age, gender identity, level of
experience, native langage, race or religion to be involved in the project. We
experience, native language, race or religion to be involved in the project. We
pledge to make participation in the dcm2bids project an harassment-free
experience for everyone.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ a preview from an editor like Atom using `CTRL+SHIFT+M`.

Pull Request Checklist (For Fastest Review):

- [x] Check that all tests are passing ("All tests passsed")
- [x] Check that all tests are passing ("All tests passed")
- [x] Make sure you have docstrings for any new functions
- [x] Make sure that docstrings are updated for edited functions
- [x] Make sure you note any issues that will be closed by your PR
Expand Down
8 changes: 4 additions & 4 deletions dcm2bids/sidecar.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def data(self, filename):
filename (path): path of a JSON file
Return:
A dictionnary of the JSON content plus the SidecarFilename
A dictionary of the JSON content plus the SidecarFilename
"""
try:
data = load_json(filename)
Expand Down Expand Up @@ -253,8 +253,8 @@ def build_graph(self):
def isLink(self, data, criteria):
"""
Args:
data (dict): Dictionnary data of a sidecar
criteria (dict): Dictionnary criteria
data (dict): Dictionary data of a sidecar
criteria (dict): Dictionary criteria
Returns:
boolean
Expand Down Expand Up @@ -363,7 +363,7 @@ def compare_float(name, pattern):
self.logger.warning(f"This key {list(pattern.keys())[0]} "
"is not allowed.")
else:
raise ValueError("Dictionnary used as criteria should be "
raise ValueError("Dictionary used as criteria should be "
"using only one key.")

elif isinstance(name, list):
Expand Down
2 changes: 1 addition & 1 deletion dcm2bids/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def load_json(filename):
filename (str): Path of a JSON file
Return:
Dictionnary of the JSON file
Dictionary of the JSON file
"""
with open(filename, "r") as f:
data = json.load(f, object_pairs_hook=OrderedDict)
Expand Down
6 changes: 3 additions & 3 deletions docs/get-started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ path.
sam:~/data$ ~/software/dcm2bids_scaffold -o new-bids-project
```

=== "Ouput"
=== "Output"

```bash
sam:~/software$ curl -fLO https://github.com/unfmontreal/dcm2bids/releases/latest/download/dcm2bids_debian-based_3.0.0rc1.tar.gz
Expand Down Expand Up @@ -157,7 +157,7 @@ we recommend to install it at the same time in the dedicated environment.
As you can see, dcm2niix is available through [conda][conda] so that is the
approach chosen in this guide. We will benefit from the simplicity of installing
all software from the same located at. Steps to install dcm2niix are included in
the next secton.
the next section.

## Recommendations

Expand Down Expand Up @@ -293,7 +293,7 @@ this command:
conda env create --file environment.yml
```

If the executation was successful, you should see a message similar to:
If the execution was successful, you should see a message similar to:

```bash hl_lines="14"
sam:~/dcm2bids-proj$ nano environment.yml
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/create-config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ If you want to add an `IntendedFor` entry or any extra sidecar linked to a
specific file, you will need to set an id to the corresponding description and
put the same id with `IntendedFor`.

Fo example, **`task_rest`** means it is intended for `task-rest_bold` and
For example, **`task_rest`** means it is intended for `task-rest_bold` and
**`id_task_learning`** is intended for `task-learning_bold`.

You could also use this feature to feed sidecar such as `Source`` for example or
Expand Down
8 changes: 4 additions & 4 deletions docs/how-to/use-advanced-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ same level as the `"description"` entry.

default: None

extractors will allow you to extract information embeded into sidecar files. In
extractors will allow you to extract information embedded into sidecar files. In
the example above, it will try to match 2 different regex expressions (keys:
task, run) within the SeriesDescription field and bodypart in BodyPartExamined
field.
Expand Down Expand Up @@ -150,10 +150,10 @@ can change this behaviour setting this key inside the configuration file.

#### Handle multi site filtering

As mentionned in the [first-steps tutorial](../tutorial/first-steps.md),
As mentioned in the [first-steps tutorial](../tutorial/first-steps.md),
criteria is the way to filter specific acquisitions. If you work with dicoms
from multiple sites you will need different criterias for the same kind of
acquisition. In order to reduce the length of the config file, we developped a
from multiple sites you will need different criteria for the same kind of
acquisition. In order to reduce the length of the config file, we developed a
feature where for a specific criteria you can get multiple descriptions.

```json
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/use-main-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ more information.
If your directory or file names have space in them, we recommend that you
change all the spaces for another character (`_` or `-`) but if you can't
change the names, you have to wrap each argument with quotes as in the
exemple below:
example below:

`dcm2bids -d "DICOM DIR" -p PARTICIPANT_ID -c "path/with spaces to/CONFIG FILE.json"`

Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/first-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ these:
```

Note that in the Output tab, the content before the command prompt (`$`) will be
dependend or your operating system and terminal configuration. What you want to
dependent or your operating system and terminal configuration. What you want to
compare is what follows it and the output below the command that was ran. The
output you see was taken directly out of your terminal when you tested the
tutorial.
Expand Down Expand Up @@ -590,7 +590,7 @@ which file based on their identical names, only with a

As you can see, it is not necessarily easy to tell which scan files (`nii.gz`)
refer to which acquisitions from their names only. That is why you have to go
through their sidecar files to find unique identifiers for one acquisiton you
through their sidecar files to find unique identifiers for one acquisition you
want to _BIDSify_.

Go ahead and use any code editor, file viewer or your terminal to inspect the
Expand Down Expand Up @@ -712,13 +712,13 @@ acquisitions, namely:
2. `003_In_EPI_PE=AP_20180918121230`
3. `004_In_EPI_PE=PA_20180918121230`

The first is an resting-state fMRI acquisiton whereas the second and third are
The first is an resting-state fMRI acquisition whereas the second and third are
fieldmap EPI.

### Setting up the configuration file

Once you found the data you want to _BIDSify_, you can start setting up your
configuration file. The file name is arbritrary but for the readibility purpose,
configuration file. The file name is arbitrary but for the readability purpose,
you can name it `dcm2bids_config.json` like in the tutorial. You can create in
the `code/` directory. Use any code editor to create the file and add the
following content:
Expand Down
2 changes: 1 addition & 1 deletion docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Upgrade to the latest version using your favorite method.

## Upgrading from 2.x to 3.x

This major release includes many new features that unfortunaly requires breaking
This major release includes many new features that unfortunately requires breaking
changes to configuration files.

### Changes to existing description and config file keys
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

[tool.codespell]
skip = '.git,*.pdf,*.svg'
#
ignore-words-list = 'nd'

0 comments on commit 1fbfeb4

Please sign in to comment.