Skip to content

Commit

Permalink
Merge pull request #54 from 47deg/nm-31-magic
Browse files Browse the repository at this point in the history
Pulling in the magic strings from an online source
  • Loading branch information
noelmarkham authored Jul 6, 2017
2 parents c6891f3 + 16d7376 commit c7e3548
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "magic/big-list-of-naughty-strings"]
path = magic/big-list-of-naughty-strings
url = https://github.com/minimaxir/big-list-of-naughty-strings.git
1 change: 1 addition & 0 deletions magic/big-list-of-naughty-strings
1 change: 1 addition & 0 deletions magic/src/main/resources/blns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ import org.scalacheck.Arbitrary.arbitrary

object Magic {

private[magic] val strings =
List("This", "is", "a", "temporary", "list", "of", "strings")
val stream = getClass.getResourceAsStream("/blns.txt")

private[magic] val strings = scala.io.Source
.fromInputStream(stream)
.getLines
.filterNot { s =>
val trimmed = s.trim
trimmed.startsWith("#") || trimmed.isEmpty
}
.toList

val magicStrings: Gen[String] = oneOf(strings)

Expand Down
2 changes: 1 addition & 1 deletion project/ProjectPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ object ProjectPlugin extends AutoPlugin {
"docs/unidoc".asRunnableItemFull
)
)
}
}

0 comments on commit c7e3548

Please sign in to comment.