deeplearning4j/deeplearning4j

View on GitHub
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt

Summary

Maintainability
F
1 wk
Test Coverage

Method Bitwise has a Cognitive Complexity of 190 (exceeds 20 allowed). Consider refactoring.
Open

fun Bitwise() = Namespace("Bitwise"){
    val namespaceJavaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"

    Op("leftShift") {
        javaPackage = namespaceJavaPackage
Severity: Minor
Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt - About 3 days 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

    Op("xor") {
        javaPackage = namespaceJavaPackage
        javaOpClass = "BitwiseXor"

        val x = Input(INT, "x") { description = "First input array" }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 118..134
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 136..152

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

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

    Op("or") {
        javaPackage = namespaceJavaPackage
        javaOpClass = "BitwiseOr"

        val x = Input(INT, "x") { description = "First input array" }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 118..134
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 154..170

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

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

    Op("and") {
        javaPackage = namespaceJavaPackage
        javaOpClass = "BitwiseAnd"

        val x = Input(INT, "x") { description = "First input array" }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 136..152
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 154..170

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

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

    Op("rightShiftCyclic") {
        javaPackage = namespaceJavaPackage
        javaOpClass = "CyclicRShiftBits"

        Input(INT, "x") { description = "Input to be bit shifted" }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 64..80

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

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

    Op("leftShiftCyclic") {
        javaPackage = namespaceJavaPackage
        javaOpClass = "CyclicShiftBits"

        Input(INT, "x") { description = "Input to be bit shifted" }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 82..98

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

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

    Op("bitRotl") {
        javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"
        javaOpClass = "CyclicShiftBits"
        Input(INT, "x") { description = "Input 1" }
        Input(INT, "shift") { description = "Number of bits to shift." }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 172..183
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 185..196
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 212..224
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1518..1530
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1532..1544
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1546..1558
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1560..1572
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 241..253
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1003..1014
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1030..1041
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2115..2126
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2129..2140

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

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

    Op("bitShiftRight") {
        javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"
        javaOpClass = "RShiftBits"
        Input(INT, "x") { description = "Input 1" }
        Input(INT, "shift") { description = "Number of bits to shift." }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 172..183
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 198..210
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 212..224
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1518..1530
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1532..1544
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1546..1558
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1560..1572
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 241..253
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1003..1014
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1030..1041
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2115..2126
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2129..2140

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

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

    Op("bitShift") {
        javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"
        javaOpClass = "ShiftBits"
        Input(INT, "x") { description = "Input 1" }
        Input(INT, "shift") { description = "Number of bits to shift." }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 185..196
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 198..210
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 212..224
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1518..1530
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1532..1544
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1546..1558
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1560..1572
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 241..253
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1003..1014
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1030..1041
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2115..2126
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2129..2140

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

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

    Op("bitRotr") {
        javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"
        javaOpClass = "CyclicRShiftBits"
        Input(INT, "x") { description = "Input 1" }
        Input(INT, "shift") { description = "Number of bits to shift." }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 172..183
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 185..196
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 198..210
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1518..1530
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1532..1544
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1546..1558
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1560..1572
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 241..253
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1003..1014
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1030..1041
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2115..2126
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2129..2140

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

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

    Op("leftShift") {
        javaPackage = namespaceJavaPackage
        javaOpClass = "ShiftBits"

        Input(INT, "x") { description = "Input to be bit shifted" }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 48..62
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 89..102
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 104..117
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 119..132
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 153..166

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

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

    Op("rightShift") {
        javaPackage = namespaceJavaPackage
        javaOpClass = "RShiftBits"

        Input(INT, "x") { description = "Input to be bit shifted" }
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 32..46
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 89..102
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 104..117
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 119..132
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 153..166

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

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