diff --git a/.rubocop.yml b/.rubocop.yml index 049b22d..ff07d58 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,4 +20,10 @@ Metrics/ModuleLength: RSpec/MultipleMemoizedHelpers: Enabled: false Style/Documentation: + Enabled: false +Metrics/MethodLength: + Max: 20 +Rails/SkipsModelValidations: + Enabled: false +Metrics/AbcSize: Enabled: false \ No newline at end of file diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 351b324..77010bd 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -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:) diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index e20de97..3e15551 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class AffinityGroupsHierarchy < Array diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index 8684e9f..cfd8028 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -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", - body: { - input_type: "text", - level: :hard, - media: 'image/png', - size: '350x100' - }.to_json - ).then { |raw| JSON.parse(raw)['id'] } + def id + HTTParty.post('http://libre-captcha:8888/v2/captcha', + body: { + input_type: 'text', + level: :hard, + media: 'image/png', + size: '350x100' + }.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 \ No newline at end of file +end diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index c4ef54a..df5eeb4 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -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 diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 9236007..8c8d152 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require_relative '../../extensions/tree_node_extension' diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index 6ae7c94..f3882cc 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index ae74294..e2f7b60 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 2c50435..7bec30f 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index ee50d45..555f7c7 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module VNS