From e2d8a745295c0ba50219538082ff1f58c98a33e5 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Wed, 10 Jun 2020 19:59:58 +0300 Subject: [PATCH] Blacklist -> Stoplist --- CONTRIBUTING.md | 4 ++-- lib/domains/{blacklist.txt => stoplist.txt} | 0 src/swot/Compiler.kt | 8 ++++---- src/swot/Swot.kt | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) rename lib/domains/{blacklist.txt => stoplist.txt} (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0bd4671d60e..2125437735d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,8 +34,8 @@ Change the file contents of the appropriate file. A simple `git rm` on the approriate file will do the trick. -#### Refer the blacklist -Please do not suggest to add domains from the blacklist. They're banned for the reason. The list currently looks like follows +#### Refer the stoplist +Please do not suggest to add domains from the stoplist. They're banned for the reason. The list currently looks like follows * si.edu - anyone could register a domain there * america.edu - anyone could register a domain there * californiacolleges.edu - anyone could register e-mail account there diff --git a/lib/domains/blacklist.txt b/lib/domains/stoplist.txt similarity index 100% rename from lib/domains/blacklist.txt rename to lib/domains/stoplist.txt diff --git a/src/swot/Compiler.kt b/src/swot/Compiler.kt index 35dbf91cbf0..eb97b4669e5 100644 --- a/src/swot/Compiler.kt +++ b/src/swot/Compiler.kt @@ -7,7 +7,7 @@ import java.io.File */ object CompilationState { - val blacklist = File("lib/domains/blacklist.txt").readLines().toHashSet() + val stoplist = File("lib/domains/stoplist.txt").readLines().toHashSet() val domains = File("lib/domains/tlds.txt").readLines().toHashSet() } @@ -16,13 +16,13 @@ fun main(args: Array) { root.walkTopDown().forEach { if (it.isFile) { val parts = it.toRelativeString(root).replace('\\', '/').removeSuffix(".txt").split('/').toList() - if (!checkSet(CompilationState.blacklist, parts) && !checkSet(CompilationState.domains, parts)) { + if (!checkSet(CompilationState.stoplist, parts) && !checkSet(CompilationState.domains, parts)) { CompilationState.domains.add(parts.reversed().joinToString(".")) } } } - val blacklist = CompilationState.blacklist.map { "-$it" }.sorted().joinToString("\n") + val stoplist = CompilationState.stoplist.map { "-$it" }.sorted().joinToString("\n") File("out/artifacts").mkdirs() - File("out/artifacts/swot.txt").writeText(blacklist + "\n" + CompilationState.domains.sorted().joinToString("\n")) + File("out/artifacts/swot.txt").writeText(stoplist + "\n" + CompilationState.domains.sorted().joinToString("\n")) } diff --git a/src/swot/Swot.kt b/src/swot/Swot.kt index 9905ee3ff59..9c00f643643 100644 --- a/src/swot/Swot.kt +++ b/src/swot/Swot.kt @@ -2,7 +2,7 @@ package swot fun isAcademic(email: String): Boolean { val parts = domainParts(email) - return !isBlacklisted(parts) && (isUnderTLD(parts) || findSchoolNames(parts).isNotEmpty()) + return !isStoplisted(parts) && (isUnderTLD(parts) || findSchoolNames(parts).isNotEmpty()) } fun findSchoolNames(emailOrDomain: String): List { @@ -13,13 +13,13 @@ fun isUnderTLD(parts: List): Boolean { return checkSet(Resources.tlds, parts) } -fun isBlacklisted(parts: List): Boolean { - return checkSet(Resources.blackList, parts) +fun isStoplisted(parts: List): Boolean { + return checkSet(Resources.stoplist, parts) } private object Resources { val tlds = readList("/tlds.txt") ?: error("Cannot find /tlds.txt") - val blackList = readList("/blacklist.txt") ?: error("Cannot find /blacklist.txt") + val stoplist = readList("/stoplist.txt") ?: error("Cannot find /stoplist.txt") fun readList(resource: String) : Set? { return javaClass.getResourceAsStream(resource)?.reader()?.buffered()?.lineSequence()?.toHashSet()