nuts-foundation/nuts-node

View on GitHub
vdr/didnuts/didstore/merge.go

Summary

Maintainability
B
5 hrs
Test Coverage
A
100%

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

func authenticationSort(result *did.Document) less {
    return func(i, j int) bool {
        is := result.Authentication[i].ID.String()
        js := result.Authentication[j].ID.String()
        return strings.Compare(is, js) == -1
Severity: Major
Found in vdr/didnuts/didstore/merge.go and 6 other locations - About 45 mins to fix
vdr/didnuts/didstore/merge.go on lines 155..161
vdr/didnuts/didstore/merge.go on lines 163..169
vdr/didnuts/didstore/merge.go on lines 171..177
vdr/didnuts/didstore/merge.go on lines 187..193
vdr/didnuts/didstore/merge.go on lines 195..201
vdr/didnuts/didstore/merge.go on lines 203..209

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

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

func capabilityInvocationSort(result *did.Document) less {
    return func(i, j int) bool {
        is := result.CapabilityInvocation[i].ID.String()
        js := result.CapabilityInvocation[j].ID.String()
        return strings.Compare(is, js) == -1
Severity: Major
Found in vdr/didnuts/didstore/merge.go and 6 other locations - About 45 mins to fix
vdr/didnuts/didstore/merge.go on lines 155..161
vdr/didnuts/didstore/merge.go on lines 163..169
vdr/didnuts/didstore/merge.go on lines 171..177
vdr/didnuts/didstore/merge.go on lines 179..185
vdr/didnuts/didstore/merge.go on lines 195..201
vdr/didnuts/didstore/merge.go on lines 203..209

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

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

func capabilityDelegationSort(result *did.Document) less {
    return func(i, j int) bool {
        is := result.CapabilityDelegation[i].ID.String()
        js := result.CapabilityDelegation[j].ID.String()
        return strings.Compare(is, js) == -1
Severity: Major
Found in vdr/didnuts/didstore/merge.go and 6 other locations - About 45 mins to fix
vdr/didnuts/didstore/merge.go on lines 155..161
vdr/didnuts/didstore/merge.go on lines 163..169
vdr/didnuts/didstore/merge.go on lines 171..177
vdr/didnuts/didstore/merge.go on lines 179..185
vdr/didnuts/didstore/merge.go on lines 187..193
vdr/didnuts/didstore/merge.go on lines 203..209

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

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

func serviceSort(result *did.Document) less {
    return func(i, j int) bool {
        is := result.Service[i].ID.String()
        js := result.Service[j].ID.String()
        return strings.Compare(is, js) == -1
Severity: Major
Found in vdr/didnuts/didstore/merge.go and 6 other locations - About 45 mins to fix
vdr/didnuts/didstore/merge.go on lines 155..161
vdr/didnuts/didstore/merge.go on lines 163..169
vdr/didnuts/didstore/merge.go on lines 171..177
vdr/didnuts/didstore/merge.go on lines 179..185
vdr/didnuts/didstore/merge.go on lines 187..193
vdr/didnuts/didstore/merge.go on lines 195..201

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

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

func keyAgreementSort(result *did.Document) less {
    return func(i, j int) bool {
        is := result.KeyAgreement[i].ID.String()
        js := result.KeyAgreement[j].ID.String()
        return strings.Compare(is, js) == -1
Severity: Major
Found in vdr/didnuts/didstore/merge.go and 6 other locations - About 45 mins to fix
vdr/didnuts/didstore/merge.go on lines 155..161
vdr/didnuts/didstore/merge.go on lines 171..177
vdr/didnuts/didstore/merge.go on lines 179..185
vdr/didnuts/didstore/merge.go on lines 187..193
vdr/didnuts/didstore/merge.go on lines 195..201
vdr/didnuts/didstore/merge.go on lines 203..209

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

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

func assertionSort(result *did.Document) less {
    return func(i, j int) bool {
        is := result.AssertionMethod[i].ID.String()
        js := result.AssertionMethod[j].ID.String()
        return strings.Compare(is, js) == -1
Severity: Major
Found in vdr/didnuts/didstore/merge.go and 6 other locations - About 45 mins to fix
vdr/didnuts/didstore/merge.go on lines 155..161
vdr/didnuts/didstore/merge.go on lines 163..169
vdr/didnuts/didstore/merge.go on lines 179..185
vdr/didnuts/didstore/merge.go on lines 187..193
vdr/didnuts/didstore/merge.go on lines 195..201
vdr/didnuts/didstore/merge.go on lines 203..209

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

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

func verificationMethodSort(result *did.Document) less {
    return func(i, j int) bool {
        is := result.VerificationMethod[i].ID.String()
        js := result.VerificationMethod[j].ID.String()
        return strings.Compare(is, js) == -1
Severity: Major
Found in vdr/didnuts/didstore/merge.go and 6 other locations - About 45 mins to fix
vdr/didnuts/didstore/merge.go on lines 163..169
vdr/didnuts/didstore/merge.go on lines 171..177
vdr/didnuts/didstore/merge.go on lines 179..185
vdr/didnuts/didstore/merge.go on lines 187..193
vdr/didnuts/didstore/merge.go on lines 195..201
vdr/didnuts/didstore/merge.go on lines 203..209

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

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