openml / server-api

Python-based server
https://openml.github.io/server-api/
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Remove black and bandit from pre-commit in favor of ruff #196

Closed PGijsbers closed 3 weeks ago

PGijsbers commented 3 weeks ago

It's just fewer dependencies. There might be small disparities between bandit and ruff, but it seems simpler to use just one tool. (and it's faster)

Summary by Sourcery

Replace 'black' and 'bandit' with 'ruff' in pre-commit configuration to reduce dependencies and improve performance. Enhance type handling in conversion functions and simplify union type annotations. Clean up unused code and comments, and update test cases for improved readability and compliance with linting rules.

Enhancements:

Build:

Tests:

sourcery-ai[bot] commented 3 weeks ago

Reviewer's Guide by Sourcery

This pull request removes black and bandit from pre-commit hooks in favor of using ruff for both linting and formatting. It also includes various code improvements and type hint updates across multiple files.

File-Level Changes

Change Details Files
Replace black and bandit with ruff in pre-commit configuration
  • Remove bandit hook
  • Remove black hook
  • Update ruff hook to include formatting
  • Add ruff-format hook
.pre-commit-config.yaml
Update type hints and improve code quality
  • Replace specific type checks with more generic ones (e.g., dict to Mapping, list to Iterable)
  • Use union syntax (
) instead of Union[]
  • Remove redundant nested_int_to_str function
  • Update function annotations and disable some linter warnings
  • Replace httpx.codes.OK with http.client.OK
  • src/core/conversions.py
    src/schemas/datasets/dcat.py
    src/routers/openml/datasets.py
    src/routers/openml/tasks.py
    tests/routers/openml/study_test.py
    tests/routers/openml/flows_test.py
    Improve code organization and imports
    • Move imports to TYPE_CHECKING block
    • Remove commented-out code
    • Update import statements
    src/schemas/datasets/mldcat_ap.py
    src/schemas/datasets/openml.py
    src/schemas/flows.py
    Address linter warnings and improve code quality
    • Add noqa comments to suppress specific linter warnings
    • Rename _get_for_datasets to get_for_datasets
    • Update global variable declarations
    • Simplify list creation syntax
    src/database/qualities.py
    src/database/setup.py
    tests/routers/openml/migration/datasets_migration_test.py
    src/database/users.py
    src/routers/openml/tasktype.py

    Sequence Diagram

    No sequence diagram generated.


    Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
    PGijsbers commented 3 weeks ago

    Nevermind. I am stupid, or tired, or both.