Run Rubocop autocorrect on app/services

This commit is contained in:
Manuel Bustillo 2024-12-28 18:19:58 +01:00
parent fbc6926402
commit 02fcd03b0e
10 changed files with 37 additions and 14 deletions

View File

@ -21,3 +21,9 @@ RSpec/MultipleMemoizedHelpers:
Enabled: false
Style/Documentation:
Enabled: false
Metrics/MethodLength:
Max: 20
Rails/SkipsModelValidations:
Enabled: false
Metrics/AbcSize:
Enabled: false

View File

@ -1,10 +1,12 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
class CaptchaController < ApplicationController
skip_before_action :authenticate_user!
skip_before_action :set_tenant
def create
id = LibreCaptcha.new.get_id
id = LibreCaptcha.new.id
render json: {
id:,
media_url: media_captcha_index_url(id:)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
class AffinityGroupsHierarchy < Array

View File

@ -1,20 +1,20 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
class LibreCaptcha
def get_id
HTTParty.post("http://libre-captcha:8888/v2/captcha",
def id
HTTParty.post('http://libre-captcha:8888/v2/captcha',
body: {
input_type: "text",
input_type: 'text',
level: :hard,
media: 'image/png',
size: '350x100'
}.to_json
).then { |raw| JSON.parse(raw)['id'] }
}.to_json).then { |raw| JSON.parse(raw)['id'] }
end
def valid?(id:, answer:)
HTTParty.post("http://libre-captcha:8888/v2/answer",
body: { id:, answer: }.to_json
).then { |raw| JSON.parse(raw)['result'] == 'True' }
HTTParty.post('http://libre-captcha:8888/v2/answer',
body: { id:, answer: }.to_json).then { |raw| JSON.parse(raw)['result'] == 'True' }
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
module Tables
@ -7,6 +9,7 @@ module Tables
distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b)
return 1 if distance.nil?
Rational(distance, distance + 1)
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
require_relative '../../extensions/tree_node_extension'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
module Tables

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
module Tables

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
module Tables

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo
module VNS