88require_relative 'gitlab_lfs_authentication'
99require_relative 'httpunix'
1010
11- class GitlabNet
11+ class GitlabNet # rubocop:disable Metrics/ClassLength
1212 class ApiUnreachableError < StandardError ; end
1313 class NotFound < StandardError ; end
1414
1515 CHECK_TIMEOUT = 5
1616 READ_TIMEOUT = 300
1717
1818 def check_access ( cmd , gl_repository , repo , actor , changes , protocol , env : { } )
19- changes = changes . join ( "\n " ) unless changes . kind_of ?( String )
19+ changes = changes . join ( "\n " ) unless changes . is_a ?( String )
2020
2121 params = {
2222 action : cmd ,
@@ -73,7 +73,7 @@ def broadcast_message
7373 end
7474
7575 def merge_request_urls ( gl_repository , repo_path , changes )
76- changes = changes . join ( "\n " ) unless changes . kind_of ?( String )
76+ changes = changes . join ( "\n " ) unless changes . is_a ?( String )
7777 changes = changes . encode ( 'UTF-8' , 'ASCII' , invalid : :replace , replace : '' )
7878 url = "#{ host } /merge_request_urls?project=#{ URI . escape ( repo_path ) } &changes=#{ URI . escape ( changes ) } "
7979 url += "&gl_repository=#{ URI . escape ( gl_repository ) } " if gl_repository
@@ -152,7 +152,7 @@ def host
152152 "#{ config . gitlab_url } /api/v4/internal"
153153 end
154154
155- def http_client_for ( uri , options = { } )
155+ def http_client_for ( uri , options = { } )
156156 http = if uri . is_a? ( URI ::HTTPUNIX )
157157 Net ::HTTPUNIX . new ( uri . hostname )
158158 else
@@ -189,7 +189,7 @@ def http_request_for(method, uri, params = {})
189189 request
190190 end
191191
192- def request ( method , url , params = { } , options = { } )
192+ def request ( method , url , params = { } , options = { } )
193193 $logger. debug "Performing #{ method . to_s . upcase } #{ url } "
194194
195195 uri = URI . parse ( url )
@@ -205,7 +205,7 @@ def request(method, url, params = {}, options={})
205205 raise ApiUnreachableError
206206 ensure
207207 $logger. info do
208- sprintf ( '%s %s %0.5f' , method . to_s . upcase , url , Time . new - start_time )
208+ sprintf ( '%s %s %0.5f' , method . to_s . upcase , url , Time . new - start_time ) # rubocop:disable Style/FormatString
209209 end
210210 end
211211
@@ -218,7 +218,7 @@ def request(method, url, params = {}, options={})
218218 response
219219 end
220220
221- def get ( url , options = { } )
221+ def get ( url , options = { } )
222222 request ( :get , url , { } , options )
223223 end
224224
@@ -231,13 +231,11 @@ def cert_store
231231 store = OpenSSL ::X509 ::Store . new
232232 store . set_default_paths
233233
234- if ca_file = config . http_settings [ 'ca_file' ]
235- store . add_file ( ca_file )
236- end
234+ ca_file = config . http_settings [ 'ca_file' ]
235+ store . add_file ( ca_file ) if ca_file
237236
238- if ca_path = config . http_settings [ 'ca_path' ]
239- store . add_path ( ca_path )
240- end
237+ ca_path = config . http_settings [ 'ca_path' ]
238+ store . add_path ( ca_path ) if ca_path
241239
242240 store
243241 end
0 commit comments