From e3544a86bf002f75d2b341c5343e9ebdbf839f80 Mon Sep 17 00:00:00 2001 From: Anton Maminov Date: Tue, 18 Jun 2019 18:03:32 +0300 Subject: [PATCH] Do not early return from HTTP::Server::Response::Output.close. Revert what Ameba broke --- .ameba.yml | 31 ++++++++++++++++++++----------- src/kemal/ext/response.cr | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.ameba.yml b/.ameba.yml index bf117f0..cf5dbb2 100644 --- a/.ameba.yml +++ b/.ameba.yml @@ -1,18 +1,8 @@ # This configuration file was generated by `ameba --gen-config` -# on 2019-06-13 12:39:59 UTC using Ameba version 0.10.0. +# on 2019-06-14 15:05:57 UTC using Ameba version 0.10.0. # The point is for the user to remove these configuration records # one by one as the reported problems are removed from the code base. -# Problems found: 1 -# Run `ameba --only Lint/ShadowingOuterLocalVar` for details -Lint/ShadowingOuterLocalVar: - Description: Disallows the usage of the same name as outer local variables for block - or proc arguments. - Enabled: true - Severity: Warning - Excluded: - - spec/run_spec.cr - # Problems found: 7 # Run `ameba --only Lint/UselessAssign` for details Lint/UselessAssign: @@ -22,6 +12,25 @@ Lint/UselessAssign: Excluded: - spec/view_spec.cr +# Problems found: 1 +# Run `ameba --only Lint/ShadowingOuterLocalVar` for details +Lint/ShadowingOuterLocalVar: + Description: Disallows the usage of the same name as outer local variables for block + or proc arguments. + Enabled: true + Severity: Warning + Excluded: + - spec/run_spec.cr + +# Problems found: 1 +# Run `ameba --only Style/NegatedConditionsInUnless` for details +Style/NegatedConditionsInUnless: + Description: Disallows negated conditions in unless + Enabled: true + Severity: Convention + Excluded: + - src/kemal/ext/response.cr + # Problems found: 1 # Run `ameba --only Metrics/CyclomaticComplexity` for details Metrics/CyclomaticComplexity: diff --git a/src/kemal/ext/response.cr b/src/kemal/ext/response.cr index 233bdee..1f0a8fd 100644 --- a/src/kemal/ext/response.cr +++ b/src/kemal/ext/response.cr @@ -1,7 +1,7 @@ class HTTP::Server::Response class Output def close - if !response.wrote_headers? && response.headers.has_key?("Content-Range") + unless response.wrote_headers? && !response.headers.has_key?("Content-Range") response.content_length = @out_count end