otvorenesudy/otvorenesudy-api

View on GitHub

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(
Severity: Major
Found in lib/justice_gov_sk_pages.rb - About 5 hrs to fix

    Class CourtMapper has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class CourtMapper
        def initialize(data)
          @data = data.deep_symbolize_keys
        end
    
    
    Severity: Minor
    Found in app/mappers/info_sud/court_mapper.rb - About 3 hrs to fix

      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');
      Severity: Major
      Found in babel.config.js - About 3 hrs to fix

        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')
        Severity: Minor
        Found in lib/obcan_justice_sk/courts/resource_parser.rb - About 1 hr to fix

          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
          Severity: Minor
          Found in app/serializers/legislation_serializer.rb - About 55 mins to fix

          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)
          
          
          Severity: Minor
          Found in app/reconcilers/decree_reconciler.rb - About 25 mins to fix

          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
          Severity: Minor
          Found in app/reconcilers/hearing_reconciler.rb - About 25 mins to fix

          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])
          Severity: Minor
          Found in app/models/concerns/formattable.rb - About 25 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language