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

Set up ruff and fix trivial rules #165

Merged
merged 87 commits into from
Dec 4, 2023
Merged

Set up ruff and fix trivial rules #165

merged 87 commits into from
Dec 4, 2023

Conversation

milanmlft
Copy link
Member

  • Adds ruff.toml files to configure ruff
  • Adds ruff to the pre-commit configuration
  • Removes isort and flake8 from pre-commit
  • Adds dev dependencies for mypy and ruff
  • Fixes (or ignores) the trivial ruff issues

ruff issues that require deeper investigation are ignored for now, but have been turned into new issues: #151, #152, #153, #154, #155, #156, #157

Closes UCLH-Foundry/the-rolling-skeleton#108

@milanmlft milanmlft marked this pull request as ready for review December 4, 2023 14:17
@milanmlft milanmlft enabled auto-merge (squash) December 4, 2023 14:23
Copy link
Contributor

@ruaridhg ruaridhg left a comment

Choose a reason for hiding this comment

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

LGTM

@milanmlft milanmlft merged commit e0190a1 into main Dec 4, 2023
7 checks passed
@milanmlft milanmlft deleted the milanmlft/issue-108-ruff branch December 4, 2023 14:30
exclude: "tests|orthanc"
- id: ruff
args:
- --fix
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need to specify the config here as well?

Comment on lines +282 to +285
Methods
-------
from_state_file(cls, filepath)
Return messages from a state file path
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if I'd put in the time to define the methods of a class here, as you've also got the public methods so its a bit of duplication

Comment on lines +17 to +20
This module provides:
- fetch_key_from_vault: fetch the hashing key from the Azure Key Vault instance
- generate_hash: generate a keyed hash digest using the Blake2b algorithm
- generate_salt: generate a random text string in hexadecimal to be used as a salt
Copy link
Contributor

Choose a reason for hiding this comment

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

Fine to keep in but also probably a duplication of what's documented at the function level and could get out of date

orthanc/orthanc-anon/plugin/pixl.py Show resolved Hide resolved
@@ -20,14 +22,14 @@


@router.get("/heart-beat", summary="Health Check")
async def heart_beat() -> str:
async def heart_beat() -> str: # noqa: D103
Copy link
Contributor

Choose a reason for hiding this comment

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

why don't we just document these?

Comment on lines +45 to +49
background_tasks = set()
async with PixlConsumer(QUEUE_NAME, token_bucket=state.token_bucket) as consumer:
asyncio.create_task(consumer.run(callback=process_message))
task = asyncio.create_task(consumer.run(callback=process_message))
background_tasks.add(task)
task.add_done_callback(background_tasks.discard)
Copy link
Contributor

Choose a reason for hiding this comment

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

oh this is interesting that you had to add that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants