Showing 8 of 27 total issues
Method scrape
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.scrape
begin
total_courts = 0
data =
JSON.parse(
Class CourtMapper
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class CourtMapper
def initialize(data)
@data = data.deep_symbolize_keys
end
Function exports
has 78 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');
Method parse
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(html)
document = Nokogiri::HTML(html)
detail = document.css('.detail .right .inner > .content')
contact = detail.at_css('.contact-address')
information_center = detail.at_css('.informacne-centrum')
Method external_url
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def external_url
if object.year && object.number
url = "http://www.zakonypreludi.sk/zz/#{object.year}-#{object.number}#"
url << 'p' << object.paragraph if object.paragraph
url << '-' << object.section if object.section
- 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 reconcile_judges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reconcile_judges
judgements =
mapper.judges.map do |name|
judge = JudgeFinder.find_by(name: 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 reconcile_judges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reconcile_judges
reconciler = ->(name, chair:) do
judge = JudgeFinder.find_by(name: name)
if judge
- 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 formattable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def formattable(attribute, options = {})
define_method attribute do |pattern = nil|
value = read_attribute(attribute)
return value if !value.nil? && (pattern.nil? || pattern == options[:default])
- 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"