IRC-SPHERE/HyperStream

View on GitHub

Showing 2,622 of 2,627 total issues

Avoid deeply nested control flow statements.
Open

                        if not is_sub_plate:
                            raise IncompatiblePlatesError("Sink plate is not a simplification of source plate")
                    else:
Severity: Major
Found in hyperstream/workflow/workflow.py - About 45 mins to fix

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

    def _execute(self, sources, interval):

        found_source = False
        found_data_in_source = False
        for source in sources:
Severity: Minor
Found in hyperstream/tools/index_of/2016-10-26_v0.1.0.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

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

    def _execute(self, sources, interval):

        found_source = False
        found_data_in_source = False
        for source in sources:
Severity: Minor
Found in hyperstream/tools/index_of/2016-11-23_v0.2.0.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

Avoid deeply nested control flow statements.
Open

                        if self.header:
                            colnames = [name.replace('\n', '') for name in line.split(',')]
                            del colnames[self.datetime_column]
                        count += 1
Severity: Major
Found in plugins/data_importers/tools/csv_multi_reader/2017-07-21_v0.0.1.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                                if not all(map(lambda x: x[0] == x[1], zip(value[k], old[k]))):
                                    raise KeyError(
                                        "Key {} has already been set with value {}, new value {}"
                                        .format(key, self[key], value))
                            except ValueError as e:
Severity: Major
Found in hyperstream/utils/containers.py - About 45 mins to fix

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

    def _execute(self, sources, alignment_stream, interval):
        # Combine the data, apply the mapping and sort (inefficient!)
        results = dict()
        for source in sources:
            data = source.window(interval, force_calculation=True)
Severity: Minor
Found in hyperstream/tools/aggregate_into_dict_and_apply/2017-05-26_v0.0.1.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

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

    def get_tool(self, name, parameters, version=None):
        """
        Gets the tool object from the tool channel(s), and instantiates it using the tool parameters

        :param name: The name or stream id for the tool in the tool channel
Severity: Minor
Found in hyperstream/channels/channel_manager.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

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

    def find_streams(self, **kwargs):
        """
        Finds streams with the given meta data values. Useful for debugging purposes.

        :param kwargs: The meta data as keyword arguments
Severity: Minor
Found in hyperstream/channels/base_channel.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

Avoid deeply nested control flow statements.
Open

                        if self.header:
                            values = dict(zip(colnames, map(my_float, elements)))
                        else:
                            values = map(float, elements)
                        instance = StreamInstance(dt, values)
Severity: Major
Found in plugins/data_importers/tools/csv_multi_reader/2017-07-21_v0.0.1.py - About 45 mins to fix

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

    def execute(self, time_interval):
        """
        Here we execute the factors over the streams in the workflow
        Execute the factors in reverse order. We can't just execute the last factor because there may be multiple
        "leaf" factors that aren't triggered by upstream computations.
Severity: Minor
Found in hyperstream/workflow/workflow.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

Avoid deeply nested control flow statements.
Open

                        if set(parent_plate_value) not in map(set, self.plates[plate_definition.parent_plate].values):
                            continue
                        values.insert(0, self.get_parent_data(
Severity: Major
Found in hyperstream/plate/plate_manager.py - About 45 mins to fix

Function now_minus has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def now_minus(cls, weeks=0, days=0, hours=0, minutes=0, seconds=0, milliseconds=0):
Severity: Minor
Found in hyperstream/time_interval.py - About 45 mins to fix

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

    def _execute(self, sources, interval):
        time_interval = TimeInterval(MIN_DATE, interval.end)
        selector_meta_data = sources[0].window(time_interval, force_calculation=True).last().value

        found_source = False
Severity: Minor
Found in hyperstream/tools/index_of_by_stream/2016-10-26_v0.1.0.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

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

        if not isinstance(key, self.key_type):
            raise KeyError("Expected type {}, got {}".format(self.key_type, type(key)))
Severity: Major
Found in hyperstream/utils/containers.py and 3 other locations - About 45 mins to fix
hyperstream/utils/containers.py on lines 227..228
hyperstream/utils/containers.py on lines 236..237
hyperstream/utils/containers.py on lines 238..239

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

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

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

    def __init__(self):
        self.global_plate_definitions = MetaDataTree()
        self.global_plate_definitions.create_node(identifier="root")

        to_be_added = dict((i, d) for i, d, in enumerate(self.global_meta_data))
Severity: Minor
Found in hyperstream/meta_data/meta_data_manager.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

Function execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def execute(self, source, splitting_stream, sinks, interval, meta_data_id, output_plate_values):
Severity: Minor
Found in hyperstream/tool/multi_output_tool.py - About 45 mins to fix

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

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
Severity: Minor
Found in examples/online_engine.py and 1 other location - About 45 mins to fix
main.py on lines 25..25

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

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

        if data is None:
            logging.debug("{} found no data for interval {} for source {} and splitter {}"
                          .format(self.name, interval, source.stream_id, splitting_stream.stream_id))
            return
hyperstream/tools/stream_broadcaster_from_stream/2016-11-10_v0.0.1.py on lines 64..67

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

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

        if source and not isinstance(source, Node):
            raise ValueError("Expected Node, got {}".format(type(source)))
Severity: Major
Found in hyperstream/workflow/workflow.py and 3 other locations - About 45 mins to fix
hyperstream/factor/factor.py on lines 84..85
hyperstream/factor/factor.py on lines 300..301
hyperstream/factor/factor.py on lines 307..308

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

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

        if splitting_node and not isinstance(splitting_node, Node):
            raise ValueError("Expected node, got {}".format(type(splitting_node)))
Severity: Major
Found in hyperstream/factor/factor.py and 3 other locations - About 45 mins to fix
hyperstream/factor/factor.py on lines 84..85
hyperstream/factor/factor.py on lines 300..301
hyperstream/workflow/workflow.py on lines 307..308

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

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