Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within pyproject.toml
---
name: Codespell
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a strong reason for this to be its own workflow rather than folded into ci.yaml?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be done so if you like but

  • you have already lots of commands in there sequentially and without separate steps -- so one fails (e.g. black) and others already don't run, and here you just see that CI failed but do not know what check exactly
  • why don't you use pre-commit and instead list individual calls there? (related: fresh "Address" detected by pre-commit issues #40). Could be done via action or there is even pre-commit service IIRC (I typically do not use it but other projects do)
  • having separate workflow or parametrization for it shows up as a separate report here in PR so makes it easier to immediately see what is wrong. They also then run in parallel

With that in mind I would have recommended to move "pre-commit" encoded checks into separate workflow, and leave/rename ci to run only tests but across different python versions (now just 3.8)

You could also encode them all in a single CI workflow file, but then I would also recommend to centralize them actually outside, e.g. in tox.ini and then just sweep through different invocations. Eg. look at https://github.com/con/duct/blob/main/.github/workflows/test.yaml which sweeps through different pythons for testing but also adds runs for type checks and linting.

so -- many ways to skin a cat here ;-)


on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

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

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the codespell-problem-matcher necessary? What does it do on top of the basic codespell action?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it annotates typos directly in the PR diff - quite handy

- name: Codespell
uses: codespell-project/actions-codespell@v2
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ repos:
rev: v1.2.0
hooks:
- id: mypy

- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in pyproject.toml
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ confidence=
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
Expand Down
10 changes: 4 additions & 6 deletions bids2table/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def to_path(
int_format: str = "%d",
) -> Path:
"""
Generate a filepath based on the entitities.
Generate a filepath based on the entities.
"""
special = {"datatype", "suffix", "ext"}
data = self.to_dict(valid_only=valid_only)
Expand All @@ -209,15 +209,13 @@ def to_path(
path = prefix / path
return path

def with_update(
self, entitities: Optional[Dict[str, Any]] = None, **kwargs
) -> Self:
def with_update(self, entities: Optional[Dict[str, Any]] = None, **kwargs) -> Self:
"""
Create a new instance with updated entities.
"""
data = self.to_dict(valid_only=False)
if entitities:
data.update(entitities)
if entities:
data.update(entities)
if kwargs:
data.update(kwargs)
return self.__class__.from_dict(data)
Expand Down
2 changes: 1 addition & 1 deletion example/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3629,7 +3629,7 @@
"source": [
"## Using the command-line interface\n",
"\n",
"bids2table comes with a command-line iterface `bids2table` (alias `b2t`). Check out the help message."
"bids2table comes with a command-line interface `bids2table` (alias `b2t`). Check out the help message."
]
},
{
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,10 @@ log_cli_level = "DEBUG"
[tool.mypy]
no_strict_optional = true
ignore_missing_imports = true

[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git*,venv*'
check-hidden = true
ignore-regex = '(^\s*"image/\S+": ".*|\bND\b)'
# ignore-words-list = ''