Skip to content

Conversation

@yarkivaev
Copy link
Contributor

@yarkivaev yarkivaev commented Sep 5, 2025

Summary by CodeRabbit

  • New Features

    • Added List.skip(index) to return the list tail after skipping the first index elements.
    • Behavior: index=0 returns the original list; index ≥ length returns an empty list; supports nested and mixed-type lists.
    • Input validation: negative indices raise a clear error.
  • Tests

    • Extensive coverage for zero, negative, exact-length, over-length, single-element, empty, nested, and mixed-type lists.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 5, 2025

Walkthrough

Adds a new public method skip(index) to org.eolang.structs.list that returns the tail after removing the first index elements, validates negative indices (throws error), and uses a recursive rec-skip traversal; tests cover zero, negative, out-of-range, empty, nested, and mixed-type cases.

Changes

Cohort / File(s) Summary
List API: add skip(index)
eo-runtime/src/main/eo/org/eolang/structs/list.eo
Adds public method [index] > skip with negative-index validation (error "Can't skip negative number of elements: %d"), behavior: return original for 0, empty for index >= length, and a recursive rec-skip to traverse and return the remaining tail for in-range positive indices. Tests added covering multiple scenarios and data types.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant List as List
  participant Skip as skip(index)
  participant Rec as rec-skip

  Caller->>List: skip(index)
  activate List
  List->>Skip: validate index
  alt index < 0
    Skip-->>Caller: error "Can't skip negative number of elements: %d"
  else index == 0
    Skip-->>Caller: original list
  else index > 0
    Skip->>Rec: rec-skip(origin, tup, index)
    loop while index > 0 and elements remain
      Rec->>Rec: advance origin/tup, decrement index
    end
    alt elements remain
      Rec-->>Skip: remaining tail
    else no elements
      Rec-->>Skip: empty list
    end
    Skip-->>Caller: result list
  end
  deactivate List
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hop through lists with nimble cheer,
I count the skips and leave a rear.
Zero keeps all, too far — I part,
Tail left shining, a tiny art.
A rabbit's skip — precise and clear. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7226e60 and 7578cf4.

📒 Files selected for processing (1)
  • eo-runtime/src/main/eo/org/eolang/structs/list.eo (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • eo-runtime/src/main/eo/org/eolang/structs/list.eo
⏰ 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). (9)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: qulice
  • GitHub Check: trufflehog
  • GitHub Check: mvn (ubuntu-24.04, 11)
  • GitHub Check: mvn (windows-2022, 23)
  • GitHub Check: mvn (ubuntu-24.04, 23)
  • GitHub Check: mvn (macos-15, 23)
  • GitHub Check: benchmark
  • GitHub Check: ebnf
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 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>, please review it.
    • 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.
  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2025

🚀 Performance Analysis

All benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information.

Click to see the detailed report
Test Base Score PR Score Change % Change Unit Mode
benchmarks.XmirBench.xmirToEO 181.735 185.728 3.994 2.20% ms/op Average Time

⚠️ Performance loss: benchmarks.XmirBench.xmirToEO is slower by 3.994 ms/op (2.20%)

Copy link
Contributor

@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: 1

🧹 Nitpick comments (1)
eo-runtime/src/main/eo/org/eolang/structs/list.eo (1)

269-286: Validation and zero-skip behavior look good; one nit.

Logic for negative indices and idx=0 is correct. Minor: casting with (number idx) is likely redundant since idx is already a number (consistent with nearby code either way).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 594ba21 and 7226e60.

📒 Files selected for processing (1)
  • eo-runtime/src/main/eo/org/eolang/structs/list.eo (2 hunks)
⏰ 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). (12)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: ort
  • GitHub Check: trufflehog
  • GitHub Check: mvn (ubuntu-24.04, 23)
  • GitHub Check: ebnf
  • GitHub Check: mvn (windows-2022, 23)
  • GitHub Check: snippets
  • GitHub Check: mvn (macos-15, 23)
  • GitHub Check: mvn (ubuntu-24.04, 11)
  • GitHub Check: qulice
  • GitHub Check: integration
  • GitHub Check: benchmark
🔇 Additional comments (1)
eo-runtime/src/main/eo/org/eolang/structs/list.eo (1)

803-909: Tests are comprehensive; will fail until rec-skip is fixed.

Coverage is strong (zero, negative, ≥length, complex/nested, boundary len−1). After the fix above, these should pass.

@0crat
Copy link

0crat commented Sep 6, 2025

@yarkivaev Hey there! 👋 I noticed your branch name "list_skip" doesn't quite follow our naming convention. Remember, we use ticket numbers for branch names (like "4523" in this case). Our policy deducts 12 points for this, so your balance is now -7. Don't worry though, it's an easy fix for next time! Keep an eye on your Zerocracy balance too. Let's nail those branch names moving forward! 💪

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