Showing 40 of 372 total issues
File mb_form_builder.rb
has 548 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class MbFormBuilder < ActionView::Helpers::FormBuilder
include ActionView::Helpers::DateHelper
def mb_input_field(
method,
File assistance_application_form.rb
has 445 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class AssistanceApplicationForm
include Integrated::PdfAttributes
def initialize(benefit_application)
@benefit_application = benefit_application
Method attributes
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def attributes
[
{
applying_for_food_assistance: "Yes",
email: snap_application.email,
Class SnapApplicationAttributes
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class SnapApplicationAttributes
include PdfAttributes
def initialize(snap_application:)
@snap_application = snap_application
Class MbFormBuilder
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class MbFormBuilder < ActionView::Helpers::FormBuilder
include ActionView::Helpers::DateHelper
def mb_input_field(
method,
Class AssistanceApplicationForm
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class AssistanceApplicationForm
include Integrated::PdfAttributes
def initialize(benefit_application)
@benefit_application = benefit_application
Class Dhs1171Pdf
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Dhs1171Pdf
PDF_DIRECTORY = "app/lib/pdfs".freeze
SOURCE_PDF = "#{PDF_DIRECTORY}/DHS_1171.pdf".freeze
COVERSHEET_PDF = "#{PDF_DIRECTORY}/DHS_1171_cover_letter.pdf".freeze
MAXIMUM_HOUSEHOLD_MEMBERS = 6
Class Member
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Member < ApplicationRecord
include SocialSecurityNumber
PAYMENT_INTERVALS = [
"Hourly",
Class StepsController
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class StepsController < ApplicationController
layout "step"
before_action :ensure_application_present, only: %i(edit index update)
before_action :maybe_skip, only: :edit
Method to_h
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_h
member_attributes = {
:"#{position}_member_full_name" => member.display_name,
:"#{position}_member_sex_male" => bool_to_checkbox(member.male?),
:"#{position}_member_sex_female" => bool_to_checkbox(member.female?),
Method applicant_registration_attributes
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def applicant_registration_attributes
{
applying_for_food: yes_if_true(benefit_application.primary_member.requesting_food_yes?),
applying_for_healthcare: yes_if_true(benefit_application.primary_member.requesting_healthcare_yes?),
legal_name: benefit_application.display_name,
Class Dhs1426Pdf
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Dhs1426Pdf
PDF_DIRECTORY = "app/lib/pdfs".freeze
SOURCE_PDF = "#{PDF_DIRECTORY}/DHS_1426.pdf".freeze
COVERSHEET_PDF = "#{PDF_DIRECTORY}/DHS_1426_cover_letter.pdf".freeze
STEP_2_ADDITIONAL_MEMBER_PDF =
File snap_application_attributes.rb
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class SnapApplicationAttributes
include PdfAttributes
def initialize(snap_application:)
@snap_application = snap_application
Class FormsController
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class FormsController < ApplicationController
layout "form"
before_action :ensure_application_present, only: %i[edit update]
Method attributes
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def attributes
[
{
signature: medicaid_application.signature,
signature_date: mmddyyyy_date(medicaid_application.signed_at),
Method add_additional_members_employed
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def add_additional_members_employed
jobs = benefit_application.members.map(&:employments).flatten
if jobs.count > 2
@_additional_notes[:household_added_notes] = "Yes"
@_additional_notes[:notes] += "Additional Jobs:\n"
- 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
Function uploadSetup
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var uploadSetup = function (previewTemplate) {
new Shubox('#uploadables-drop', {
previewsContainer: '.form-card__uploadables',
clickable: '#click-to-upload',
previewTemplate: previewTemplate,
Method execute_callstack_for_multiparameter_attributes
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def execute_callstack_for_multiparameter_attributes(callstack)
# Disabling Rubcop below because Brakeman is failing to parse the
# when we remove the 'begin' keyword
# rubocop:disable Style/RedundantBegin
errors = []
Method mb_checkbox_set_with_none
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def mb_checkbox_set_with_none(
method,
collection,
label_text: nil,
value_is_array: false,
Method index
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def index
snap_apps = SnapApplication.signed
medicaid_apps = MedicaidApplication.signed
common_apps = CommonApplication.signed