Do not early return from HTTP::Server::Response::Output.close. Revert what Ameba broke

This commit is contained in:
Anton Maminov 2019-06-18 18:03:32 +03:00 committed by Serdar Dogruyol
parent f3d02e60af
commit e3544a86bf
2 changed files with 21 additions and 12 deletions

View file

@ -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:

View file

@ -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