1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2024-07-24 15:02:19 +02:00

gem: fix solargraph warnings on CI

This commit is contained in:
cn 2020-08-14 17:59:53 +02:00
parent 093efc77ef
commit 5cce42f4c7
6 changed files with 26 additions and 25 deletions

View File

@ -21,4 +21,4 @@ end
task default: [:rubocop, :spec, 'bundle:audit']
task travis: [:default, :'solargraph:tc']
task travis: [:default, :'solargraph:init', :'solargraph:tc']

View File

@ -1,5 +1,6 @@
# frozen_string_literal: true
require 'date'
require 'etc'
require 'logger'
require 'ipaddr'
@ -80,7 +81,7 @@ module Dyndnsd
end
# @param env [Hash{String => String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def call(env)
return [422, {'X-DynDNS-Response' => 'method_forbidden'}, []] if env['REQUEST_METHOD'] != 'GET'
return [422, {'X-DynDNS-Response' => 'not_found'}, []] if env['PATH_INFO'] != '/nic/update'
@ -134,7 +135,7 @@ module Dyndnsd
private
# @param params [Hash{String => String}]
# @return [Array{String}]
# @return [Array<String>]
def extract_v4_and_v6_address(params)
return [] if !(params['myip'])
begin
@ -148,7 +149,7 @@ module Dyndnsd
# @param env [Hash{String => String}]
# @param params [Hash{String => String}]
# @return [Array{String}]
# @return [Array<String>]
def extract_myips(env, params)
# require presence of myip parameter as valid IPAddr (v4) and valid myip6
return extract_v4_and_v6_address(params) if params.key?('myip6')
@ -164,8 +165,8 @@ module Dyndnsd
end
# @param hostnames [String]
# @param myips [Array{String}]
# @return [Array{Symbol}]
# @param myips [Array<String>]
# @return [Array<Symbol>]
def process_changes(hostnames, myips)
changes = []
Helper.span('process_changes') do |span|
@ -200,7 +201,7 @@ module Dyndnsd
end
# @param env [Hash{String => String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def handle_dyndns_request(env)
params = Rack::Utils.parse_query(env['QUERY_STRING'])

View File

@ -9,7 +9,7 @@ module Dyndnsd
end
# @param env [Hash{String => String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def call(env)
@app.call(env).tap do |status_code, headers, body|
if headers.key?('X-DynDNS-Response')
@ -24,8 +24,8 @@ module Dyndnsd
# @param status_code [Integer]
# @param headers [Hash{String => String}]
# @param body [Array{String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @param body [Array<String>]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def decorate_dyndnsd_response(status_code, headers, body)
case status_code
when 200
@ -37,8 +37,8 @@ module Dyndnsd
# @param status_code [Integer]
# @param headers [Hash{String => String}]
# @param _body [Array{String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @param _body [Array<String>]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def decorate_other_response(status_code, headers, _body)
case status_code
when 400
@ -48,8 +48,8 @@ module Dyndnsd
end
end
# @param changes [Array{Symbol}]
# @param myips [Array{String}]
# @param changes [Array<Symbol>]
# @param myips [Array<String>]
# @return [String]
def get_success_body(changes, myips)
changes.map { |change| "#{change} #{myips.join(' ')}" }.join("\n")

View File

@ -9,7 +9,7 @@ module Dyndnsd
end
# @param env [Hash{String => String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def call(env)
@app.call(env).tap do |status_code, headers, body|
if headers.key?('X-DynDNS-Response')
@ -24,8 +24,8 @@ module Dyndnsd
# @param status_code [Integer]
# @param headers [Hash{String => String}]
# @param body [Array{String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @param body [Array<String>]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def decorate_dyndnsd_response(status_code, headers, body)
case status_code
when 200
@ -37,8 +37,8 @@ module Dyndnsd
# @param status_code [Integer]
# @param headers [Hash{String => String}]
# @param _body [Array{String}]
# @return [Array{Integer,Hash{String => String},Array{String}}]
# @param _body [Array<String>]
# @return [Array{Integer,Hash{String => String},Array<String>}]
def decorate_other_response(status_code, headers, _body)
case status_code
when 400
@ -48,8 +48,8 @@ module Dyndnsd
end
end
# @param changes [Array{Symbol}]
# @param myips [Array{String}]
# @param changes [Array<Symbol>]
# @param myips [Array<String>]
# @return [String]
def get_success_body(changes, myips)
changes.map { |change| change == :good ? "Changed to #{myips.join(' ')}" : "No change needed for #{myips.join(' ')}" }.join("\n")

View File

@ -94,8 +94,8 @@ module Dyndnsd
# @param file [String]
# @param base_name [String]
# @param metric [Object]
# @param keys [Array{Symbol}]
# @param snapshot_keys [Array{Symbol}]
# @param keys [Array<Symbol>]
# @param snapshot_keys [Array<Symbol>]
# @return [void]
def write_metric(file, base_name, metric, keys, snapshot_keys = [])
time = Time.now.to_i

View File

@ -85,7 +85,7 @@ module Dyndnsd
# converts into suitable parameter form for Async::DNS::Resolver or Async::DNS::Server
#
# @param endpoint_list [Array{String}]
# @param endpoint_list [Array<String>]
# @return [Array{Array{Object}}]
def self.parse_endpoints(endpoint_list)
endpoint_list.map { |addr_string| addr_string.split('@') }
@ -139,7 +139,7 @@ module Dyndnsd
# @param name [String]
# @param resource_class [Resolv::DNS::Resource]
# @param transaction [Async::DNS::Transaction]
# Since solargraph cannot parse this: param transaction [Async::DNS::Transaction]
# @return [void]
def process(name, resource_class, transaction)
if name != @domain || resource_class != Resolv::DNS::Resource::Generic::Type252_Class1