File nces_parser.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
class NcesParser
def initialize(district_layout_file, school_layout_file, year, states_and_provinces=nil)
## @year_str gets inserted to the db table names
@year_str = year.to_s[-2..-1]
Method _get_school_layout
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def _get_school_layout(layout_file)
columns = []
File.open(layout_file, "r:iso-8859-1") do |file|
count = 0
line = ''
- 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 _get_district_layout
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def _get_district_layout(layout_file)
columns = []
File.open(layout_file, "r:iso-8859-1") do |file|
count = 0
line = ''
- 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 _parse_file_using_import
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _parse_file_using_import(file, layout, model)
attributes = {}
count = 0
value_sets = []
column_names = model.columns.map{ |column| column.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 _parse_file_using_import
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _parse_file_using_import(file, layout, model)
attributes = {}
count = 0
value_sets = []
column_names = model.columns.map{ |column| column.name }
Method load_db
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_db(district_data_files, school_data_files)
## Delete all the entries first
## Use the TRUNCATE cammand -- works in mysql to effectively empty the database and reset
## the autogenerating primary key index ... not certain about other databases
if @states_and_provinces && @states_and_provinces.empty?
Method _get_school_layout
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _get_school_layout(layout_file)
columns = []
File.open(layout_file, "r:iso-8859-1") do |file|
count = 0
line = ''
Method _get_district_layout
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _get_district_layout(layout_file)
columns = []
File.open(layout_file, "r:iso-8859-1") do |file|
count = 0
line = ''
Method load_db
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_db(district_data_files, school_data_files)
## Delete all the entries first
## Use the TRUNCATE cammand -- works in mysql to effectively empty the database and reset
## the autogenerating primary key index ... not certain about other databases
if @states_and_provinces && @states_and_provinces.empty?
- 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"