Skip to content

Dev/expressionparser#21

Merged
jgeudens merged 2 commits intomasterfrom
dev/expressionparser
Apr 2, 2026
Merged

Dev/expressionparser#21
jgeudens merged 2 commits intomasterfrom
dev/expressionparser

Conversation

@jgeudens
Copy link
Copy Markdown
Member

@jgeudens jgeudens commented Apr 2, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Resolved incorrect handling of expressions containing duplicate register token references.
  • Tests

    • Added test coverage for duplicate register expressions.
    • Introduced test scenario for high-index register handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e4a56d97-b92e-46df-9b1f-b80ddea1cdd4

📥 Commits

Reviewing files that changed from the base of the PR and between 4dfd93e and c4e1904.

📒 Files selected for processing (5)
  • src/datahandling/expressionparser.cpp
  • src/datahandling/expressionparser.h
  • src/datahandling/graphdatahandler.cpp
  • tests/datahandling/tst_expressionparser.cpp
  • tests/datahandling/tst_expressionparser.h

Walkthrough

ExpressionParser is refactored to remove QObject inheritance, adopt value-returning const accessor methods instead of out-parameter mutators, and improve const-correctness throughout. Constructor and method parameters now use const references. Callers are updated to use the new API.

Changes

Cohort / File(s) Summary
ExpressionParser Core
src/datahandling/expressionparser.h, src/datahandling/expressionparser.cpp
Removed QObject inheritance and Q_OBJECT macro. Constructor parameter changed to const QStringList&. Replaced out-parameter methods dataPoints(QList<DataPoint>&) and processedExpressions(QStringList&) with const value-returning variants. Enhanced const-correctness by updating parameters in parseExpressions() and processRegisterExpression() to const references. Made _findRegRegex member const and initialized via member initializer. Updated register lookup logic to use indexOf() instead of contains() branching and clamped whitespace calculations to prevent negative values.
GraphDataHandler Integration
src/datahandling/graphdatahandler.cpp
Updated setupExpressions() to use value-returning APIs from ExpressionParser. Replaced out-parameter pattern where regList and processedExpList were default-constructed and populated via reference-passing with direct assignment from const return values.
Test Suite
tests/datahandling/tst_expressionparser.h, tests/datahandling/tst_expressionparser.cpp
Added two new test cases: singleExpressionDuplicate() testing duplicate register tokens in a single expression, and manyRegistersHighIndex() testing handling of higher-index register tokens. Refactored verifyParsing() helper to accept all parameters by const reference and compare against parser results obtained via the new value-returning accessor methods.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Dev/expressionparser' is overly vague and does not clearly describe the main changes, which involve refactoring the ExpressionParser API from output-parameter methods to value-returning const methods. Consider using a more descriptive title such as 'Refactor ExpressionParser API to use value-returning const methods' to better convey the primary change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/expressionparser

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.

@jgeudens jgeudens merged commit 180a3bd into master Apr 2, 2026
10 checks passed
@jgeudens jgeudens deleted the dev/expressionparser branch April 2, 2026 20:40
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