comfy/comfortable-mexican-sofa

View on GitHub

Showing 135 of 135 total issues

File page_test.rb has 527 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "../test_helper"

class CmsPageTest < ActiveSupport::TestCase

  setup do
Severity: Major
Found in test/models/page_test.rb - About 1 day to fix

    File pages_controller_test.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative "../../../../test_helper"
    
    class Comfy::Admin::Cms::PagesControllerTest < ActionDispatch::IntegrationTest
    
      def setup
    Severity: Minor
    Found in test/controllers/comfy/admin/cms/pages_controller_test.rb - About 6 hrs to fix

      Class CmsPageTest has 45 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class CmsPageTest < ActiveSupport::TestCase
      
        setup do
          @site   = comfy_cms_sites(:default)
          @layout = comfy_cms_layouts(:default)
      Severity: Minor
      Found in test/models/page_test.rb - About 6 hrs to fix

        Class PagesControllerTest has 37 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Comfy::Admin::Cms::PagesControllerTest < ActionDispatch::IntegrationTest
        
          def setup
            @site   = comfy_cms_sites(:default)
            @layout = comfy_cms_layouts(:default)
        Severity: Minor
        Found in test/controllers/comfy/admin/cms/pages_controller_test.rb - About 4 hrs to fix

          Class ContentRendererTest has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ContentRendererTest < ActiveSupport::TestCase
          
            class TestTag < ComfortableMexicanSofa::Content::Tag
          
              def content
          Severity: Minor
          Found in test/lib/content/renderer_test.rb - About 2 hrs to fix

            File form_builder_test.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require_relative "../test_helper"
            
            class FormBuilderTest < ActionView::TestCase
            
              setup do
            Severity: Minor
            Found in test/lib/form_builder_test.rb - About 2 hrs to fix

              Method test_export has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def test_export
                  ActiveStorage::Blob.any_instance.stubs(:download).returns(
                    file_fixture("image.jpg").read
                  )
              
              
              Severity: Major
              Found in test/lib/seeds/pages_test.rb - About 2 hrs to fix

                Method test_creation has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def test_creation
                    Comfy::Cms::Page.delete_all
                
                    assert_difference -> { Comfy::Cms::Page.count }, 3 do
                      assert_difference -> { Comfy::Cms::Translation.count }, 2 do
                Severity: Major
                Found in test/lib/seeds/pages_test.rb - About 2 hrs to fix

                  Class ContentControllerTest has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Comfy::Cms::ContentControllerTest < ActionDispatch::IntegrationTest
                  
                    setup do
                      @site         = comfy_cms_sites(:default)
                      @layout       = comfy_cms_layouts(:default)
                  Severity: Minor
                  Found in test/controllers/comfy/cms/content_controller_test.rb - About 2 hrs to fix

                    Class ContentParamsParserTest has 22 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ContentParamsParserTest < ActiveSupport::TestCase
                    
                      PARSER = ComfortableMexicanSofa::Content::ParamsParser
                    
                      def test_tokenizer
                    Severity: Minor
                    Found in test/lib/content/params_parser_test.rb - About 2 hrs to fix

                      Class RenderCmsIntergrationTest has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class RenderCmsIntergrationTest < ActionDispatch::IntegrationTest
                      
                        def setup
                          super
                          Rails.application.routes.draw do
                      Severity: Minor
                      Found in test/integration/render_cms_test.rb - About 2 hrs to fix

                        Class FilesControllerTest has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Comfy::Admin::Cms::FilesControllerTest < ActionDispatch::IntegrationTest
                        
                          def setup
                            @site = comfy_cms_sites(:default)
                            @file = comfy_cms_files(:default)
                        Severity: Minor
                        Found in test/controllers/comfy/admin/cms/files_controller_test.rb - About 2 hrs to fix

                          Method test_export has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def test_export
                              host_path = File.join(ComfortableMexicanSofa.config.seeds_path, "test-site")
                          
                              layout_1_content_path = File.join(host_path, "layouts/default/content.html")
                              layout_2_content_path = File.join(host_path, "layouts/nested/content.html")
                          Severity: Major
                          Found in test/lib/seeds/layouts_test.rb - About 2 hrs to fix

                            Method test_fragments_attributes has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def test_fragments_attributes
                                assert_equal @page.fragments.count, @page.fragments_attributes.size
                            
                                @page.fragments_attributes = [
                                  { identifier: "content",
                            Severity: Minor
                            Found in test/models/page_test.rb - About 2 hrs to fix

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

                                def initialize
                                  @cms_title              = "ComfortableMexicanSofa CMS Engine"
                                  @admin_base_controller  = "ApplicationController"
                                  @public_base_controller = "ApplicationController"
                                  @admin_auth             = "ComfortableMexicanSofa::AccessControl::AdminAuthentication"
                              Severity: Minor
                              Found in lib/comfortable_mexican_sofa/configuration.rb - About 1 hr to fix

                                Method test_admin_authorization_custom has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def test_admin_authorization_custom
                                    site = comfy_cms_sites(:default)
                                    with_routing do |routes|
                                      routes.draw do
                                        s   = "/admin/sites"
                                Severity: Minor
                                Found in test/integration/access_control_test.rb - About 1 hr to fix

                                  Method render has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def render(options = {}, locals = {}, &block)
                                      return super unless options.is_a?(Hash)
                                  
                                      if (site_identifier = options.delete(:cms_site))
                                        unless (@cms_site = Comfy::Cms::Site.find_by_identifier(site_identifier))
                                  Severity: Minor
                                  Found in lib/comfortable_mexican_sofa/render_methods.rb - About 1 hr 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 tokenize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def tokenize(args_string)
                                      args_string = args_string.tr("“”‘’", %q(""''))
                                      ss = StringScanner.new(args_string)
                                      tokens = []
                                      loop do
                                  Severity: Minor
                                  Found in lib/comfortable_mexican_sofa/content/params_parser.rb - About 1 hr 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 nodes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def nodes(tokens)
                                      nodes = [[]]
                                      tokens.each do |token|
                                        case token
                                  
                                  
                                  Severity: Minor
                                  Found in lib/comfortable_mexican_sofa/content/renderer.rb - About 1 hr 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 import! has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def import!
                                        Dir["#{path}[^_]*"].each do |file_path|
                                          filename = ::File.basename(file_path)
                                  
                                          file = site.files.with_attached_attachment
                                  Severity: Minor
                                  Found in lib/comfortable_mexican_sofa/seeds/file/importer.rb - About 1 hr 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