xmidt-org/wrp-go

View on GitHub

Showing 224 of 224 total issues

Method codecSelfer3232.decSliceSlicestring has 73 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (x codecSelfer3232) decSliceSlicestring(v *[][]string, d *codec1978.Decoder) {
    var h codecSelfer3232
    z, r := codec1978.GenHelper().Decoder(d)
    _, _, _ = h, z, r

Severity: Minor
Found in messages_codec.go - About 1 hr to fix

    Method CRUD.codecDecodeSelfFromMap has 72 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (x *CRUD) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
        var h codecSelfer3232
        z, r := codec1978.GenHelper().Decoder(d)
        _, _, _ = h, z, r
        var yyhl3 bool = l >= 0
    Severity: Minor
    Found in messages_codec.go - About 1 hr to fix

      Method SimpleRequestResponse.codecDecodeSelfFromMap has 72 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (x *SimpleRequestResponse) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
          var h codecSelfer3232
          z, r := codec1978.GenHelper().Decoder(d)
          _, _, _ = h, z, r
          var yyhl3 bool = l >= 0
      Severity: Minor
      Found in messages_codec.go - About 1 hr to fix

        Method Message.codecDecodeSelfFromArray has 19 return statements (exceeds 4 allowed).
        Open

        func (x *Message) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
            var h codecSelfer3232
            z, r := codec1978.GenHelper().Decoder(d)
            _, _, _ = h, z, r
            var yyj33 int
        Severity: Major
        Found in messages_codec.go - About 1 hr to fix

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

          func ReplaceDestinationSelfLocator(me string) NormifierOption {
              full, err := ParseLocator(me)
              if err != nil {
                  return errorOption(err)
              }
          Severity: Major
          Found in normify.go and 1 other location - About 1 hr to fix
          normify.go on lines 99..119

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

          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 ReplaceSourceSelfLocator(me string) NormifierOption {
              full, err := ParseLocator(me)
              if err != nil {
                  return errorOption(err)
              }
          Severity: Major
          Found in normify.go and 1 other location - About 1 hr to fix
          normify.go on lines 124..144

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

          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

          Function SetMessageFromHeaders has 61 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func SetMessageFromHeaders(h http.Header, m *wrp.Message) (err error) {
              defer func() {
                  if r := recover(); r != nil {
                      switch v := r.(type) {
                      case error:
          Severity: Minor
          Found in wrphttp/headers.go - About 1 hr to fix

            Method CRUD.codecDecodeSelfFromArray has 14 return statements (exceeds 4 allowed).
            Open

            func (x *CRUD) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
                var h codecSelfer3232
                z, r := codec1978.GenHelper().Decoder(d)
                _, _, _ = h, z, r
                var yyj27 int
            Severity: Major
            Found in messages_codec.go - About 1 hr to fix

              Method SimpleRequestResponse.codecDecodeSelfFromArray has 14 return statements (exceeds 4 allowed).
              Open

              func (x *SimpleRequestResponse) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
                  var h codecSelfer3232
                  z, r := codec1978.GenHelper().Decoder(d)
                  _, _, _ = h, z, r
                  var yyj27 int
              Severity: Major
              Found in messages_codec.go - About 1 hr to fix

                Method Unknown.CodecEncodeSelf has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                Open

                func (x *Unknown) CodecEncodeSelf(e *codec1978.Encoder) {
                    var h codecSelfer3232
                    z, r := codec1978.GenHelper().Encoder(e)
                    _, _, _ = h, z, r
                    if z.EncBasicHandle().CheckCircularRef {
                Severity: Minor
                Found in messages_codec.go - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method ServiceAlive.CodecEncodeSelf has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                Open

                func (x *ServiceAlive) CodecEncodeSelf(e *codec1978.Encoder) {
                    var h codecSelfer3232
                    z, r := codec1978.GenHelper().Encoder(e)
                    _, _, _ = h, z, r
                    if z.EncBasicHandle().CheckCircularRef {
                Severity: Minor
                Found in messages_codec.go - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                func NewSimpleEventTypeWithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newSimpleEventTypeErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := SimpleEventType(msg)
                Severity: Major
                Found in wrpvalidator/messageValidator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 81..92
                wrpvalidator/messageValidator.go on lines 109..120
                wrpvalidator/specValidator.go on lines 58..69
                wrpvalidator/specValidator.go on lines 72..83
                wrpvalidator/specValidator.go on lines 86..97
                wrpvalidator/specValidator.go on lines 100..111
                wrpvalidator/validator.go on lines 178..189

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

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

                func NewMessageTypeWithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newMessageTypeErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := MessageType(msg)
                Severity: Major
                Found in wrpvalidator/specValidator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 81..92
                wrpvalidator/messageValidator.go on lines 95..106
                wrpvalidator/messageValidator.go on lines 109..120
                wrpvalidator/specValidator.go on lines 58..69
                wrpvalidator/specValidator.go on lines 86..97
                wrpvalidator/specValidator.go on lines 100..111
                wrpvalidator/validator.go on lines 178..189

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

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

                func NewSpansWithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newSpansErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := Spans(msg)
                Severity: Major
                Found in wrpvalidator/messageValidator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 81..92
                wrpvalidator/messageValidator.go on lines 95..106
                wrpvalidator/specValidator.go on lines 58..69
                wrpvalidator/specValidator.go on lines 72..83
                wrpvalidator/specValidator.go on lines 86..97
                wrpvalidator/specValidator.go on lines 100..111
                wrpvalidator/validator.go on lines 178..189

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

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

                func NewSourceWithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newSourceErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := Source(msg)
                Severity: Major
                Found in wrpvalidator/specValidator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 81..92
                wrpvalidator/messageValidator.go on lines 95..106
                wrpvalidator/messageValidator.go on lines 109..120
                wrpvalidator/specValidator.go on lines 58..69
                wrpvalidator/specValidator.go on lines 72..83
                wrpvalidator/specValidator.go on lines 100..111
                wrpvalidator/validator.go on lines 178..189

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

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

                func NewSimpleResponseRequestTypeWithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newSimpleRequestResponseMessageTypeErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := SimpleResponseRequestType(msg)
                Severity: Major
                Found in wrpvalidator/messageValidator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 95..106
                wrpvalidator/messageValidator.go on lines 109..120
                wrpvalidator/specValidator.go on lines 58..69
                wrpvalidator/specValidator.go on lines 72..83
                wrpvalidator/specValidator.go on lines 86..97
                wrpvalidator/specValidator.go on lines 100..111
                wrpvalidator/validator.go on lines 178..189

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

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

                func NewDestinationWithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newDestinationErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := Destination(msg)
                Severity: Major
                Found in wrpvalidator/specValidator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 81..92
                wrpvalidator/messageValidator.go on lines 95..106
                wrpvalidator/messageValidator.go on lines 109..120
                wrpvalidator/specValidator.go on lines 58..69
                wrpvalidator/specValidator.go on lines 72..83
                wrpvalidator/specValidator.go on lines 86..97
                wrpvalidator/validator.go on lines 178..189

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

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

                func NewUTF8WithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newUTF8ErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := UTF8(msg)
                Severity: Major
                Found in wrpvalidator/specValidator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 81..92
                wrpvalidator/messageValidator.go on lines 95..106
                wrpvalidator/messageValidator.go on lines 109..120
                wrpvalidator/specValidator.go on lines 72..83
                wrpvalidator/specValidator.go on lines 86..97
                wrpvalidator/specValidator.go on lines 100..111
                wrpvalidator/validator.go on lines 178..189

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

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

                func NewAlwaysInvalidWithMetric(tf *touchstone.Factory, labelNames ...string) (ValidatorFunc, error) {
                    m, err := newAlwaysInvalidErrorTotal(tf, labelNames...)
                
                    return func(msg wrp.Message, ls prometheus.Labels) error {
                        err := AlwaysInvalid(msg)
                Severity: Major
                Found in wrpvalidator/validator.go and 7 other locations - About 1 hr to fix
                wrpvalidator/messageValidator.go on lines 81..92
                wrpvalidator/messageValidator.go on lines 95..106
                wrpvalidator/messageValidator.go on lines 109..120
                wrpvalidator/specValidator.go on lines 58..69
                wrpvalidator/specValidator.go on lines 72..83
                wrpvalidator/specValidator.go on lines 86..97
                wrpvalidator/specValidator.go on lines 100..111

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

                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

                Method SimpleEvent.codecDecodeSelfFromArray has 9 return statements (exceeds 4 allowed).
                Open

                func (x *SimpleEvent) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
                    var h codecSelfer3232
                    z, r := codec1978.GenHelper().Decoder(d)
                    _, _, _ = h, z, r
                    var yyj18 int
                Severity: Major
                Found in messages_codec.go - About 55 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language