mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
bump ameba to 1.4.0 and fix warnings (#654)
This commit is contained in:
parent
19661893ca
commit
6a10ea8127
6 changed files with 22 additions and 11 deletions
19
.ameba.yml
19
.ameba.yml
|
@ -1,13 +1,24 @@
|
|||
# This configuration file was generated by `ameba --gen-config`
|
||||
# on 2019-08-25 09:29:24 UTC using Ameba version 0.10.0.
|
||||
# on 2023-01-30 12:35:15 UTC using Ameba version 1.4.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: 7
|
||||
# Problems found: 2
|
||||
# Run `ameba --only Lint/UselessAssign` for details
|
||||
Lint/UselessAssign:
|
||||
Description: Disallows useless variable assignments
|
||||
Enabled: true
|
||||
Severity: Warning
|
||||
Excluded:
|
||||
- spec/view_spec.cr
|
||||
Enabled: true
|
||||
Severity: Warning
|
||||
|
||||
# Problems found: 6
|
||||
# Run `ameba --only Lint/NotNil` for details
|
||||
Lint/NotNil:
|
||||
Description: Identifies usage of `not_nil!` calls
|
||||
Excluded:
|
||||
- src/kemal/param_parser.cr
|
||||
- src/kemal/static_file_handler.cr
|
||||
- src/kemal/config.cr
|
||||
Enabled: true
|
||||
Severity: Warning
|
||||
|
|
|
@ -15,7 +15,7 @@ dependencies:
|
|||
development_dependencies:
|
||||
ameba:
|
||||
github: crystal-ameba/ameba
|
||||
version: ~> 1.0
|
||||
version: ~> 1.4.0
|
||||
|
||||
crystal: ">= 0.36.0"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ describe "Config" do
|
|||
end
|
||||
|
||||
it "sets default powered_by_header to true" do
|
||||
Kemal::Config.new.powered_by_header.should be_true
|
||||
Kemal::Config.new.powered_by_header?.should be_true
|
||||
end
|
||||
|
||||
it "sets host binding" do
|
||||
|
|
|
@ -27,7 +27,7 @@ module Kemal
|
|||
#
|
||||
# To use custom command line arguments, set args to nil
|
||||
#
|
||||
def self.run(port : Int32? = nil, args = ARGV, trap_signal : Bool = true, &block)
|
||||
def self.run(port : Int32? = nil, args = ARGV, trap_signal : Bool = true, &)
|
||||
Kemal::CLI.new args
|
||||
config = Kemal.config
|
||||
config.setup
|
||||
|
|
|
@ -20,11 +20,11 @@ module Kemal
|
|||
@ssl : OpenSSL::SSL::Context::Server?
|
||||
{% end %}
|
||||
|
||||
property host_binding, ssl, port, env, public_folder, logging, running
|
||||
property app_name, host_binding, ssl, port, env, public_folder, logging, running
|
||||
property always_rescue, server : HTTP::Server?, extra_options, shutdown_message
|
||||
property serve_static : (Bool | Hash(String, Bool))
|
||||
property static_headers : (HTTP::Server::Response, String, File::Info -> Void)?
|
||||
property powered_by_header : Bool = true, app_name
|
||||
property? powered_by_header : Bool = true
|
||||
|
||||
def initialize
|
||||
@app_name = "Kemal"
|
||||
|
@ -159,7 +159,7 @@ module Kemal
|
|||
end
|
||||
end
|
||||
|
||||
def self.config
|
||||
def self.config(&)
|
||||
yield Config::INSTANCE
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module Kemal
|
|||
INSTANCE = new
|
||||
|
||||
def call(context : HTTP::Server::Context)
|
||||
context.response.headers.add "X-Powered-By", "Kemal" if Kemal.config.powered_by_header
|
||||
context.response.headers.add "X-Powered-By", "Kemal" if Kemal.config.powered_by_header?
|
||||
context.response.content_type = "text/html" unless context.response.headers.has_key?("Content-Type")
|
||||
call_next context
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue