Upgrade ameba & typos CI (#283)

* Bump ameba to `~> 1.4.0`
* Bump typos to `1.14.6`
This commit is contained in:
George Dietrich 2023-04-16 12:17:31 -04:00 committed by GitHub
parent 14b5e0589e
commit 748c63ebd0
2 changed files with 9 additions and 15 deletions

View file

@ -12,7 +12,7 @@ class Athena::Negotiation::LanguageNegotiator < Athena::Negotiation::AbstractNeg
base_equal = accept_base.downcase == priority_base.downcase
sub_equal = accept_sub.try &.downcase == priority_sub.try &.downcase
if ((accept_base == "*" || base_equal) && (accept_sub.nil? || sub_equal))
if (accept_base == "*" || base_equal) && (accept_sub.nil? || sub_equal)
score = 10 * (base_equal ? 1 : 0) + (sub_equal ? 1 : 0)
return ANG::AcceptMatch.new accept.quality * priority.quality, score, index

View file

@ -21,11 +21,9 @@ class Athena::Negotiation::Negotiator < Athena::Negotiation::AbstractNegotiator(
type_equals = accept_type.downcase == priority_type.downcase
sub_type_equals = accept_sub_type.downcase == priority_sub_type.downcase
if (
(accept_type == "*" || type_equals) &&
(accept_sub_type == "*" || sub_type_equals) &&
intersection.size == accept.parameters.size
)
if (accept_type == "*" || type_equals) &&
(accept_sub_type == "*" || sub_type_equals) &&
intersection.size == accept.parameters.size
score = 100 * (type_equals ? 1 : 0) + 10 * (sub_type_equals ? 1 : 0) + intersection.size
return ANG::AcceptMatch.new accept.quality * priority.quality, score, index
@ -36,21 +34,17 @@ class Athena::Negotiation::Negotiator < Athena::Negotiation::AbstractNegotiator(
accept_sub_type, accept_plus = self.split_sub_type accept_sub_type
priority_sub_type, priority_plus = self.split_sub_type priority_sub_type
if (
!(accept_type == "*" || type_equals) ||
!(accept_sub_type == "*" || priority_sub_type == "*" || accept_plus == "*" || priority_plus == "*")
)
if !(accept_type == "*" || type_equals) ||
!(accept_sub_type == "*" || priority_sub_type == "*" || accept_plus == "*" || priority_plus == "*")
return nil
end
sub_type_equals = accept_sub_type.downcase == priority_sub_type.downcase
plus_equals = accept_plus.downcase == priority_plus.downcase
if (
(accept_sub_type == "*" || priority_sub_type == "*" || sub_type_equals) &&
(accept_plus == "*" || priority_plus == '*' || plus_equals) &&
intersection.size == accept.parameters.size
)
if (accept_sub_type == "*" || priority_sub_type == "*" || sub_type_equals) &&
(accept_plus == "*" || priority_plus == '*' || plus_equals) &&
intersection.size == accept.parameters.size
score = 100 * (type_equals ? 1 : 0) + 10 * (sub_type_equals ? 1 : 0) + (plus_equals ? 1 : 0) + intersection.size
return ANG::AcceptMatch.new accept.quality * priority.quality, score, index
end