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
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
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)
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)
Class ContentRendererTest
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentRendererTest < ActiveSupport::TestCase
class TestTag < ComfortableMexicanSofa::Content::Tag
def content
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
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
)
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
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)
Class ContentParamsParserTest
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentParamsParserTest < ActiveSupport::TestCase
PARSER = ComfortableMexicanSofa::Content::ParamsParser
def test_tokenizer
Class RenderCmsIntergrationTest
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class RenderCmsIntergrationTest < ActionDispatch::IntegrationTest
def setup
super
Rails.application.routes.draw do
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)
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")
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",
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"
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"
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))
- 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 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
- 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 nodes
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def nodes(tokens)
nodes = [[]]
tokens.each do |token|
case token
- 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 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
- 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"