Run Rubocop autocorrect on app/services
This commit is contained in:
		
							parent
							
								
									fbc6926402
								
							
						
					
					
						commit
						02fcd03b0e
					
				| @ -21,3 +21,9 @@ RSpec/MultipleMemoizedHelpers: | |||||||
|   Enabled: false |   Enabled: false | ||||||
| Style/Documentation: | Style/Documentation: | ||||||
|   Enabled: false |   Enabled: false | ||||||
|  | Metrics/MethodLength: | ||||||
|  |   Max: 20 | ||||||
|  | Rails/SkipsModelValidations: | ||||||
|  |   Enabled: false | ||||||
|  | Metrics/AbcSize: | ||||||
|  |   Enabled: false | ||||||
| @ -1,10 +1,12 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| class CaptchaController < ApplicationController | class CaptchaController < ApplicationController | ||||||
|   skip_before_action :authenticate_user! |   skip_before_action :authenticate_user! | ||||||
|   skip_before_action :set_tenant |   skip_before_action :set_tenant | ||||||
|   def create |   def create | ||||||
|     id = LibreCaptcha.new.get_id |     id = LibreCaptcha.new.id | ||||||
|     render json: { |     render json: { | ||||||
|       id:, |       id:, | ||||||
|       media_url: media_captcha_index_url(id:) |       media_url: media_captcha_index_url(id:) | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| class AffinityGroupsHierarchy < Array | class AffinityGroupsHierarchy < Array | ||||||
|  | |||||||
| @ -1,20 +1,20 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| class LibreCaptcha | class LibreCaptcha | ||||||
|   def get_id |   def id | ||||||
|     HTTParty.post("http://libre-captcha:8888/v2/captcha",  |     HTTParty.post('http://libre-captcha:8888/v2/captcha', | ||||||
|                   body: { |                   body: { | ||||||
|         input_type: "text", |                     input_type: 'text', | ||||||
|                     level: :hard, |                     level: :hard, | ||||||
|                     media: 'image/png', |                     media: 'image/png', | ||||||
|                     size: '350x100' |                     size: '350x100' | ||||||
|       }.to_json |                   }.to_json).then { |raw| JSON.parse(raw)['id'] } | ||||||
|     ).then { |raw| JSON.parse(raw)['id'] } |  | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def valid?(id:, answer:) |   def valid?(id:, answer:) | ||||||
|     HTTParty.post("http://libre-captcha:8888/v2/answer", |     HTTParty.post('http://libre-captcha:8888/v2/answer', | ||||||
|       body: { id:, answer: }.to_json |                   body: { id:, answer: }.to_json).then { |raw| JSON.parse(raw)['result'] == 'True' } | ||||||
|     ).then { |raw| JSON.parse(raw)['result'] == 'True' } |  | ||||||
|   end |   end | ||||||
| end | end | ||||||
| @ -1,3 +1,5 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| module Tables | module Tables | ||||||
| @ -7,6 +9,7 @@ module Tables | |||||||
|         distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b) |         distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b) | ||||||
| 
 | 
 | ||||||
|         return 1 if distance.nil? |         return 1 if distance.nil? | ||||||
|  | 
 | ||||||
|         Rational(distance, distance + 1) |         Rational(distance, distance + 1) | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| require_relative '../../extensions/tree_node_extension' | require_relative '../../extensions/tree_node_extension' | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| module Tables | module Tables | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| module Tables | module Tables | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| module Tables | module Tables | ||||||
|  | |||||||
| @ -1,3 +1,5 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
| # Copyright (C) 2024 Manuel Bustillo | # Copyright (C) 2024 Manuel Bustillo | ||||||
| 
 | 
 | ||||||
| module VNS | module VNS | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user