Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up
ruff
and fix trivial rules (#165)
* Add `ruff.toml` * Remove isort and flake8 from pre-commit * Add ruff to pre-commit * Remove isort and flake8 from `setup.cfg` * Set target version to 3.10 for ruff * Automatically fix ruff linter * Add `mypy` and `ruff` as dev dependencies * Run `ruff check .` on codebase * Ruff ignore `ANN001` (missing type function arguments) * Ignore more ruff rules * Run `ruff check --unsafe-fixes .` * Remove commented out code * Fix TODO comment * Add file-specific ignore rules for ruff * Add GH issue links to TODOs * Fix ruff `B905`: add `strict=True` in `zip()` * Fix ruff `TRY200`: use `raise from` * Fix ruff `PTH123`: `open()` -> `Path.open()` * Fix ruff `PLR2004`: use of magic values * Fix ruff `PTH` rules * Fix ruff `S` rules * Remove unused ruff ignore comments * Add more rules to the ruff ignore list * Fix ruff rule PT * Fix single quotes * Fix Ruff rules PL * Fix ruff rule TRY * Fix ruff rule RET * Fix ruff rule FBT001 and whitespace * Fix ruff rule B * Fix ruff rule DTZ007 * Add missing imports * Set `orthanc` plugins as `namespace-packages` * Fix ruff rules remaining (not ignored) * ignore rules in ruff.toml * Fix ruff ignore comment * Fix ruff rules in orthanc-raw - add docstrings * Fix (some) ruff rules in orthanc-anon - add docstrings * `pixl_core`: fix ruff rule D100 Add docstrings to public modules * `pixl_core`: fix ruff rule D103 Add missing docstrings to public functions * `pixl_core`: fix ruff rule D101 * `pixl_core`: ignore ruff rule ARG001 Need further testing to check whether these arguments can be removed * `pixl_core`: fix ruff rule G004 * `pixl_core`: fix test checking datetime Fixing ruff rule DTZ007 in e96307b caused this test to fail because the timestamp didn't include the timezone. Also requires `import datetime` to access the `timezone` attribute * `cli`: fix ruff rule D100 (module docstrings) * `cli`: fix ruff rule D103 * `cli`: fix remaining ruff D10* rules * `cli`: fix failing tests after previous ruff issue fixes - `yaml.safe_load()` does not have a `Loader` argument - `import datetime` to get access to `timezone` - `datetime` -> `datetime.datetime` because of the previous * `cli`: fix ruff rule S101, replace `assert` with exceptions * `cli`: replace `print()` with `logger.info()` * `cli`: fix ruff rule S113, set request timeouts * `pixl_ehr`: ignore D1** ruff rules for tests * `pixl_ehr`: formatting * Ignore ruff rule S608 See #154 * Fix remaining ruff rules in orthanc-anon - add docstrings Azure Token * Fix ruff ignore comment PLW0602 * Fix ruff rules for orthanc-raw adding docstrings * Fix (some) ruff rules in orthanc-anon - add docstrings * Fix remaining ruff rules in orthanc-anon - add docstrings Azure Token * Fix ruff rule G004 in pixl_pacs * Fix datetime import error * Fix ruff rule RUF006 in pixl_pacs * Fix ruff rule RUF006 in pixl_ehr * Fix datetime import error * Fix ruff rules in pixl_ehr _processing * Ignore ruff rule PLW2901 see #157 * Fix ruff rule missing docstrings for pixl_pacs * `hasher`: fix expected error message * `hasher`: use `@pytest.mark` to define `dummy_key` fixture * Formatting * `hasher`: ignore `D1` rules for tests * `hasher`: ignore ruff rule T201 (print statements) * Fix ruff rule G004 for pixl_ehr * `hasher`: replace logging `f`-string * `hasher`: fix ruff rule D100, public module docstrings * `hasher`: ignore rule D103 for `endpoints` functions Docstrings feel like overkill for these functions * pre-commit applied locally * Fix ruff setup Specifying the `config=ruff.toml` ignores subdirectory `ruff.toml` files * More `ruff` autofixes * Ruff pixl_ehr docstrings * Fix `Path` API calls * Fix unspported left operand error * Fix `RuntimeError` message * Fix `fromisoformat()` call --------- Co-authored-by: ruaridhg <ruaridhg@users.noreply.github.com>
- Loading branch information