Shopify / Shopify/rubydex

Linter idea: strange combinations of indexing and `dig`

Open
#820 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
355
Forks
24
Avg merge
2d 6h
Merged PRs (30d)
17

Description

When we can support type-aware expression auto-correction, it would be nice to rewrite this:

a.first.dig(:a, :b)
a[0].dig(:a, :b)

Into:

a.dig(0, :a, :b)

Likewise for second, third, etc. (though maybe not last, a.dig(-1, :a, :b) works, but it's not very clear).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's examples of indexing, first, second, and third combined with dig. Locate the type-aware expression auto-correction entry point, then determine how the proposed rewrites should be recognized and when they are safe; done means the supported combinations are corrected while ambiguous cases such as last are handled deliberately.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.