mapbox / mapbox/mapbox-navigation-ios

Refactoring code to avoid manual index comparison.

Open
#3,438 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

jira-sync-complete topic: stability
Dominant language
Swift
Stars
918
Forks
326
Avg merge
1h 16m
Merged PRs (30d)
3

Description

There're multiple places in our code repo that are using the `endIndex` or `count` for the out-of-bound check and calculation. To avoid this issue, it should be refactored to `indices.contains(_:)` to avoid the manual comparison.

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

Search the repository for out-of-bounds checks and calculations using `endIndex` or `count`, then identify the applicable occurrences across the codebase. Refactor those checks to use `indices.contains(_:)` and run the existing test suite to confirm navigation behavior is unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.