Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: object index filters #62

Merged
merged 3 commits into from
Jun 7, 2024
Merged

fix: object index filters #62

merged 3 commits into from
Jun 7, 2024

Conversation

koladilip
Copy link
Collaborator

@koladilip koladilip commented Jun 6, 2024

What are the changes introduced in this PR?

obj{!["a", "b"]} is working but obj{!(.a==1}) was failing so this is fixing the same

What is the related Linear task?

Resolves INT-2160

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

N/A

@coderabbitai review


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved filtering logic to handle specific conditions more accurately.
  • Tests

    • Restructured test data format for better clarity and consistency.
    • Updated filter condition logic in test scenarios for enhanced validation.
    • Introduced a new test case for invalid object index filters.

@koladilip koladilip requested a review from a team as a code owner June 6, 2024 17:27
Copy link

coderabbitai bot commented Jun 6, 2024

Walkthrough

The recent changes focus on refining object filter parsing, restructuring test data formats, and enhancing filter logic conditions in various test scenarios. These updates aim to improve the accuracy and flexibility of object filtering within the JsonTemplateParser class and ensure that test cases reflect these changes accurately.

Changes

File(s) Change Summary
src/parser.ts Adjusted conditions for excluding in the parseObjectFilter method within JsonTemplateParser class.
test/scenarios/filters/data.ts Restructured output data format from object with key-value pairs to an array of objects.
test/scenarios/filters/object_filters.jt Modified filter condition logic related to type checks.
test/scenarios/filters/object_indexes.jt Updated object manipulation syntax to include specific object keys and operations.
test/scenarios/filters/invalid_object_index_filters.jt Introduced a new file with an invalid index filter scenario.

Sequence Diagrams (Beta)

sequenceDiagram
    participant User
    participant JsonTemplateParser
    participant Lexer
    participant DataStructure

    User->>JsonTemplateParser: Call parseObjectFilter()
    JsonTemplateParser->>Lexer: Check for '~' or '!'
    Lexer-->>JsonTemplateParser: Return match result
    JsonTemplateParser->>Lexer: Check for '[' with offset 1
    Lexer-->>JsonTemplateParser: Return match result
    JsonTemplateParser->>DataStructure: Apply filter based on conditions
    DataStructure-->>JsonTemplateParser: Return filtered data
    JsonTemplateParser-->>User: Return result
Loading

Poem

In the land of code so bright,
Filters dance with pure delight.
Objects parsed with keen insight,
Tests now structured, just right.
Bugs and errors take their flight,
As logic shines in code's twilight. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

github-actions bot commented Jun 6, 2024

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 100% 4549/4549
🟢 Branches 100% 1222/1222
🟢 Functions 100% 342/342
🟢 Lines 100% 4549/4549

Test suite run success

164 tests passing in 3 suites.

Report generated by 🧪jest coverage report action from c5f90b6

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (19d94c2) to head (c5f90b6).
Report is 48 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main       #62     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files           10        14      +4     
  Lines         3078      4549   +1471     
  Branches       726      1078    +352     
===========================================
+ Hits          3078      4549   +1471     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b5b6a4a and 63b15d8.

Files selected for processing (4)
  • src/parser.ts (1 hunks)
  • test/scenarios/filters/data.ts (1 hunks)
  • test/scenarios/filters/object_filters.jt (1 hunks)
  • test/scenarios/filters/object_indexes.jt (1 hunks)
Additional context used
Biome
src/parser.ts

[error] 1480-1480: Using this in a static context can be confusing. (lint/complexity/noThisInStatic)

this refers to the class.
Unsafe fix: Use the class name instead.


[error] 1486-1486: Using this in a static context can be confusing. (lint/complexity/noThisInStatic)

this refers to the class.
Unsafe fix: Use the class name instead.


[error] 1493-1493: Using this in a static context can be confusing. (lint/complexity/noThisInStatic)

this refers to the class.
Unsafe fix: Use the class name instead.


[error] 1524-1524: Using this in a static context can be confusing. (lint/complexity/noThisInStatic)

this refers to the class.
Unsafe fix: Use the class name instead.

Additional comments not posted (4)
test/scenarios/filters/object_indexes.jt (1)

7-7: Updated object manipulation syntax aligns with the intended fix for object index filters.

test/scenarios/filters/object_filters.jt (1)

7-7: Updated filter condition to check for non-string types enhances consistency in object index filters.

test/scenarios/filters/data.ts (1)

43-47: Restructured output data format from an object with key-value pairs to an array of objects supports the updated test scenarios.

src/parser.ts (1)

468-472: Refined condition for excluding elements in parseObjectFilter method aligns with the intended fix for object index filters.

@koladilip koladilip requested a review from utsabc June 6, 2024 17:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 63b15d8 and 203895e.

Files selected for processing (2)
  • test/scenarios/filters/data.ts (2 hunks)
  • test/scenarios/filters/invalid_object_index_filters.jt (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • test/scenarios/filters/data.ts
Additional comments not posted (1)
test/scenarios/filters/invalid_object_index_filters.jt (1)

1-1: LGTM! Good addition to test the handling of invalid object index filters.

@koladilip koladilip requested a review from ItsSudip June 7, 2024 04:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 203895e and c5f90b6.

Files selected for processing (1)
  • test/scenarios/filters/object_filters.jt (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • test/scenarios/filters/object_filters.jt

Copy link

sonarqubecloud bot commented Jun 7, 2024

@koladilip koladilip merged commit e02b9e0 into main Jun 7, 2024
12 checks passed
@koladilip koladilip deleted the fix.object-index-filters branch June 7, 2024 05:27
@github-actions github-actions bot mentioned this pull request Jun 7, 2024
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.

2 participants