meta/signature/type.go

Summary

Maintainability
F
4 days
Test Coverage
B
84%

File type.go has 883 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package signature

import (
    "bytes"
    "fmt"
Severity: Major
Found in meta/signature/type.go - About 1 day to fix

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

    func NewFloatType() Type {
        return &typeConstructor{
            signature:    "f",
            signatureIDL: "float32",
            typeName:     jen.Float32(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 304..320

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

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

    func NewDoubleType() Type {
        return &typeConstructor{
            signature:    "d",
            signatureIDL: "float64",
            typeName:     jen.Float64(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301

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

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

    func NewInt16Type() Type {
        return &typeConstructor{
            signature:    "w",
            signatureIDL: "int16",
            typeName:     jen.Int16(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

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

    func NewLongType() Type {
        return &typeConstructor{
            signature:    "l",
            signatureIDL: "int64",
            typeName:     jen.Int64(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

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

    func NewULongType() Type {
        return &typeConstructor{
            signature:    "L",
            signatureIDL: "uint64",
            typeName:     jen.Uint64(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

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

    func NewUint8Type() Type {
        return &typeConstructor{
            signature:    "C",
            signatureIDL: "uint8",
            typeName:     jen.Uint8(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

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

    func NewIntType() Type {
        return &typeConstructor{
            signature:    "i",
            signatureIDL: "int32",
            typeName:     jen.Int32(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

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

    func NewUintType() Type {
        return &typeConstructor{
            signature:    "I",
            signatureIDL: "uint32",
            typeName:     jen.Uint32(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

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

    func NewUint16Type() Type {
        return &typeConstructor{
            signature:    "W",
            signatureIDL: "uint16",
            typeName:     jen.Uint16(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 133..149
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

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

    func NewInt8Type() Type {
        return &typeConstructor{
            signature:    "c",
            signatureIDL: "int8",
            typeName:     jen.Int8(),
    Severity: Major
    Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
    meta/signature/type.go on lines 152..168
    meta/signature/type.go on lines 171..187
    meta/signature/type.go on lines 190..206
    meta/signature/type.go on lines 209..225
    meta/signature/type.go on lines 228..244
    meta/signature/type.go on lines 247..263
    meta/signature/type.go on lines 266..282
    meta/signature/type.go on lines 285..301
    meta/signature/type.go on lines 304..320

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

    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

    func (s *StructType) Type() reflect.Type {
        fields := make([]reflect.StructField, len(s.Members))
        var offset uintptr = 0
        for i, m := range s.Members {
            typ := m.Type.Type()
    Severity: Major
    Found in meta/signature/type.go and 1 other location - About 1 hr to fix
    meta/signature/type.go on lines 853..869

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

    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

    func (t *TupleType) Type() reflect.Type {
        fields := make([]reflect.StructField, len(t.Members))
        var offset uintptr = 0
        for i, m := range t.Members {
            typ := m.Type.Type()
    Severity: Major
    Found in meta/signature/type.go and 1 other location - About 1 hr to fix
    meta/signature/type.go on lines 1016..1032

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

    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

    func (s *StructType) Reader() TypeReader {
        readers := make([]memberReader, len(s.Members))
        for i, m := range s.Members {
            readers[i] = memberReader{
                name:   m.Name,
    Severity: Minor
    Found in meta/signature/type.go and 1 other location - About 35 mins to fix
    meta/signature/type.go on lines 841..850

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

    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

    func (t *TupleType) Reader() TypeReader {
        readers := make([]memberReader, len(t.Members))
        for i, m := range t.Members {
            readers[i] = memberReader{
                name:   m.Name,
    Severity: Minor
    Found in meta/signature/type.go and 1 other location - About 35 mins to fix
    meta/signature/type.go on lines 1004..1013

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

    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

    exported function TypeIsObjectReference should have comment or be unexported
    Open

    func TypeIsObjectReference(t Type) bool {
    Severity: Minor
    Found in meta/signature/type.go by golint

    comment on exported function NewUintType should be of the form "NewUintType ..."
    Open

    // NewUIntType is a contructor for the representation of an uint32.
    Severity: Minor
    Found in meta/signature/type.go by golint

    There are no issues that match your filters.

    Category
    Status