Skip to content

LCORE-2097: Refactoring, added new Ruff rule#1661

Merged
tisnik merged 2 commits into
lightspeed-core:mainfrom
tisnik:lcore-2097-refactoring
May 3, 2026
Merged

LCORE-2097: Refactoring, added new Ruff rule#1661
tisnik merged 2 commits into
lightspeed-core:mainfrom
tisnik:lcore-2097-refactoring

Conversation

@tisnik
Copy link
Copy Markdown
Contributor

@tisnik tisnik commented May 3, 2026

Description

LCORE-2097: Refactoring, added new Ruff rule

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: N/A
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-2097

Summary by CodeRabbit

  • Chores

    • Enhanced linting rules for improved code quality.
  • Bug Fixes

    • Fixed nested dictionary traversal in schema processing.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 98917252-304f-410e-957f-11713f583805

📥 Commits

Reviewing files that changed from the base of the PR and between 1c9aaf4 and 377ac74.

📒 Files selected for processing (2)
  • pyproject.toml
  • src/utils/schema_dumper.py
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: mypy
  • GitHub Check: Pylinter
  • GitHub Check: radon
  • GitHub Check: integration_tests (3.13)
  • GitHub Check: integration_tests (3.12)
  • GitHub Check: unit_tests (3.13)
  • GitHub Check: unit_tests (3.12)
  • GitHub Check: spectral
  • GitHub Check: bandit
  • GitHub Check: build-pr
  • GitHub Check: Pyright
  • GitHub Check: E2E: server mode / ci / group 3
  • GitHub Check: E2E: server mode / ci / group 1
  • GitHub Check: E2E: library mode / ci / group 1
  • GitHub Check: E2E: library mode / ci / group 3
  • GitHub Check: E2E: server mode / ci / group 2
  • GitHub Check: E2E: library mode / ci / group 2
  • GitHub Check: E2E Tests for Lightspeed Evaluation job
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.py: Use absolute imports for internal modules: from authentication import get_auth_dependency
All modules start with descriptive docstrings explaining purpose
Use logger = get_logger(__name__) from log.py for module logging
Type aliases defined at module level for clarity
Use Final[type] as type hint for all constants
All functions require docstrings with brief descriptions
Complete type annotations for function parameters and return types
Use Union types with modern syntax: str | int
Use Optional[Type] for optional type hints
Use snake_case with descriptive, action-oriented function names (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns: return new data structures instead of modifying parameters
Use async def for I/O operations and external API calls
Use logger.debug() for detailed diagnostic information
Use logger.info() for general information about program execution
Use logger.warning() for unexpected events or potential problems
Use logger.error() for serious problems that prevented function execution
All classes require descriptive docstrings explaining purpose
Use PascalCase for class names with descriptive names and standard suffixes: Configuration, Error/Exception, Resolver, Interface
Abstract classes use ABC with @abstractmethod decorators
Complete type annotations for all class attributes, use specific types, not Any
Follow Google Python docstring conventions for all modules, classes, and functions
Docstring Parameters section documents function parameters
Docstring Returns section documents function return values
Docstring Raises section documents exceptions that may be raised
Use black for code formatting
Use pylint for static analysis with source-roots configuration set to "src"
Use pyright for type checking
Use ruff for fast linting
Use pydocstyle for docstring style validation
Use mypy for additional type checking
Use bandit for security issue detection

Files:

  • src/utils/schema_dumper.py
🔇 Additional comments (2)
pyproject.toml (1)

234-234: LGTM — PLR1733 is a valid, well-scoped rule addition.

PLR1733 (unnecessary-dict-index-lookup) flags cases where the current value from a .items() iteration is already available alongside its key, making a re-lookup redundant. The rule was stabilized (graduated from preview) in Ruff v0.12.0. The addition is correctly paired with the schema_dumper.py fix in this same PR.

src/utils/schema_dumper.py (1)

25-28: LGTM — correct and clean fix.

Using the already-unpacked value from the for key, value in original.items() loop eliminates the redundant original[key] re-lookup directly matching the new PLR1733 rule, and the function continues to build and return a fresh dict rather than mutating its parameter.


Walkthrough

This pull request contains two independent changes: enabling the PLR1733 lint rule in Ruff configuration, and correcting the recursive_update function in schema_dumper.py to use the already-extracted value instead of re-indexing the original dictionary during nested traversal.

Changes

Linting Rule Configuration

Layer / File(s) Summary
Lint Configuration
pyproject.toml
Ruff lint extend-select is extended with PLR1733 to enforce an additional lint rule.

Schema Dumper Recursion Fix

Layer / File(s) Summary
Core Logic
src/utils/schema_dumper.py
recursive_update now passes the already-extracted value to the recursive call instead of re-indexing original[key] when traversing nested dictionaries.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: refactoring work in schema_dumper.py and addition of a new Ruff rule (PLR1733) in pyproject.toml.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@tisnik tisnik merged commit da93225 into lightspeed-core:main May 3, 2026
31 checks passed
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.

1 participant