Skip to content

Commit e2d8a74

Browse files
committed
Blacklist -> Stoplist
1 parent 228d007 commit e2d8a74

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Change the file contents of the appropriate file.
3434

3535
A simple `git rm` on the approriate file will do the trick.
3636

37-
#### Refer the blacklist
38-
Please do not suggest to add domains from the blacklist. They're banned for the reason. The list currently looks like follows
37+
#### Refer the stoplist
38+
Please do not suggest to add domains from the stoplist. They're banned for the reason. The list currently looks like follows
3939
* si.edu - anyone could register a domain there
4040
* america.edu - anyone could register a domain there
4141
* californiacolleges.edu - anyone could register e-mail account there
File renamed without changes.

src/swot/Compiler.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import java.io.File
77
*/
88

99
object CompilationState {
10-
val blacklist = File("lib/domains/blacklist.txt").readLines().toHashSet()
10+
val stoplist = File("lib/domains/stoplist.txt").readLines().toHashSet()
1111
val domains = File("lib/domains/tlds.txt").readLines().toHashSet()
1212
}
1313

@@ -16,13 +16,13 @@ fun main(args: Array<String>) {
1616
root.walkTopDown().forEach {
1717
if (it.isFile) {
1818
val parts = it.toRelativeString(root).replace('\\', '/').removeSuffix(".txt").split('/').toList()
19-
if (!checkSet(CompilationState.blacklist, parts) && !checkSet(CompilationState.domains, parts)) {
19+
if (!checkSet(CompilationState.stoplist, parts) && !checkSet(CompilationState.domains, parts)) {
2020
CompilationState.domains.add(parts.reversed().joinToString("."))
2121
}
2222
}
2323
}
2424

25-
val blacklist = CompilationState.blacklist.map { "-$it" }.sorted().joinToString("\n")
25+
val stoplist = CompilationState.stoplist.map { "-$it" }.sorted().joinToString("\n")
2626
File("out/artifacts").mkdirs()
27-
File("out/artifacts/swot.txt").writeText(blacklist + "\n" + CompilationState.domains.sorted().joinToString("\n"))
27+
File("out/artifacts/swot.txt").writeText(stoplist + "\n" + CompilationState.domains.sorted().joinToString("\n"))
2828
}

src/swot/Swot.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package swot
22

33
fun isAcademic(email: String): Boolean {
44
val parts = domainParts(email)
5-
return !isBlacklisted(parts) && (isUnderTLD(parts) || findSchoolNames(parts).isNotEmpty())
5+
return !isStoplisted(parts) && (isUnderTLD(parts) || findSchoolNames(parts).isNotEmpty())
66
}
77

88
fun findSchoolNames(emailOrDomain: String): List<String> {
@@ -13,13 +13,13 @@ fun isUnderTLD(parts: List<String>): Boolean {
1313
return checkSet(Resources.tlds, parts)
1414
}
1515

16-
fun isBlacklisted(parts: List<String>): Boolean {
17-
return checkSet(Resources.blackList, parts)
16+
fun isStoplisted(parts: List<String>): Boolean {
17+
return checkSet(Resources.stoplist, parts)
1818
}
1919

2020
private object Resources {
2121
val tlds = readList("/tlds.txt") ?: error("Cannot find /tlds.txt")
22-
val blackList = readList("/blacklist.txt") ?: error("Cannot find /blacklist.txt")
22+
val stoplist = readList("/stoplist.txt") ?: error("Cannot find /stoplist.txt")
2323

2424
fun readList(resource: String) : Set<String>? {
2525
return javaClass.getResourceAsStream(resource)?.reader()?.buffered()?.lineSequence()?.toHashSet()

0 commit comments

Comments
 (0)