Skip to content

Commit 4a9f032

Browse files
author
bscriver123 (aider)
committed
feat: Add support for custom first-party libraries in ruff config
1 parent 9a18f65 commit 4a9f032

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pytest_examples/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class ExamplesConfig:
2828
ruff_select: list[str] | None = None
2929
ruff_ignore: list[str] | None = None
3030
white_space_dot: bool = False
31+
first_party: list[str] | None = None
3132
"""If True, replace spaces with `·` in example diffs."""
3233

3334
def black_mode(self):
@@ -69,10 +70,11 @@ def ruff_config(self) -> tuple[str, ...]:
6970

7071
if self.upgrade:
7172
select.append('UP')
72-
if self.isort:
73+
if self.isort and 'I' not in select:
7374
select.append('I')
7475

75-
if self.ruff_ignore:
76+
if self.first_party:
77+
args.append(f'--first-party={",".join(self.first_party)}')
7678
ignore.extend(self.ruff_ignore)
7779

7880
if select:

0 commit comments

Comments
 (0)