Odania-IT/odania-core

View on GitHub

Showing 7 of 7 total issues

Method page has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def page
        req_host = params[:req_host]
        req_url = params[:req_url]
        subdomain_config = Odania.plugin.get_subdomain_config(req_host)

Severity: Major
Found in app/controllers/template_controller.rb - About 2 hrs to fix

    Method page has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def page
            req_host = params[:req_host]
            req_url = params[:req_url]
            subdomain_config = Odania.plugin.get_subdomain_config(req_host)
    
    
    Severity: Minor
    Found in app/controllers/template_controller.rb - About 2 hrs 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 content has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def content
            req_host = params[:req_host]
            req_url = params[:req_url]
            locale = params[:locale]
            subdomain_config = Odania.plugin.get_subdomain_config(req_host)
    Severity: Minor
    Found in app/controllers/template_controller.rb - About 1 hr to fix

      Method initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize
              index_content = {
                  cacheable: {type: 'boolean'},
                  content: {type: 'string', index: 'not_analyzed'},
                  domain: {type: 'string', index: 'not_analyzed'},
      Severity: Minor
      Found in lib/elasticsearch_indices.rb - About 1 hr to fix

        Method build_domain_query has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def build_domain_query(domain, req_host)
                {
                    bool: {
                        should: [
                            {
        Severity: Minor
        Found in app/controllers/concerns/entry_concern.rb - About 1 hr to fix

          Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def initialize(template, subdomain_config, domain_query, data={}, extra_partials={})
          Severity: Minor
          Found in lib/erb.rb - About 35 mins to fix

            Method render_direct_page has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def render_direct_page(type, req_host, path, subdomain_config, data)
            Severity: Minor
            Found in app/controllers/template_controller.rb - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language