Fullscreen/bh

View on GitHub

Showing 13 of 13 total issues

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

    class Base
      def initialize(app = nil, *args, &block)
        @app = app
        @concat = block_given? &&  @app.respond_to?(:concat_content)
        @options = extract_options_from(*args, &block).dup
Severity: Minor
Found in lib/bh/classes/base.rb - About 2 hrs to fix

    Method static_control_string has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def static_control_string(text, options = {})
            content_tag :div, class: 'form-group' do
              if inline_form?
                  label = content_tag :label, options[:label], class: 'sr-only' if options[:label]
                  field = content_tag :p, text, class: 'form-control-static'
    Severity: Minor
    Found in lib/bh/core_ext/rails/form/static_control_helper.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 link_to has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def link_to(*args, &block)
          link_to = Bh::LinkTo.new self, *args, &block
    
          link_to.append_class! :'alert-link' if Bh::Stack.find(Bh::AlertBox)
          link_to.append_class! :'navbar-brand' if Bh::Stack.find(Bh::Vertical)
    Severity: Minor
    Found in lib/bh/helpers/link_to_helper.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 button_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def button_to(*args, &block)
          button_to = Bh::ButtonTo.new self, *args, &block
    
          if button_to.extract! :context, :size, :layout
            button_to.append_button_class! :btn
    Severity: Minor
    Found in lib/bh/helpers/button_to_helper.rb - About 45 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 select has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def select(method, choices = nil, options = {}, html_options = {}, &block)
    Severity: Minor
    Found in lib/bh/core_ext/rails/form/select_helper.rb - About 35 mins to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.contexts
              HashWithIndifferentAccess.new(:'btn-default').tap do |klass|
                klass[:danger]  = :'btn-danger'
                klass[:info]    = :'btn-info'
                klass[:link]    = :'btn-link'
      Severity: Minor
      Found in lib/bh/classes/button.rb and 1 other location - About 35 mins to fix
      lib/bh/classes/alert_box.rb on lines 23..30

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 34.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.contexts
              HashWithIndifferentAccess.new(:'alert-info').tap do |klass|
                klass[:alert]   = :'alert-danger'
                klass[:danger]  = :'alert-danger'
                klass[:info]    = :'alert-info'
      Severity: Minor
      Found in lib/bh/classes/alert_box.rb and 1 other location - About 35 mins to fix
      lib/bh/classes/button.rb on lines 25..32

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 34.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.positions
              HashWithIndifferentAccess.new.tap do |klass|
                klass[:static]        = :'navbar-static-top'
                klass[:static_top]    = :'navbar-static-top'
                klass[:top]           = :'navbar-fixed-top'
      Severity: Minor
      Found in lib/bh/classes/navbar.rb and 1 other location - About 30 mins to fix
      lib/bh/classes/button.rb on lines 38..45

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 33.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.sizes
              HashWithIndifferentAccess.new.tap do |klass|
                klass[:extra_small] = :'btn-xs'
                klass[:large]       = :'btn-lg'
                klass[:lg]          = :'btn-lg'
      Severity: Minor
      Found in lib/bh/classes/button.rb and 1 other location - About 30 mins to fix
      lib/bh/classes/navbar.rb on lines 49..56

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 33.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method label_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def label_options(errors = {})
              klass = []
              klass << 'sr-only' if inline_form?
              klass << 'col-sm-3' if horizontal_form?
              klass << 'control-label' if horizontal_form?
      Severity: Minor
      Found in lib/bh/core_ext/rails/form/base_helper.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 fields_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def fields_for(record_name, record_object = nil, fields_options = {}, &block)
              if record_object.is_a?(Hash) && record_object.extractable_options?
                record_object, fields_options = nil, record_object
              end
      
      
      Severity: Minor
      Found in lib/bh/core_ext/rails/form/fields_for_helper.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.dialog_sizes
              HashWithIndifferentAccess.new.tap do |klass|
                klass[:large]       = :'modal-lg'
                klass[:lg]          = :'modal-lg'
                klass[:sm]          = :'modal-sm'
      Severity: Minor
      Found in lib/bh/classes/modal.rb and 1 other location - About 15 mins to fix
      lib/bh/classes/progress_bar.rb on lines 45..50

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.contexts
              HashWithIndifferentAccess.new.tap do |klass|
                klass[:danger]  = :'progress-bar-danger'
                klass[:info]    = :'progress-bar-info'
                klass[:success] = :'progress-bar-success'
      Severity: Minor
      Found in lib/bh/classes/progress_bar.rb and 1 other location - About 15 mins to fix
      lib/bh/classes/modal.rb on lines 50..55

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language