DiamondLightSource / DiamondLightSource/dodal

Decide what to do about B008

Open
#738 2 comments 0 reactions 0 assignees View on GitHub
Developer Experience
Dominant language
Python
Stars
5
Forks
13
Avg merge
3d 2h
Merged PRs (30d)
10

Description

[B008](https://docs.astral.sh/ruff/rules/function-call-in-default-argument/) discourages function calls in default arguments e.g.

```python
def foo(bar = bar_factory()): ...
```

This is a pattern commonly used in our codebase, such as `inject` in the link below. I think we're expecting to continue it even after lazy devices are supported (see #483), so plans would look something like:

```python
def my_plan(x: Motor = i03.x()): ...
```

This issue is to discuss whether we should configure our projects to ignore the error and allow this behaviour because we know best, or follow ruff best practices and find another way to inject devices.

I'm going to throw in an early vote for the latter.

_Originally posted by @callumforrester in https://github.com/DiamondLightSource/dodal/pull/737#discussion_r1711404786_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.