celluloid/celluloid

View on GitHub

Showing 53 of 53 total issues

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

    def initialize(type, meta)
      @type     = type
      @meta     = meta
      @status   = :new

Severity: Minor
Found in lib/celluloid/task.rb - About 1 hr to fix

    Method << has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def <<(message)
            @mutex.lock
            begin
              if mailbox_full || @dead
                dead_letter(message)
    Severity: Minor
    Found in lib/celluloid/mailbox/evented.rb - About 1 hr to fix

      Method signal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def signal(value)
            return if @cancelled
            result = Result.new(value, self)
      
            @mutex.synchronize do
      Severity: Minor
      Found in lib/celluloid/future.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 configure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

                def configure(options)
                  behavior = nil
                  injection = nil
                  @@behaviors.map do |identifier, injector|
                    if identifier = parameter(identifier, options)
      Severity: Minor
      Found in lib/celluloid/supervision/container/behavior.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 shutdown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def shutdown
              @running = false
              queue = []
              @mutex.synchronize do
                loop do
      Severity: Minor
      Found in lib/celluloid/group/spawner.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 remove_accessors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def remove_accessors
                if @configuration[:accessors].is_a? Array
                  @configuration[:accessors].each do |name|
                    Celluloid.instance_eval do
                      remove_method(name) rescue nil # avoid warnings in tests
      Severity: Minor
      Found in lib/celluloid/supervision/container/instance.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 << has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def <<(message)
              @mutex.lock
              begin
                if mailbox_full || @dead
                  dead_letter(message)
      Severity: Minor
      Found in lib/celluloid/mailbox/evented.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 cleanup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def cleanup(exit_event)
            # !!! DO NOT INTRODUCE ADDITIONAL GLOBAL VARIABLES !!!
            # rubocop:disable Style/GlobalVars
            Celluloid::Probe.actor_died(self) if $CELLULOID_MONITORING
            # rubocop:enable Style/GlobalVars
      Severity: Minor
      Found in lib/celluloid/actor.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 wait has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def wait(timeout = nil)
            raise ConditionError, "cannot wait for signals while exclusive" if Celluloid.exclusive?
      
            if actor = Thread.current[:celluloid_actor]
              task = Task.current
      Severity: Minor
      Found in lib/celluloid/condition.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 add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def add(severity, message = nil, progname = nil, &block)
            progname ||= @progname
            severity ||= UNKNOWN
      
            return event.id if severity < @level
      Severity: Minor
      Found in lib/celluloid/logging/incident_logger.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                sender,
                method,
                arguments = [],
                block = nil,
                task = Thread.current[:celluloid_task],
      Severity: Minor
      Found in lib/celluloid/call/sync.rb - About 45 mins to fix

        Method inspect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def inspect
              return "..." if Celluloid.detect_recursion
        
              str = "#<"
        
        
        Severity: Minor
        Found in lib/celluloid.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

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

                  Configuration.aliases.each do |_alias, _original|
                    ["!", :"=", :"?", :""]. each do |m|
                      self.class.instance_eval do
                        remove_method :"#{_alias}#{m}" rescue nil # avoid warnings in tests
                        alias_method :"#{_alias}#{m}", :"#{_original}#{m}"
        Severity: Minor
        Found in lib/celluloid/supervision/configuration/instance.rb and 1 other location - About 45 mins to fix
        lib/celluloid/supervision/configuration.rb on lines 93..97

        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 39.

        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

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

                Configuration.aliases.each do |_alias, _original|
                  ["!", :"=", :"?", :""]. each do |m|
                    self.class.instance_eval do
                      remove_method :"#{_alias}#{m}" rescue nil # avoid warnings in tests
                      alias_method :"#{_alias}#{m}", :"#{_original}#{m}"
        Severity: Minor
        Found in lib/celluloid/supervision/configuration.rb and 1 other location - About 45 mins to fix
        lib/celluloid/supervision/configuration/instance.rb on lines 62..66

        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 39.

        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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(severity, message, progname, time = Time.now, &_block)
        Severity: Minor
        Found in lib/celluloid/logging/log_event.rb - About 35 mins to fix

          Method task has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def task(task_type, method_name = nil, subject = nil, meta = nil, &_block)
          Severity: Minor
          Found in lib/celluloid/cell.rb - About 35 mins to fix

            Method add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def add(name, actor, branch = :services)
                    set(name, actor)
                    @registry.synchronize do
                      unless @branches.key? branch
                        @branches[branch] = []
            Severity: Minor
            Found in lib/celluloid/internals/registry.rb - About 35 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(options = {})
                    @instances = [Instance.new]
                    @branch = :services
                    @i = 0 # incrementer of instances in this branch
                    resync_accessors
            Severity: Minor
            Found in lib/celluloid/supervision/configuration.rb - About 35 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 deliver has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def deliver(value)
                    raise DeadTaskError, "cannot resume a dead task" unless @thread.alive?
            
                    @yield_mutex.synchronize do
                      @resume_queue.push(value)
            Severity: Minor
            Found in lib/celluloid/task/threaded.rb - About 35 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 define has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def define(configuration, fail = false)
                    if configuration.is_a? Array
                      configuration.each { |c| define(c, fail) }
                    else
                      unless include? configuration[:as]
            Severity: Minor
            Found in lib/celluloid/supervision/configuration.rb - About 35 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

            Severity
            Category
            Status
            Source
            Language