Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ruff for linting #1312

Merged
merged 16 commits into from
Nov 4, 2024
Merged
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
3 changes: 2 additions & 1 deletion .circleci/get_data.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python3
"""Download test data."""

import sys

from xcp_d.tests.utils import download_test_data

if __name__ == "__main__":
if __name__ == '__main__':
data_dir = sys.argv[1]
dset = sys.argv[2]
download_test_data(dset, data_dir)
6 changes: 4 additions & 2 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[codespell]
skip = .git,*.pdf,*.svg,*.html,dataset_description.json
skip = .git,*.pdf,*.svg,*.html,dataset_description.json,*.gii
# te - TE
# Weill - name
# reson - Reson. abbreviation in citation
ignore-words-list = te,weill,reson
# DNE: acronym for does not exist
# fo: acronym for file object
ignore-words-list = te,weill,reson,DNE,fo
43 changes: 22 additions & 21 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint code
name: Contribution checks

on:
push:
Expand All @@ -12,26 +12,27 @@ defaults:
run:
shell: bash

jobs:
stable:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest']
python-version: ["3.10"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install flake8 and related packages
run: python -m pip install \
flake8 flake8-absolute-import flake8-black flake8-docstrings \
flake8-isort flake8-pyproject flake8-unused-arguments \
flake8-use-fstring pep8-naming
- name: Check xcp_d
run: python -m flake8 xcp_d
- run: pipx run ruff check .
- run: pipx run ruff format --diff .

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

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
29 changes: 17 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
exclude: ".*/data/.*"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.1.0
- id: trailing-whitespace
exclude: '.*\.svg'
- id: end-of-file-fixer
exclude: '.*\.svg'
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- id: ruff
args: [ --fix ]
- id: ruff-format
- id: ruff
args: [ --select, ISC001, --fix ]
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ experience for everyone.

Although no list can hope to be all-encompassing, we explicitly honor diversity in age,
body size, disability, ethnicity, gender identity and expression, level of experience,
native language, education, socio-economic status, nationality, personal appearance, race, religion,
native language, education, socioeconomic status, nationality, personal appearance, race, religion,
or sexual identity and orientation.

## Our Standards
Expand Down
2 changes: 1 addition & 1 deletion docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ This is a patch release that fixes two important bugs.
The two bugs are:
(1) band-pass filter values were not respected in versions 0.7.1 - 0.7.3 (they were hardcoded to 0.01 - 0.1) and
(2) when processing CIFTI files, parcellated ReHo values in TSVs were not correct, due to a problem with how we were reconstructing CIFTI ReHo files.
The dense CIFTI files should still be useable though.
The dense CIFTI files should still be usable though.

### 🎉 Exciting New Features

Expand Down
Loading