tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

  def build(self, input_shape):
    """Builds the layer with the given input shape."""
    padding = 'causal' if self._causal else 'same'
    self._groups = input_shape[-1] if self._depthwise else 1

Severity: Minor
Found in official/projects/movinet/modeling/movinet_layers.py - 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

Function __call__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def __call__(self, logits: tf.Tensor, labels: tf.Tensor) -> tf.Tensor:
    """Computes and returns a loss based on 1 - dice score.

    Args:
      logits: A Tensor of the prediction.
Severity: Minor
Found in official/projects/volumetric_models/losses/segmentation_losses.py - 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

Function call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def call(self, inputs):
    if isinstance(inputs, dict):
      left_word_ids = inputs.get('left_word_ids')
      left_mask = inputs.get('left_mask')

Severity: Minor
Found in official/projects/lra/lra_dual_encoder.py - 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

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

  def build(self, input_shape):
    if isinstance(input_shape, tf.TensorShape):
      input_tensor_shape = input_shape
    elif isinstance(input_shape, (list, tuple)):
      input_tensor_shape = tf.TensorShape(input_shape[0])
Severity: Minor
Found in official/projects/lra/linformer_encoder_block.py - 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

Function predict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def predict(
    task: DualEncoderTask,
    params: cfg.DataConfig,
    model: tf_keras.Model,
    params_aug: Optional[cfg.DataConfig] = None,
Severity: Minor
Found in official/projects/lra/lra_dual_encoder_task.py - 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

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

  def build(self, input_shape: tf.TensorShape) -> None:
    """Builds block according to the arguments."""

    channel_axis = 3 if self._data_format == 'channels_last' else 1
    input_size = input_shape[channel_axis]
Severity: Minor
Found in official/projects/maxvit/modeling/layers.py - 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

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

  def build(self, input_shape):
    # Starting depthwise conv.
    if self._start_dw_kernel_size:
      self._start_dw_conv = helper.DepthwiseConv2DQuantized(
          kernel_size=self._start_dw_kernel_size,
Severity: Minor
Found in official/projects/qat/vision/modeling/layers/nn_blocks.py - 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

Function build_qat_classification_model has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def build_qat_classification_model(
    model: tf_keras.Model,
    quantization: common.Quantization,
    input_specs: tf_keras.layers.InputSpec,
    model_config: configs.image_classification.ImageClassificationModel,
Severity: Minor
Found in official/projects/qat/vision/modeling/factory.py - 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

Function summaries_with_matching_keyword has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def summaries_with_matching_keyword(keyword, summary_dir):
  """Returns summary protos matching given keyword from event file."""
  matches = []
  event_paths = tf.io.gfile.glob(os.path.join(summary_dir, "events*"))
  for event in tf.compat.v1.train.summary_iterator(event_paths[-1]):
Severity: Minor
Found in orbit/controller_test.py - 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

Function call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def call(
      self,
      query: tf.Tensor,
      training: bool,
      context: Optional[tf.Tensor] = None,
Severity: Minor
Found in official/projects/maxvit/modeling/layers.py - 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

Function evaluate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def evaluate(self, num_steps: tf.Tensor) -> Optional[runner.Output]:
    """Implements `num_steps` steps of evaluation.

    Args:
      num_steps: The number of evaluation steps to run. When this is -1,
Severity: Minor
Found in orbit/standard_runner.py - 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

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

def _copy_extra_fields(boxlist_to_copy_to, boxlist_to_copy_from):
  """Copies the extra fields of boxlist_to_copy_from to boxlist_to_copy_to.

  Args:
    boxlist_to_copy_to: BoxList to which extra fields are copied.
Severity: Major
Found in research/object_detection/core/box_list_ops.py and 4 other locations - About 1 hr to fix
official/projects/centernet/ops/box_list_ops.py on lines 23..35
official/vision/utils/object_detection/box_list_ops.py on lines 764..776
official/vision/utils/object_detection/preprocessor.py on lines 428..440
research/object_detection/utils/np_box_list_ops.py on lines 545..557

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

def _copy_extra_fields(boxlist_to_copy_to, boxlist_to_copy_from):
  """Copies the extra fields of boxlist_to_copy_from to boxlist_to_copy_to.

  Args:
    boxlist_to_copy_to: BoxList to which extra fields are copied.
Severity: Major
Found in official/projects/centernet/ops/box_list_ops.py and 4 other locations - About 1 hr to fix
official/vision/utils/object_detection/box_list_ops.py on lines 764..776
official/vision/utils/object_detection/preprocessor.py on lines 428..440
research/object_detection/core/box_list_ops.py on lines 829..841
research/object_detection/utils/np_box_list_ops.py on lines 545..557

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

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

  def _build_conv_hyperparams(self):
    conv_hyperparams = hyperparams_pb2.Hyperparams()
    conv_hyperparams_text_proto = """
      regularizer {
        l2_regularizer {
research/object_detection/models/bidirectional_feature_pyramid_generators_tf2_test.py on lines 37..51
research/object_detection/models/faster_rcnn_resnet_v1_fpn_keras_feature_extractor_tf2_test.py on lines 31..44
research/object_detection/models/feature_map_generators_test.py on lines 390..403
research/object_detection/models/keras_models/mobilenet_v1_tf2_test.py on lines 70..91
research/object_detection/models/keras_models/mobilenet_v2_tf2_test.py on lines 59..80
research/object_detection/models/keras_models/resnet_v1_tf2_test.py on lines 73..95
research/object_detection/predictors/convolutional_keras_box_predictor_tf2_test.py on lines 36..50
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 127..141
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 32..46
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 130..144
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 202..216
research/object_detection/predictors/rfcn_keras_box_predictor_tf2_test.py on lines 32..45

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

def _copy_extra_fields(boxlist_to_copy_to, boxlist_to_copy_from):
  """Copies the extra fields of boxlist_to_copy_from to boxlist_to_copy_to.

  Args:
    boxlist_to_copy_to: BoxList to which extra fields are copied.
Severity: Major
Found in official/vision/utils/object_detection/box_list_ops.py and 4 other locations - About 1 hr to fix
official/projects/centernet/ops/box_list_ops.py on lines 23..35
official/vision/utils/object_detection/preprocessor.py on lines 428..440
research/object_detection/core/box_list_ops.py on lines 829..841
research/object_detection/utils/np_box_list_ops.py on lines 545..557

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

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

  def _build_conv_hyperparams(self):
    conv_hyperparams = hyperparams_pb2.Hyperparams()
    conv_hyperparams_text_proto = """
      activation: RELU_6
      regularizer {
research/object_detection/models/bidirectional_feature_pyramid_generators_tf2_test.py on lines 37..51
research/object_detection/models/faster_rcnn_resnet_v1_fpn_keras_feature_extractor_tf2_test.py on lines 31..44
research/object_detection/models/feature_map_generators_test.py on lines 60..73
research/object_detection/models/feature_map_generators_test.py on lines 390..403
research/object_detection/models/keras_models/mobilenet_v2_tf2_test.py on lines 59..80
research/object_detection/models/keras_models/resnet_v1_tf2_test.py on lines 73..95
research/object_detection/predictors/convolutional_keras_box_predictor_tf2_test.py on lines 36..50
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 127..141
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 32..46
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 130..144
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 202..216
research/object_detection/predictors/rfcn_keras_box_predictor_tf2_test.py on lines 32..45

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

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

  def _build_conv_hyperparams(self):
    conv_hyperparams = hyperparams_pb2.Hyperparams()
    conv_hyperparams_text_proto = """
      regularizer {
        l2_regularizer {
research/object_detection/models/bidirectional_feature_pyramid_generators_tf2_test.py on lines 37..51
research/object_detection/models/faster_rcnn_resnet_v1_fpn_keras_feature_extractor_tf2_test.py on lines 31..44
research/object_detection/models/feature_map_generators_test.py on lines 60..73
research/object_detection/models/feature_map_generators_test.py on lines 390..403
research/object_detection/models/keras_models/mobilenet_v1_tf2_test.py on lines 70..91
research/object_detection/models/keras_models/mobilenet_v2_tf2_test.py on lines 59..80
research/object_detection/models/keras_models/resnet_v1_tf2_test.py on lines 73..95
research/object_detection/predictors/convolutional_keras_box_predictor_tf2_test.py on lines 36..50
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 127..141
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 32..46
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 130..144
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 202..216

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

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

  def _build_conv_hyperparams(self):
    conv_hyperparams = hyperparams_pb2.Hyperparams()
    conv_hyperparams_text_proto = """
      regularizer {
        l2_regularizer {
research/object_detection/models/bidirectional_feature_pyramid_generators_tf2_test.py on lines 37..51
research/object_detection/models/faster_rcnn_resnet_v1_fpn_keras_feature_extractor_tf2_test.py on lines 31..44
research/object_detection/models/feature_map_generators_test.py on lines 60..73
research/object_detection/models/keras_models/mobilenet_v1_tf2_test.py on lines 70..91
research/object_detection/models/keras_models/mobilenet_v2_tf2_test.py on lines 59..80
research/object_detection/models/keras_models/resnet_v1_tf2_test.py on lines 73..95
research/object_detection/predictors/convolutional_keras_box_predictor_tf2_test.py on lines 36..50
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_box_head_tf2_test.py on lines 127..141
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 32..46
research/object_detection/predictors/heads/keras_class_head_tf2_test.py on lines 130..144
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 31..45
research/object_detection/predictors/heads/keras_mask_head_tf2_test.py on lines 202..216
research/object_detection/predictors/rfcn_keras_box_predictor_tf2_test.py on lines 32..45

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

def _copy_extra_fields(boxlist_to_copy_to, boxlist_to_copy_from):
  """Copies the extra fields of boxlist_to_copy_from to boxlist_to_copy_to.

  Args:
    boxlist_to_copy_to: BoxList to which extra fields are copied.
Severity: Major
Found in research/object_detection/utils/np_box_list_ops.py and 4 other locations - About 1 hr to fix
official/projects/centernet/ops/box_list_ops.py on lines 23..35
official/vision/utils/object_detection/box_list_ops.py on lines 764..776
official/vision/utils/object_detection/preprocessor.py on lines 428..440
research/object_detection/core/box_list_ops.py on lines 829..841

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

def _copy_extra_fields(boxlist_to_copy_to, boxlist_to_copy_from):
  """Copies the extra fields of boxlist_to_copy_from to boxlist_to_copy_to.

  Args:
    boxlist_to_copy_to: BoxList to which extra fields are copied.
Severity: Major
Found in official/vision/utils/object_detection/preprocessor.py and 4 other locations - About 1 hr to fix
official/projects/centernet/ops/box_list_ops.py on lines 23..35
official/vision/utils/object_detection/box_list_ops.py on lines 764..776
research/object_detection/core/box_list_ops.py on lines 829..841
research/object_detection/utils/np_box_list_ops.py on lines 545..557

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

Severity
Category
Status
Source
Language