colinsurprenant/redstorm

View on GitHub

Showing 33 of 33 total issues

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

package redstorm.storm.jruby;

import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.transactional.TransactionAttempt;
Severity: Major
Found in src/main/redstorm/storm/jruby/JRubyTransactionalBolt.java and 1 other location - About 6 hrs to fix
src/main/redstorm/storm/jruby/JRubyBatchBolt.java on lines 1..108

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

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

package redstorm.storm.jruby;

import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.base.BaseBatchBolt;
Severity: Major
Found in src/main/redstorm/storm/jruby/JRubyBatchBolt.java and 1 other location - About 6 hrs to fix
src/main/redstorm/storm/jruby/JRubyTransactionalBolt.java on lines 1..112

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

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

Class Spout has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Spout
      attr_reader :config, :context, :collector

      def self.java_proxy; "Java::RedstormStormJruby::JRubySpout"; end

Severity: Minor
Found in lib/red_storm/dsl/spout.rb - About 4 hrs to fix

    Class Bolt has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Bolt
          attr_reader :collector, :context, :config
    
          def self.java_proxy; "Java::RedstormStormJruby::JRubyBolt"; end
    
    
    Severity: Minor
    Found in lib/red_storm/dsl/bolt.rb - About 3 hrs to fix

      Method build_topology has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def build_topology(local_drpc)
            spout = FixedBatchSpout.new(
              Fields.new("sentence"), 3,
              Values.new("the cow jumped over the moon"),
              Values.new("the man went to the store and bought some candy"),
      Severity: Major
      Found in examples/trident/word_count_topology.rb - About 2 hrs to fix

        Method run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.run(args)
              if args.size > 0
                if args[0] == "version"
                  puts("RedStorm v#{VERSION}")
                  exit
        Severity: Minor
        Found in lib/red_storm/application.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

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

              def self.bolt(bolt_class, *args, &bolt_block)
                set_topology_class!
                options = args.last.is_a?(Hash) ? args.pop : {}
                contructor_args = !args.empty? ? args.pop : []
                bolt_options = {:id => self.underscore(bolt_class), :parallelism => DEFAULT_BOLT_PARALLELISM}.merge(options)
        Severity: Major
        Found in lib/red_storm/dsl/topology.rb and 1 other location - About 1 hr to fix
        lib/red_storm/dsl/drpc_topology.rb on lines 75..84

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

        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.input_bolt(bolt_class, *args, &bolt_block)
                set_topology_class!
                options = args.last.is_a?(Hash) ? args.pop : {}
                contructor_args = !args.empty? ? args.pop : []
                bolt_options = {:id => self.underscore(bolt_class), :parallelism => DEFAULT_BOLT_PARALLELISM}.merge(options)
        Severity: Major
        Found in lib/red_storm/dsl/drpc_topology.rb and 1 other location - About 1 hr to fix
        lib/red_storm/dsl/topology.rb on lines 121..130

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

        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

            class LocalExclamationTopology2
              RedStorm::Configuration.topology_class = self
        
              def start(base_class_path, env)
                builder = TopologyBuilder.new
        Severity: Major
        Found in examples/native/local_exclamation_topology2.rb and 1 other location - About 1 hr to fix
        examples/native/local_exclamation_topology.rb on lines 10..27

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

        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

            class LocalExclamationTopology
              RedStorm::Configuration.topology_class = self
        
              def start(base_class_path, env)
                builder = TopologyBuilder.new
        Severity: Major
        Found in examples/native/local_exclamation_topology.rb and 1 other location - About 1 hr to fix
        examples/native/local_exclamation_topology2.rb on lines 27..44

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

        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 execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def execute(tuple)
                output = on_receive(tuple)
                if output && self.class.emit?
                  values_list = !output.is_a?(Array) ? [[output]] : !output.first.is_a?(Array) ? [output] : output
                  values_list.each{|values| self.class.anchor? ? anchored_emit(tuple, *values) : unanchored_emit(*values)}
        Severity: Minor
        Found in lib/red_storm/dsl/bolt.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

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

          @Override
          public ICommitterTransactionalSpout.Emitter getEmitter(Map conf, TopologyContext context) {
            if (_ruby_spout == null) {
              IRubyObject _ruby_spout = initialize_ruby_spout();
            }
        src/main/redstorm/storm/jruby/JRubyTransactionalSpout.java on lines 52..61
        src/main/redstorm/storm/jruby/JRubyTransactionalSpout.java on lines 63..72

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

        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 3 locations. Consider refactoring.
        Open

          @Override
          public ITransactionalSpout.Coordinator getCoordinator(Map conf, TopologyContext context) {
            if (_ruby_spout == null) {
              IRubyObject _ruby_spout = initialize_ruby_spout();
            }
        Severity: Major
        Found in src/main/redstorm/storm/jruby/JRubyTransactionalSpout.java and 2 other locations - About 1 hr to fix
        src/main/redstorm/storm/jruby/JRubyTransactionalCommitterSpout.java on lines 22..31
        src/main/redstorm/storm/jruby/JRubyTransactionalSpout.java on lines 63..72

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

        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 3 locations. Consider refactoring.
        Open

          @Override
          public ITransactionalSpout.Emitter getEmitter(Map conf, TopologyContext context) {
            if (_ruby_spout == null) {
              IRubyObject _ruby_spout = initialize_ruby_spout();
            }
        Severity: Major
        Found in src/main/redstorm/storm/jruby/JRubyTransactionalSpout.java and 2 other locations - About 1 hr to fix
        src/main/redstorm/storm/jruby/JRubyTransactionalCommitterSpout.java on lines 22..31
        src/main/redstorm/storm/jruby/JRubyTransactionalSpout.java on lines 52..61

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

        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

          @Override
          public void open(final Map conf, final TopologyContext context, final SpoutOutputCollector collector) {
            _ruby_spout = initialize_ruby_spout();
            IRubyObject ruby_conf = JavaUtil.convertJavaToRuby(__ruby__, conf);
            IRubyObject ruby_context = JavaUtil.convertJavaToRuby(__ruby__, context);
        Severity: Major
        Found in src/main/redstorm/storm/jruby/JRubySpout.java and 1 other location - About 1 hr to fix
        src/main/redstorm/storm/jruby/JRubyBolt.java on lines 50..57

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

        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

          @Override
          public void prepare(final Map conf, final TopologyContext context, final OutputCollector collector) {
            _ruby_bolt = initialize_ruby_bolt();
            IRubyObject ruby_conf = JavaUtil.convertJavaToRuby(__ruby__, conf);
            IRubyObject ruby_context = JavaUtil.convertJavaToRuby(__ruby__, context);
        Severity: Major
        Found in src/main/redstorm/storm/jruby/JRubyBolt.java and 1 other location - About 1 hr to fix
        src/main/redstorm/storm/jruby/JRubySpout.java on lines 50..57

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

        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 resolve_ids! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.resolve_ids!(components)
                # verify duplicate implicit ids
                ids = components.map(&:id)
                components.reverse.each do |component|
                  raise("duplicate id in #{component.clazz.name} on id=#{component.id}") if ids.select{|id| id == component.id}.size > 1
        Severity: Minor
        Found in lib/red_storm/dsl/topology.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

        Function run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                global MODE
                MODE = Spout
                conf, context = initComponent()
                self.initialize(conf, context)
        Severity: Minor
        Found in examples/shell/resources/storm.py - 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 next_tuple has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def next_tuple
                output = on_send
        
                if self.class.emit?
                  if output
        Severity: Minor
        Found in lib/red_storm/dsl/spout.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

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

          @Override
          public void execute(final TridentTuple tuple, final TridentCollector collector) {
            IRubyObject ruby_tuple = JavaUtil.convertJavaToRuby(__ruby__, tuple);
            IRubyObject ruby_collector = JavaUtil.convertJavaToRuby(__ruby__, collector);
            Helpers.invoke(__ruby__.getCurrentContext(), _ruby_function, "execute", ruby_tuple, ruby_collector);
        Severity: Minor
        Found in src/main/redstorm/storm/jruby/JRubyTridentFunction.java and 1 other location - About 40 mins to fix
        src/main/redstorm/storm/jruby/JRubyBatchSpout.java on lines 68..75

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

        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