Skip to content

Commit 6f7074e

Browse files
authored
Fix MS tp/fp comments
1 parent 77c9ad2 commit 6f7074e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

app/controllers/github_controller.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,35 @@ def pull_request_hook
6666

6767
# Identify blacklist type and use appropriate search
6868

69-
domains = text.scan(/<!-- METASMOKE-BLACKLIST-WEBSITE (.*?) -->/)[0][0]
69+
domains = text.scan(/<!-- METASMOKE-BLACKLIST-WEBSITE (.*?) -->/)
7070

7171
domains.each do |domain|
72+
domain = domain[0]
73+
7274
num_tps = Post.where('body LIKE ?', "%#{domain}%").where(is_tp: true).count
7375
num_fps = Post.where('body LIKE ?', "%#{domain}%").where(is_fp: true).count
7476
num_naa = Post.where('body LIKE ?', "%#{domain}%").where(is_naa: true).count
7577

7678
response_text += get_line domain, num_tps, num_fps, num_naa
7779
end
7880

79-
keywords = text.scan(/<!-- METASMOKE-BLACKLIST-KEYWORD (.*?) -->/)[0][0]
81+
keywords = text.scan(/<!-- METASMOKE-BLACKLIST-KEYWORD (.*?) -->/)
8082

8183
keywords.each do |keyword|
84+
keyword = keyword[0]
85+
8286
num_tps = Post.where('body LIKE ?', "%#{keyword}%").where(is_tp: true).count
8387
num_fps = Post.where('body LIKE ?', "%#{keyword}%").where(is_fp: true).count
8488
num_naa = Post.where('body LIKE ?', "%#{keyword}%").where(is_naa: true).count
8589

8690
response_text += get_line keyword, num_tps, num_fps, num_naa
8791
end
8892

89-
usernames = text.scan(/<!-- METASMOKE-BLACKLIST-USERNAME (.*?) -->/)[0][0]
93+
usernames = text.scan(/<!-- METASMOKE-BLACKLIST-USERNAME (.*?) -->/)
9094

9195
usernames.each do |username|
96+
username = username[0]
97+
9298
num_tps = Post.where('body LIKE ?', "%#{username}%").where(is_tp: true).count
9399
num_fps = Post.where('body LIKE ?', "%#{username}%").where(is_fp: true).count
94100
num_naa = Post.where('body LIKE ?', "%#{username}%").where(is_naa: true).count

0 commit comments

Comments
 (0)