tensorflow/models

View on GitHub
research/object_detection/builders/dataset_builder.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function build has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def build(input_reader_config, batch_size=None, transform_input_data_fn=None,
          input_context=None, reduce_to_frame_fn=None):
  """Builds a tf.data.Dataset.

  Builds a tf.data.Dataset by applying the `transform_input_data_fn` on all
Severity: Minor
Found in research/object_detection/builders/dataset_builder.py - About 3 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

Function read_dataset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def read_dataset(file_read_func, input_files, config, filename_shard_fn=None):
  """Reads multiple datasets with sampling.

  Args:
    file_read_func: Function to use in tf_data.parallel_interleave, to read
Severity: Minor
Found in research/object_detection/builders/dataset_builder.py - 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 _read_dataset_internal has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _read_dataset_internal(file_read_func,
Severity: Minor
Found in research/object_detection/builders/dataset_builder.py - About 35 mins to fix

    Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def build(input_reader_config, batch_size=None, transform_input_data_fn=None,
    Severity: Minor
    Found in research/object_detection/builders/dataset_builder.py - About 35 mins to fix

      Function _read_dataset_internal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _read_dataset_internal(file_read_func,
                                 input_files,
                                 num_readers,
                                 config,
                                 filename_shard_fn=None):
      Severity: Minor
      Found in research/object_detection/builders/dataset_builder.py - 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

      There are no issues that match your filters.

      Category
      Status