mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
DEV: Enable unless
cops
We discussed the use of `unless` internally and decided to enforce available rules from rubocop to restrict its most problematic uses.
This commit is contained in:

committed by
Loïc Guitaut

parent
87de3c2319
commit
f7c57fbc19
@ -40,8 +40,8 @@ module Onebox
|
||||
should_ignore_canonical =
|
||||
IGNORE_CANONICAL_DOMAINS.map { |hostname| uri.hostname.match?(hostname) }.any?
|
||||
|
||||
unless (ignore_canonical_tag && ignore_canonical_tag["content"].to_s == "true") ||
|
||||
should_ignore_canonical
|
||||
if !(ignore_canonical_tag && ignore_canonical_tag["content"].to_s == "true") &&
|
||||
!should_ignore_canonical
|
||||
# prefer canonical link
|
||||
canonical_link = doc.at('//link[@rel="canonical"]/@href')
|
||||
canonical_uri = Addressable::URI.parse(canonical_link)
|
||||
|
Reference in New Issue
Block a user