Method download_and_save
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def self.download_and_save record_number, record_type = 'C'
case record_type
when 'C'
files_dir = Fec::Filing::FILES_DIR
filing = Fech::Filing.new(record_number, Fec::Filing::FECH_OPTIONS.merge(download_dir: files_dir))
- Read upRead up
- Create a ticket
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 update_database
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def self.update_database record_type = 'C'
if record_type == 'C'
record_number = Fec::Filing::Hdr.maximum(:fec_record_number) || Fech::Filing::FIRST_V3_FILING
record_number -= 4
files_dir = Fec::Filing::FILES_DIR
- Read upRead up
- Create a ticket
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 fix_errors
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def self.fix_errors record_type = 'C', recs = []
if record_type == 'C'
files_dir = FILES_DIR
elsif record_type == 'S'
files_dir = SENATE_FILES_DIR
- Read upRead up
- Create a ticket
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 download_and_save
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.download_and_save record_number, record_type = 'C'
case record_type
when 'C'
files_dir = Fec::Filing::FILES_DIR
filing = Fech::Filing.new(record_number, Fec::Filing::FECH_OPTIONS.merge(download_dir: files_dir))
- Create a ticket
Method fix_errors
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.fix_errors record_type = 'C', recs = []
if record_type == 'C'
files_dir = FILES_DIR
elsif record_type == 'S'
files_dir = SENATE_FILES_DIR
- Create a ticket
Method update_database
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.update_database record_type = 'C'
if record_type == 'C'
record_number = Fec::Filing::Hdr.maximum(:fec_record_number) || Fech::Filing::FIRST_V3_FILING
record_number -= 4
files_dir = Fec::Filing::FILES_DIR
- Create a ticket