Cleanup ameba warnings (#551)
This commit is contained in:
parent
740cb188a9
commit
c893172fbf
5 changed files with 7 additions and 36 deletions
31
.ameba.yml
31
.ameba.yml
|
@ -1,5 +1,5 @@
|
||||||
# This configuration file was generated by `ameba --gen-config`
|
# This configuration file was generated by `ameba --gen-config`
|
||||||
# on 2019-06-14 15:05:57 UTC using Ameba version 0.10.0.
|
# on 2019-08-25 09:29:24 UTC using Ameba version 0.10.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the reported problems are removed from the code base.
|
# one by one as the reported problems are removed from the code base.
|
||||||
|
|
||||||
|
@ -11,32 +11,3 @@ Lint/UselessAssign:
|
||||||
Severity: Warning
|
Severity: Warning
|
||||||
Excluded:
|
Excluded:
|
||||||
- spec/view_spec.cr
|
- 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:
|
|
||||||
Description: Disallows methods with a cyclomatic complexity higher than `MaxComplexity`
|
|
||||||
MaxComplexity: 10
|
|
||||||
Enabled: true
|
|
||||||
Severity: Convention
|
|
||||||
Excluded:
|
|
||||||
- src/kemal/static_file_handler.cr
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ describe "Macros" do
|
||||||
halt env, status_code: 400, response: "Missing origin."
|
halt env, status_code: 400, response: "Missing origin."
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/" do |env|
|
get "/" do |_env|
|
||||||
"Hello world"
|
"Hello world"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,10 @@ private def run(code)
|
||||||
#{code}
|
#{code}
|
||||||
CR
|
CR
|
||||||
String.build do |stdout|
|
String.build do |stdout|
|
||||||
stderr = String.build do |stderr|
|
stderr = String.build do |io|
|
||||||
Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: stderr).wait
|
Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: io).wait
|
||||||
end
|
|
||||||
unless stderr.empty?
|
|
||||||
fail(stderr)
|
|
||||||
end
|
end
|
||||||
|
fail(stderr) unless stderr.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class HTTP::Server::Response
|
class HTTP::Server::Response
|
||||||
class Output
|
class Output
|
||||||
def close
|
def close
|
||||||
|
# ameba:disable Style/NegatedConditionsInUnless
|
||||||
unless response.wrote_headers? && !response.headers.has_key?("Content-Range")
|
unless response.wrote_headers? && !response.headers.has_key?("Content-Range")
|
||||||
response.content_length = @out_count
|
response.content_length = @out_count
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
module Kemal
|
module Kemal
|
||||||
class StaticFileHandler < HTTP::StaticFileHandler
|
class StaticFileHandler < HTTP::StaticFileHandler
|
||||||
|
# ameba:disable Metrics/CyclomaticComplexity
|
||||||
def call(context : HTTP::Server::Context)
|
def call(context : HTTP::Server::Context)
|
||||||
return call_next(context) if context.request.path.not_nil! == "/"
|
return call_next(context) if context.request.path.not_nil! == "/"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue