redmine/redmine

View on GitHub
lib/redmine/plugin.rb

Summary

Maintainability
D
2 days
Test Coverage

Method requires_redmine has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def requires_redmine(arg)
      arg = {:version_or_higher => arg} unless arg.is_a?(Hash)
      arg.assert_valid_keys(:version, :version_or_higher)

      current = Redmine::VERSION.to_a
Severity: Minor
Found in lib/redmine/plugin.rb - About 4 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

Class Plugin has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Plugin
    # Absolute path to the directory where plugins are located
    cattr_accessor :directory
    self.directory = PluginLoader.directory

Severity: Minor
Found in lib/redmine/plugin.rb - About 3 hrs to fix

    File plugin.rb has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Redmine
    
      # Exception raised when a plugin cannot be found given its id.
      class PluginNotFound < StandardError; end
    
    
    Severity: Minor
    Found in lib/redmine/plugin.rb - About 3 hrs to fix

      Method requires_redmine_plugin has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def requires_redmine_plugin(plugin_name, arg)
            arg = {:version_or_higher => arg} unless arg.is_a?(Hash)
            arg.assert_valid_keys(:version, :version_or_higher)
      
            begin
      Severity: Minor
      Found in lib/redmine/plugin.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 requires_redmine has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def requires_redmine(arg)
            arg = {:version_or_higher => arg} unless arg.is_a?(Hash)
            arg.assert_valid_keys(:version, :version_or_higher)
      
            current = Redmine::VERSION.to_a
      Severity: Minor
      Found in lib/redmine/plugin.rb - About 1 hr to fix

        Method requires_redmine_plugin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def requires_redmine_plugin(plugin_name, arg)
              arg = {:version_or_higher => arg} unless arg.is_a?(Hash)
              arg.assert_valid_keys(:version, :version_or_higher)
        
              begin
        Severity: Minor
        Found in lib/redmine/plugin.rb - About 1 hr to fix

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

              def self.register(id, &block)
                p = new(id)
                p.instance_eval(&block)
          
                # Set a default name if it was not provided during registration
          Severity: Minor
          Found in lib/redmine/plugin.rb - About 1 hr to fix

            Method register has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.register(id, &block)
                  p = new(id)
                  p.instance_eval(&block)
            
                  # Set a default name if it was not provided during registration
            Severity: Minor
            Found in lib/redmine/plugin.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

            There are no issues that match your filters.

            Category
            Status