Class: Koji::Plugins::Domain
- Inherits:
-
Base
- Object
- Base
- Koji::Plugins::Domain
show all
- Defined in:
- lib/koji/plugins/domain.rb
Constant Summary
collapse
- SUSPICIOUS_WORDS =
%w(dev development stg staging test testing).freeze
Instance Attribute Summary
Attributes inherited from Base
#website
Instance Method Summary
collapse
Methods inherited from Base
inherited, #initialize, #name, #report
Instance Method Details
#domain ⇒ Object
10
11
12
|
# File 'lib/koji/plugins/domain.rb', line 10
def domain
@domain ||= PublicSuffix.parse(website.url.hostname)
end
|
#evidence_list ⇒ Object
14
15
16
17
18
|
# File 'lib/koji/plugins/domain.rb', line 14
def evidence_list
@evidence_list ||= domain.trd.to_s.split(".").map do |part|
"#{domain} contains a suspicious keyword: #{part}." if SUSPICIOUS_WORDS.include?(part)
end.compact
end
|
#score ⇒ Object
20
21
22
|
# File 'lib/koji/plugins/domain.rb', line 20
def score
evidence_list.empty? ? 0 : 50
end
|