Skip to content

Add CollectionIndexOnNonIndexedSeq rule to Scapegoat#1

Closed
JoshRosen wants to merge 1 commit intomasterfrom
index-on-non-indexed-seq
Closed

Add CollectionIndexOnNonIndexedSeq rule to Scapegoat#1
JoshRosen wants to merge 1 commit intomasterfrom
index-on-non-indexed-seq

Conversation

@JoshRosen
Copy link
Copy Markdown
Owner

Inspired by https://twitter.com/jshrsn/status/865677863646658560, this patch adds a new IndexingOnANonIndexedSeq rule which raises a warning when we see code which indexes on a Seq which isn't known to be an IndexedSeq subtype. The goal here is to make it easier to prevent cases where someone writes an O(n^2) loop by accident.

This rule should have prevented the following Spark bugs:

For comparision, here's the same rule implemented in linter: JoshRosen/linter#1

@JoshRosen
Copy link
Copy Markdown
Owner Author

Upstream PR: scapegoat-scala#158

@JoshRosen JoshRosen force-pushed the index-on-non-indexed-seq branch from 0a1bb31 to 36ad93e Compare May 20, 2017 22:54
@JoshRosen JoshRosen closed this May 20, 2017
@JoshRosen JoshRosen deleted the index-on-non-indexed-seq branch May 21, 2017 23:45
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.

1 participant