Skip to content

Bug: Gemfile and gemspec lines with more than one version constraint keep only the first #624

Closed

Description

@vibgrate-team

Context

parseGemfileLine and parseGemspec in src/core-open/scanners/ruby-scanner.ts capture a single quoted constraint after the gem name. Ruby allows several:

gem "rails", ">= 7.0", "< 8"
spec.add_dependency "rack", ">= 2.2", "< 4"

currentSpec is reported as >= 7.0, which hides the upper bound that usually explains why a project is behind.

What to do

  • Capture every quoted constraint before the first non-string argument (e.g. require:, group:), and join them with , for currentSpec.
  • Keep version extraction for drift based on the lower bound, as today.
  • Add unit tests.

Acceptance

  • The Gemfile example reports currentSpec >= 7.0, < 8.
  • gem "pg", "~> 1.5", require: false still reports ~> 1.5.
  • Drift results are unchanged for single-constraint lines.

Activity

  1. added
    bug
    on Nov 10, 2026
  2. vibgrate-team commented on Nov 10, 2026

    @vibgrate-team
    ContributorAuthor

    Confirmed: parseGemfileLine (line 206) and the parseGemspec regex (line 366) in src/core-open/scanners/ruby-scanner.ts each capture one quoted constraint after the name, so gem "rails", ">= 7.0", "< 8" reports only >= 7.0.

    Rather than stretching the regex, split the argument list after the gem name into tokens and take quoted strings until the first token that isn't a plain string (require:, group:, platforms: and so on). Join them with , for currentSpec, and keep feeding the first lower-bound constraint into the existing version extraction so drift doesn't change. Cover the require: false case explicitly, since that's the easiest one to break.

  3. added a commit that references this issue on Nov 11, 2026
    e953811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions