Skip to content

Conversation

@ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Jan 27, 2026

Use list comprehension instead of adding single elements to a list when iterating a for-loop.

Summary by CodeRabbit

  • Refactor

    • Simplified internal code patterns by replacing iterative accumulation with more concise list comprehensions and generator-based operations across multiple modules, improving code consistency without affecting functionality.
  • Chores

    • Enabled PERF401 linting rule enforcement to improve code quality standards.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

Walkthrough

This pull request refactors collection-building patterns across multiple modules in the infrahub SDK. Iterative append operations are replaced with list comprehensions and generator-based extend calls in batch.py, client.py, diff.py, spec/object.py, utils.py, and yaml.py. Explicit type annotations are added to local variables in client.py and utils.py. Additionally, the PERF401 lint rule is enabled in pyproject.toml by removing it from the ignore list, which will enforce performance-oriented code patterns going forward.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Use a list comprehension to create a transformed list' accurately reflects the main change across multiple files: replacing iterative list building with list comprehensions and generator-based extend calls.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 27, 2026

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: dee576f
Status: ✅  Deploy successful!
Preview URL: https://5d01c1d8.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-perf401.infrahub-sdk-python.pages.dev

View logs

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/client.py 25.00% 3 Missing ⚠️
@@           Coverage Diff           @@
##           stable     #774   +/-   ##
=======================================
  Coverage   80.39%   80.39%           
=======================================
  Files         115      115           
  Lines        9869     9859   -10     
  Branches     1511     1503    -8     
=======================================
- Hits         7934     7926    -8     
+ Misses       1413     1411    -2     
  Partials      522      522           
Flag Coverage Δ
integration-tests 41.43% <20.00%> (+0.02%) ⬆️
python-3.10 51.41% <70.00%> (-0.03%) ⬇️
python-3.11 51.41% <70.00%> (-0.01%) ⬇️
python-3.12 51.39% <70.00%> (-0.05%) ⬇️
python-3.13 51.39% <70.00%> (-0.05%) ⬇️
python-3.14 53.04% <70.00%> (-0.03%) ⬇️
python-filler-3.12 24.07% <0.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/batch.py 94.36% <100.00%> (-0.16%) ⬇️
infrahub_sdk/diff.py 96.42% <100.00%> (-0.13%) ⬇️
infrahub_sdk/spec/object.py 85.19% <100.00%> (-0.10%) ⬇️
infrahub_sdk/utils.py 88.47% <100.00%> (-0.06%) ⬇️
infrahub_sdk/yaml.py 86.23% <100.00%> (-0.13%) ⬇️
infrahub_sdk/client.py 72.00% <25.00%> (+0.14%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ogenstad ogenstad marked this pull request as ready for review January 27, 2026 16:31
@ogenstad ogenstad requested a review from a team as a code owner January 27, 2026 16:31
@ogenstad ogenstad merged commit 8f9606a into stable Jan 27, 2026
21 checks passed
@ogenstad ogenstad deleted the pog-PERF401 branch January 27, 2026 18:32
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