Showing 53 of 82 total issues
File fuzs_form_builder.rb
has 1381 lines of code (exceeds 250 allowed). Consider refactoring. Open
class UpvsSubmissions::FormBuilders::FuzsFormBuilder
class << self
delegate :uuid, to: SecureRandom
end
Class ApplicationForm
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationForm
VOTE_DATE = Date.parse(ENV.fetch('APP_PARLIAMENT_VOTE_DATE', '2023-09-30'))
DELIVERY_BY_POST_DEADLINE_DATE = Date.parse(ENV.fetch('APP_PARLIAMENT_DELIVERY_BY_POST_DEADLINE_DATE', '2023-09-08'))
PICKUP_DEADLINE_DATE = Date.parse(ENV.fetch('APP_PARLIAMENT_PICKUP_DEADLINE_DATE', '2023-09-29'))
VOTE_BY_POST_DEADLINE_DATE = Date.parse(ENV.fetch('APP_PARLIAMENT_VOTE_BY_POST_DEADLINE_DATE', '2023-08-09'))
File fuzs_data.rb
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
module UpvsSubmissions
module Forms
class FuzsData
include ActiveModel::Model
Class ApplicationForm
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationForm
VOTE_DATE = Date.parse(ENV.fetch('EP_VOTE_DATE', '2024-06-08'))
REQUEST_SENDING_DEADLINE = VOTE_DATE - 19.days
include ActiveModel::Model
File application_form.rb
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Apps
module PresidentVoteApp
class ApplicationForm
FIRST_ROUND_DATE = Date.parse('2024-03-23')
FIRST_ROUND_REQUEST_SENDING_DEADLINE = FIRST_ROUND_DATE - 19.day
File application_form.rb
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Apps
module ParliamentVoteApp
class ApplicationForm
VOTE_DATE = Date.parse(ENV.fetch('APP_PARLIAMENT_VOTE_DATE', '2023-09-30'))
DELIVERY_BY_POST_DEADLINE_DATE = Date.parse(ENV.fetch('APP_PARLIAMENT_DELIVERY_BY_POST_DEADLINE_DATE', '2023-09-08'))
File application_form.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Apps
module EpVoteApp
class ApplicationForm
VOTE_DATE = Date.parse(ENV.fetch('EP_VOTE_DATE', '2024-06-08'))
REQUEST_SENDING_DEADLINE = VOTE_DATE - 19.days
Class ApplicationForm
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationForm
FIRST_ROUND_DATE = Date.parse('2024-03-23')
FIRST_ROUND_REQUEST_SENDING_DEADLINE = FIRST_ROUND_DATE - 19.day
SECOND_ROUND_REQUEST_SENDING_DEADLINE = FIRST_ROUND_DATE - 9.day
Function exports
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Class Stakeholder
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Stakeholder
include ActiveModel::Model
attr_accessor(
:full_name, :cin, :foreign, :identifier, :other_identifier, :other_identifier_type,
Class ApplicationForm
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationForm
include ActiveModel::Model
attr_accessor(:cin, :corporate_body, :form_data, :company_municipality,
:stakeholder, :stakeholder_nationality, :stakeholder_identifier, :stakeholder_other_identifier, :stakeholder_identifier_type,
Class StakeholdersIdentifiersController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Apps::OrSrApp::StakeholdersIdentifiersController < ApplicationController
before_action :load_application_form, only: [:stakeholder_identifier, :xml_form, :generate_xml_form]
before_action :set_metadata, only: [:subject_selection]
rescue_from OrSrRecordFetcher::OrsrRecordError, UpvsSubmissions::Forms::FuzsData::FuzsError, StandardError, :with => :handle_error
Method stakeholder_identifier
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def stakeholder_identifier
(render action: :subject_selection and return) if @application_form.corporate_body_invalid?
if currently_showing_company_address?
update_company_address
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method place_step
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private def place_step(listener)
if go_back?
self.step = 'permanent_resident'
listener.render :permanent_resident
elsif valid?(:place)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method build_form
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.build_form(form)
xml_form = Nokogiri::XML::Builder.new do |m|
m.ApplicationForDocumentCopy do
m.parent['xmlns:e'] = 'http://schemas.gov.sk/form/00166073.MSSR_ORSR_Poziadanie_o_vyhotovenie_kopie_listiny_ulozenej_v_zbierke_listin.sk/1.53'
m.parent['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance'
Method create
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create
if should_put_eid_token_in_session?
session[:eid_encoded_token] = eid_encoded_token_from_auth
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(cin: nil, name: nil, address: nil, court: nil, registration_number: nil, type: nil, stakeholders: nil)
corporate_body = get_datahub_corporate_body(cin) unless name
@cin = cin
@name = name || corporate_body['name']
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method next_step
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def next_step
redirect_to action: :unsupported and return unless @application_form.form_data&.sro?
redirect_to action: :nothing_missing and return if @application_form.form_data&.all_stakeholders_ok?
if @application_form.go_back?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(listener)
case step
when 'start'
start_step(listener)
when 'citizenship'
Method create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if should_put_eid_token_in_session?
session[:eid_encoded_token] = eid_encoded_token_from_auth
end