Skip to content

Conversation

@ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Jan 22, 2026

Combine if statements that yield the same end result.

Summary by CodeRabbit

  • Refactor
    • Simplified internal conditional logic to improve code maintainability while preserving existing functionality.
    • Updated linting configuration to enforce consistent code style.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

This pull request simplifies conditional logic in two files and updates the linting configuration. In infrahub_sdk/node/node.py, the _strip_unmodified method consolidates a two-branch condition into a single combined condition. In infrahub_sdk/store.py, the _get_by_hfid method merges two branches into a single condition. The pyproject.toml file removes the Ruff rule SIM114 from the global ignore list, enabling lint checks for similar if branches that could be combined.

🚥 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 'Combine if statements' accurately describes the main objective of the changeset, which consolidates conditional logic across multiple files.

✏️ 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

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: fc7c89a
Status: ✅  Deploy successful!
Preview URL: https://d5d63f6e.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-combine-if-statements.infrahub-sdk-python.pages.dev

View logs

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##           stable     #758      +/-   ##
==========================================
- Coverage   80.39%   80.36%   -0.04%     
==========================================
  Files         115      115              
  Lines       10127     9884     -243     
  Branches     1624     1518     -106     
==========================================
- Hits         8142     7943     -199     
+ Misses       1431     1415      -16     
+ Partials      554      526      -28     
Flag Coverage Δ
integration-tests 41.40% <50.00%> (+0.07%) ⬆️
python-3.10 51.44% <100.00%> (-0.08%) ⬇️
python-3.11 51.42% <100.00%> (-0.10%) ⬇️
python-3.12 51.44% <100.00%> (-0.08%) ⬇️
python-3.13 51.42% <100.00%> (-0.10%) ⬇️
python-3.14 53.07% <100.00%> (-0.32%) ⬇️
python-filler-3.12 24.00% <0.00%> (-0.43%) ⬇️

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

Files with missing lines Coverage Δ
infrahub_sdk/node/node.py 85.16% <100.00%> (+0.18%) ⬆️
infrahub_sdk/store.py 78.48% <100.00%> (+0.90%) ⬆️

... and 3 files with indirect coverage changes

🚀 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 22, 2026 07:56
@ogenstad ogenstad requested a review from a team January 22, 2026 07:56
@ogenstad ogenstad merged commit 72623d7 into stable Jan 22, 2026
21 checks passed
@ogenstad ogenstad deleted the pog-combine-if-statements branch January 22, 2026 12:23
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