Skip to content

refactor: replace lambda with operator.itemgetter in query result sorting#8971

Open
ogenstad wants to merge 1 commit intodevelopfrom
pog-furb-20260417
Open

refactor: replace lambda with operator.itemgetter in query result sorting#8971
ogenstad wants to merge 1 commit intodevelopfrom
pog-furb-20260417

Conversation

@ogenstad
Copy link
Copy Markdown
Contributor

@ogenstad ogenstad commented Apr 17, 2026

Why

These two ruff rules (FURB118, FURB140) were previously suppressed. The fixes are straightforward — operator.itemgetter and itertools.starmap are the idiomatic stdlib alternatives when a lambda or comprehension does nothing but unpack and forward arguments to a function. Enabling the rules and fixing the violations reduces the ignore list and keeps the codebase consistent with the rest of the ruff configuration.

What changed

Removed FURB118 and FURB140 from the ruff ignore list in pyproject.toml and fixed all violations.


Summary by cubic

Replaced lambda and manual unpacking with stdlib helpers for clearer code and ruff compliance. Removed FURB118 and FURB140 from the ignore list and fixed all violations.

  • Refactors
    • Use operator.itemgetter(1) for result sorting in backend/infrahub/core/query/__init__.py.
    • Use itertools.starmap to build relationship subqueries in attribute_remove.py and attribute_rename.py.

Written for commit 52843a3. Summary will update on new commits.

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Apr 17, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 17, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing pog-furb-20260417 (52843a3) with develop (1aadf70)

Open in CodSpeed

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

@ogenstad ogenstad marked this pull request as ready for review April 17, 2026 15:49
@ogenstad ogenstad requested a review from a team as a code owner April 17, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/backend Issue related to the backend (API Server, Git Agent)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant