tensorflow/models

View on GitHub
research/slim/nets/s3dg.py

Summary

Maintainability
F
6 days
Test Coverage

File s3dg.py has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in research/slim/nets/s3dg.py - About 1 day to fix

    Function s3dg_base has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def s3dg_base(inputs,
                  first_temporal_kernel_size=3,
                  temporal_conv_startat='Conv2d_2c_3x3',
                  gating_startat='Conv2d_2c_3x3',
                  final_endpoint='Mixed_5c',
    Severity: Minor
    Found in research/slim/nets/s3dg.py - About 5 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 s3dg has 15 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def s3dg(inputs,
    Severity: Major
    Found in research/slim/nets/s3dg.py - About 1 hr to fix

      Function s3dg_base has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def s3dg_base(inputs,
      Severity: Major
      Found in research/slim/nets/s3dg.py - About 1 hr to fix

        Avoid too many return statements within this function.
        Open

                  return net, end_points
        Severity: Major
        Found in research/slim/nets/s3dg.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return net, end_points
          Severity: Major
          Found in research/slim/nets/s3dg.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return net, end_points
            Severity: Major
            Found in research/slim/nets/s3dg.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return net, end_points
              Severity: Major
              Found in research/slim/nets/s3dg.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return net, end_points
                Severity: Major
                Found in research/slim/nets/s3dg.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return net, end_points
                  Severity: Major
                  Found in research/slim/nets/s3dg.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return net, end_points
                    Severity: Major
                    Found in research/slim/nets/s3dg.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return net, end_points
                      Severity: Major
                      Found in research/slim/nets/s3dg.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return net, end_points
                        Severity: Major
                        Found in research/slim/nets/s3dg.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                    return net, end_points
                          Severity: Major
                          Found in research/slim/nets/s3dg.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                      return net, end_points
                            Severity: Major
                            Found in research/slim/nets/s3dg.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                        return net, end_points
                              Severity: Major
                              Found in research/slim/nets/s3dg.py - About 30 mins to fix

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(256),
                                            num_outputs_1_0a=depth(160),
                                            num_outputs_1_0b=depth(320),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 442..449
                                research/slim/nets/s3dg.py on lines 465..472

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(128),
                                            num_outputs_1_0a=depth(128),
                                            num_outputs_1_0b=depth(256),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 442..449
                                research/slim/nets/s3dg.py on lines 465..472

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(256),
                                            num_outputs_1_0a=depth(160),
                                            num_outputs_1_0b=depth(320),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 465..472

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(192),
                                            num_outputs_1_0a=depth(96),
                                            num_outputs_1_0b=depth(208),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 442..449
                                research/slim/nets/s3dg.py on lines 465..472

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(128),
                                            num_outputs_1_0a=depth(128),
                                            num_outputs_1_0b=depth(192),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 442..449
                                research/slim/nets/s3dg.py on lines 465..472

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(160),
                                            num_outputs_1_0a=depth(112),
                                            num_outputs_1_0b=depth(224),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 442..449
                                research/slim/nets/s3dg.py on lines 465..472

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(112),
                                            num_outputs_1_0a=depth(144),
                                            num_outputs_1_0b=depth(288),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 442..449
                                research/slim/nets/s3dg.py on lines 465..472

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(384),
                                            num_outputs_1_0a=depth(192),
                                            num_outputs_1_0b=depth(384),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 270..277
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 442..449

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

                                        net = inception_block_v1_3d(
                                            net,
                                            num_outputs_0_0a=depth(64),
                                            num_outputs_1_0a=depth(96),
                                            num_outputs_1_0b=depth(128),
                                Severity: Major
                                Found in research/slim/nets/s3dg.py and 8 other locations - About 3 hrs to fix
                                research/slim/nets/s3dg.py on lines 292..299
                                research/slim/nets/s3dg.py on lines 321..328
                                research/slim/nets/s3dg.py on lines 344..351
                                research/slim/nets/s3dg.py on lines 367..374
                                research/slim/nets/s3dg.py on lines 390..397
                                research/slim/nets/s3dg.py on lines 413..420
                                research/slim/nets/s3dg.py on lines 442..449
                                research/slim/nets/s3dg.py on lines 465..472

                                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

                                There are no issues that match your filters.

                                Category
                                Status