rubocop-autocorrect #202

Merged
bustikiller merged 19 commits from rubocop-autocorrect into main 2024-12-28 18:26:28 +00:00
10 changed files with 37 additions and 14 deletions
Showing only changes of commit 02fcd03b0e - Show all commits

View File

@ -20,4 +20,10 @@ Metrics/ModuleLength:
RSpec/MultipleMemoizedHelpers: RSpec/MultipleMemoizedHelpers:
Enabled: false Enabled: false
Style/Documentation: Style/Documentation:
Enabled: false
Metrics/MethodLength:
Max: 20
Rails/SkipsModelValidations:
Enabled: false
Metrics/AbcSize:
Enabled: false Enabled: false

View File

@ -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:)

View File

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

View File

@ -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

View File

@ -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

View File

@ -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'

View File

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

View File

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

View File

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

View File

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