melvinsembrano/cms-fortress

View on GitHub
lib/comfortable_mexican_sofa/fixture/page.rb

Summary

Maintainability
C
1 day
Test Coverage

Method import! has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def import!(path = self.path, parent = nil)
      Dir["#{path}*/"].each do |path|
        slug = path.split('/').last
        
        page = if parent
Severity: Minor
Found in lib/comfortable_mexican_sofa/fixture/page.rb - About 7 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 import! has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def import!(path = self.path, parent = nil)
      Dir["#{path}*/"].each do |path|
        slug = path.split('/').last
        
        page = if parent
Severity: Major
Found in lib/comfortable_mexican_sofa/fixture/page.rb - About 2 hrs to fix

    Method export! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def export!
          prepare_folder!(self.path)
          
          self.site.pages.each do |page|
            page.slug = 'index' if page.slug.blank?
    Severity: Minor
    Found in lib/comfortable_mexican_sofa/fixture/page.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 export! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def export!
          prepare_folder!(self.path)
          
          self.site.pages.each do |page|
            page.slug = 'index' if page.slug.blank?
    Severity: Minor
    Found in lib/comfortable_mexican_sofa/fixture/page.rb - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status