aergoio/aergo

View on GitHub
rpc/web3/v1.go

Summary

Maintainability
F
1 wk
Test Coverage

File v1.go has 1065 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package web3

import (
    "bytes"
    "crypto/sha256"
Severity: Major
Found in rpc/web3/v1.go - About 1 day to fix

    Web3APIv1 has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type Web3APIv1 struct {
        rpc     *rpc.AergoRPCService
        request *http.Request
    
        handlerMap map[string]map[string]APIHandler
    Severity: Minor
    Found in rpc/web3/v1.go - About 4 hrs to fix

      Method Web3APIv1.ListEvents has 64 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (api *Web3APIv1) ListEvents() (handler http.Handler, ok bool) {
          values, err := url.ParseQuery(api.request.URL.RawQuery)
          if err != nil {
              return commonResponseHandler(&types.Empty{}, err), true
          }
      Severity: Minor
      Found in rpc/web3/v1.go - About 1 hr to fix

        Method Web3APIv1.GetReceipts has 61 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (api *Web3APIv1) GetReceipts() (handler http.Handler, ok bool) {
            values, err := url.ParseQuery(api.request.URL.RawQuery)
            if err != nil {
                return commonResponseHandler(&types.Empty{}, err), true
            }
        Severity: Minor
        Found in rpc/web3/v1.go - About 1 hr to fix

          Method Web3APIv1.GetVotes has 55 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (api *Web3APIv1) GetVotes() (handler http.Handler, ok bool) {
              values, err := url.ParseQuery(api.request.URL.RawQuery)
              if err != nil {
                  return commonResponseHandler(&types.Empty{}, err), true
              }
          Severity: Minor
          Found in rpc/web3/v1.go - About 1 hr to fix

            Method Web3APIv1.ListBlockHeaders has 55 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (api *Web3APIv1) ListBlockHeaders() (handler http.Handler, ok bool) {
                values, err := url.ParseQuery(api.request.URL.RawQuery)
                if err != nil {
                    return commonResponseHandler(&types.Empty{}, err), true
                }
            Severity: Minor
            Found in rpc/web3/v1.go - About 1 hr to fix

              Method Web3APIv1.GetState has 54 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (api *Web3APIv1) GetState() (handler http.Handler, ok bool) {
                  values, err := url.ParseQuery(api.request.URL.RawQuery)
                  if err != nil {
                      return commonResponseHandler(&types.Empty{}, err), true
                  }
              Severity: Minor
              Found in rpc/web3/v1.go - About 1 hr to fix

                Method Web3APIv1.GetReceipts has 9 return statements (exceeds 4 allowed).
                Open

                func (api *Web3APIv1) GetReceipts() (handler http.Handler, ok bool) {
                    values, err := url.ParseQuery(api.request.URL.RawQuery)
                    if err != nil {
                        return commonResponseHandler(&types.Empty{}, err), true
                    }
                Severity: Major
                Found in rpc/web3/v1.go - About 55 mins to fix

                  Method Web3APIv1.ListBlockHeaders has 9 return statements (exceeds 4 allowed).
                  Open

                  func (api *Web3APIv1) ListBlockHeaders() (handler http.Handler, ok bool) {
                      values, err := url.ParseQuery(api.request.URL.RawQuery)
                      if err != nil {
                          return commonResponseHandler(&types.Empty{}, err), true
                      }
                  Severity: Major
                  Found in rpc/web3/v1.go - About 55 mins to fix

                    Method Web3APIv1.ListEvents has 8 return statements (exceeds 4 allowed).
                    Open

                    func (api *Web3APIv1) ListEvents() (handler http.Handler, ok bool) {
                        values, err := url.ParseQuery(api.request.URL.RawQuery)
                        if err != nil {
                            return commonResponseHandler(&types.Empty{}, err), true
                        }
                    Severity: Major
                    Found in rpc/web3/v1.go - About 50 mins to fix

                      Method Web3APIv1.GetVotes has 7 return statements (exceeds 4 allowed).
                      Open

                      func (api *Web3APIv1) GetVotes() (handler http.Handler, ok bool) {
                          values, err := url.ParseQuery(api.request.URL.RawQuery)
                          if err != nil {
                              return commonResponseHandler(&types.Empty{}, err), true
                          }
                      Severity: Major
                      Found in rpc/web3/v1.go - About 45 mins to fix

                        Method Web3APIv1.GetBlockBody has 7 return statements (exceeds 4 allowed).
                        Open

                        func (api *Web3APIv1) GetBlockBody() (handler http.Handler, ok bool) {
                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                            if err != nil {
                                return commonResponseHandler(&types.Empty{}, err), true
                            }
                        Severity: Major
                        Found in rpc/web3/v1.go - About 45 mins to fix

                          Method Web3APIv1.ListEvents has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (api *Web3APIv1) ListEvents() (handler http.Handler, ok bool) {
                              values, err := url.ParseQuery(api.request.URL.RawQuery)
                              if err != nil {
                                  return commonResponseHandler(&types.Empty{}, err), true
                              }
                          Severity: Minor
                          Found in rpc/web3/v1.go - About 45 mins 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 Web3APIv1.ListBlockMetadata has 7 return statements (exceeds 4 allowed).
                          Open

                          func (api *Web3APIv1) ListBlockMetadata() (handler http.Handler, ok bool) {
                              values, err := url.ParseQuery(api.request.URL.RawQuery)
                              if err != nil {
                                  return commonResponseHandler(&types.Empty{}, err), true
                              }
                          Severity: Major
                          Found in rpc/web3/v1.go - About 45 mins to fix

                            Method Web3APIv1.GetStateAndProof has 6 return statements (exceeds 4 allowed).
                            Open

                            func (api *Web3APIv1) GetStateAndProof() (handler http.Handler, ok bool) {
                                values, err := url.ParseQuery(api.request.URL.RawQuery)
                                if err != nil {
                                    return commonResponseHandler(&types.Empty{}, err), true
                                }
                            Severity: Major
                            Found in rpc/web3/v1.go - About 40 mins to fix

                              Method Web3APIv1.GetNameInfo has 6 return statements (exceeds 4 allowed).
                              Open

                              func (api *Web3APIv1) GetNameInfo() (handler http.Handler, ok bool) {
                                  values, err := url.ParseQuery(api.request.URL.RawQuery)
                                  if err != nil {
                                      return commonResponseHandler(&types.Empty{}, err), true
                                  }
                              Severity: Major
                              Found in rpc/web3/v1.go - About 40 mins to fix

                                Method Web3APIv1.GetTX has 6 return statements (exceeds 4 allowed).
                                Open

                                func (api *Web3APIv1) GetTX() (handler http.Handler, ok bool) {
                                    values, err := url.ParseQuery(api.request.URL.RawQuery)
                                    if err != nil {
                                        return commonResponseHandler(&types.Empty{}, err), true
                                    }
                                Severity: Major
                                Found in rpc/web3/v1.go - About 40 mins to fix

                                  Method Web3APIv1.QueryContractState has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func (api *Web3APIv1) QueryContractState() (handler http.Handler, ok bool) {
                                      values, err := url.ParseQuery(api.request.URL.RawQuery)
                                      if err != nil {
                                          return commonResponseHandler(&types.Empty{}, err), true
                                      }
                                  Severity: Major
                                  Found in rpc/web3/v1.go - About 40 mins to fix

                                    Method Web3APIv1.QueryContract has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func (api *Web3APIv1) QueryContract() (handler http.Handler, ok bool) {
                                        values, err := url.ParseQuery(api.request.URL.RawQuery)
                                        if err != nil {
                                            return commonResponseHandler(&types.Empty{}, err), true
                                        }
                                    Severity: Major
                                    Found in rpc/web3/v1.go - About 40 mins to fix

                                      Method Web3APIv1.GetPeers has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (api *Web3APIv1) GetPeers() (handler http.Handler, ok bool) {
                                          values, err := url.ParseQuery(api.request.URL.RawQuery)
                                          if err != nil {
                                              return commonResponseHandler(&types.Empty{}, err), true
                                          }
                                      Severity: Major
                                      Found in rpc/web3/v1.go - About 35 mins to fix

                                        Method Web3APIv1.GetReceipt has 5 return statements (exceeds 4 allowed).
                                        Open

                                        func (api *Web3APIv1) GetReceipt() (handler http.Handler, ok bool) {
                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                            if err != nil {
                                                return commonResponseHandler(&types.Empty{}, err), true
                                            }
                                        Severity: Major
                                        Found in rpc/web3/v1.go - About 35 mins to fix

                                          Method Web3APIv1.GetBlockTransactionCount has 5 return statements (exceeds 4 allowed).
                                          Open

                                          func (api *Web3APIv1) GetBlockTransactionCount() (handler http.Handler, ok bool) {
                                              values, err := url.ParseQuery(api.request.URL.RawQuery)
                                              if err != nil {
                                                  return commonResponseHandler(&types.Empty{}, err), true
                                              }
                                          Severity: Major
                                          Found in rpc/web3/v1.go - About 35 mins to fix

                                            Method Web3APIv1.GetBalance has 5 return statements (exceeds 4 allowed).
                                            Open

                                            func (api *Web3APIv1) GetBalance() (handler http.Handler, ok bool) {
                                                values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                if err != nil {
                                                    return commonResponseHandler(&types.Empty{}, err), true
                                                }
                                            Severity: Major
                                            Found in rpc/web3/v1.go - About 35 mins to fix

                                              Method Web3APIv1.GetVotes has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                                              Open

                                              func (api *Web3APIv1) GetVotes() (handler http.Handler, ok bool) {
                                                  values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                  if err != nil {
                                                      return commonResponseHandler(&types.Empty{}, err), true
                                                  }
                                              Severity: Minor
                                              Found in rpc/web3/v1.go - About 35 mins 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 Web3APIv1.GetBlock has 5 return statements (exceeds 4 allowed).
                                              Open

                                              func (api *Web3APIv1) GetBlock() (handler http.Handler, ok bool) {
                                                  values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                  if err != nil {
                                                      return commonResponseHandler(&types.Empty{}, err), true
                                                  }
                                              Severity: Major
                                              Found in rpc/web3/v1.go - About 35 mins to fix

                                                Method Web3APIv1.CommitTX has 5 return statements (exceeds 4 allowed).
                                                Open

                                                func (api *Web3APIv1) CommitTX() (handler http.Handler, ok bool) {
                                                    body, err := io.ReadAll(api.request.Body)
                                                    if err != nil {
                                                        return commonResponseHandler(&types.Empty{}, err), true
                                                    }
                                                Severity: Major
                                                Found in rpc/web3/v1.go - About 35 mins to fix

                                                  Method Web3APIv1.GetBlockMetadata has 5 return statements (exceeds 4 allowed).
                                                  Open

                                                  func (api *Web3APIv1) GetBlockMetadata() (handler http.Handler, ok bool) {
                                                      values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                      if err != nil {
                                                          return commonResponseHandler(&types.Empty{}, err), true
                                                      }
                                                  Severity: Major
                                                  Found in rpc/web3/v1.go - About 35 mins to fix

                                                    Method Web3APIv1.GetState has 5 return statements (exceeds 4 allowed).
                                                    Open

                                                    func (api *Web3APIv1) GetState() (handler http.Handler, ok bool) {
                                                        values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                        if err != nil {
                                                            return commonResponseHandler(&types.Empty{}, err), true
                                                        }
                                                    Severity: Major
                                                    Found in rpc/web3/v1.go - About 35 mins to fix

                                                      Method Web3APIv1.GetAccountVotes has 5 return statements (exceeds 4 allowed).
                                                      Open

                                                      func (api *Web3APIv1) GetAccountVotes() (handler http.Handler, ok bool) {
                                                          values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                          if err != nil {
                                                              return commonResponseHandler(&types.Empty{}, err), true
                                                          }
                                                      Severity: Major
                                                      Found in rpc/web3/v1.go - About 35 mins to fix

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

                                                        func (api *Web3APIv1) GetBlock() (handler http.Handler, ok bool) {
                                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                            if err != nil {
                                                                return commonResponseHandler(&types.Empty{}, err), true
                                                            }
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 2 other locations - About 5 hrs to fix
                                                        rpc/web3/v1.go on lines 320..356
                                                        rpc/web3/v1.go on lines 515..551

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

                                                        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

                                                        func (api *Web3APIv1) GetBlockMetadata() (handler http.Handler, ok bool) {
                                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                            if err != nil {
                                                                return commonResponseHandler(&types.Empty{}, err), true
                                                            }
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 2 other locations - About 5 hrs to fix
                                                        rpc/web3/v1.go on lines 282..318
                                                        rpc/web3/v1.go on lines 320..356

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

                                                        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

                                                        func (api *Web3APIv1) GetBlockTransactionCount() (handler http.Handler, ok bool) {
                                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                            if err != nil {
                                                                return commonResponseHandler(&types.Empty{}, err), true
                                                            }
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 2 other locations - About 5 hrs to fix
                                                        rpc/web3/v1.go on lines 282..318
                                                        rpc/web3/v1.go on lines 515..551

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

                                                        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 (api *Web3APIv1) GetBalance() (handler http.Handler, ok bool) {
                                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                            if err != nil {
                                                                return commonResponseHandler(&types.Empty{}, err), true
                                                            }
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 1 other location - About 3 hrs to fix
                                                        rpc/web3/v1.go on lines 930..955

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

                                                        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 (api *Web3APIv1) GetAccountVotes() (handler http.Handler, ok bool) {
                                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                            if err != nil {
                                                                return commonResponseHandler(&types.Empty{}, err), true
                                                            }
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 1 other location - About 3 hrs to fix
                                                        rpc/web3/v1.go on lines 255..280

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

                                                        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 (api *Web3APIv1) GetABI() (handler http.Handler, ok bool) {
                                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                            if err != nil {
                                                                return commonResponseHandler(&types.Empty{}, err), true
                                                            }
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 1 other location - About 3 hrs to fix
                                                        rpc/web3/v1.go on lines 1108..1131

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

                                                        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 (api *Web3APIv1) GetStaking() (handler http.Handler, ok bool) {
                                                            values, err := url.ParseQuery(api.request.URL.RawQuery)
                                                            if err != nil {
                                                                return commonResponseHandler(&types.Empty{}, err), true
                                                            }
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 1 other location - About 3 hrs to fix
                                                        rpc/web3/v1.go on lines 904..928

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

                                                        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

                                                        func (api *Web3APIv1) ChainStat() (handler http.Handler, ok bool) {
                                                            request := &types.Empty{}
                                                        
                                                            result, err := api.rpc.ChainStat(api.request.Context(), request)
                                                            if err != nil {
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 2 other locations - About 1 hr to fix
                                                        rpc/web3/v1.go on lines 608..618
                                                        rpc/web3/v1.go on lines 632..642

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

                                                        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

                                                        func (api *Web3APIv1) GetChainInfo() (handler http.Handler, ok bool) {
                                                            request := &types.Empty{}
                                                        
                                                            result, err := api.rpc.GetChainInfo(api.request.Context(), request)
                                                            if err != nil {
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 2 other locations - About 1 hr to fix
                                                        rpc/web3/v1.go on lines 620..630
                                                        rpc/web3/v1.go on lines 632..642

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

                                                        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

                                                        func (api *Web3APIv1) GetConsensusInfo() (handler http.Handler, ok bool) {
                                                            request := &types.Empty{}
                                                        
                                                            result, err := api.rpc.GetConsensusInfo(api.request.Context(), request)
                                                            if err != nil {
                                                        Severity: Major
                                                        Found in rpc/web3/v1.go and 2 other locations - About 1 hr to fix
                                                        rpc/web3/v1.go on lines 608..618
                                                        rpc/web3/v1.go on lines 620..630

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

                                                        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

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

                                                            if size != "" {
                                                                sizeValue, parseErr := strconv.ParseUint(size, 10, 64)
                                                                if parseErr != nil {
                                                                    return commonResponseHandler(&types.Empty{}, parseErr), true
                                                        
                                                        
                                                        Severity: Minor
                                                        Found in rpc/web3/v1.go and 1 other location - About 30 mins to fix
                                                        rpc/web3/v1.go on lines 701..711

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

                                                        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

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

                                                            if size != "" {
                                                                sizeValue, parseErr := strconv.ParseUint(size, 10, 64)
                                                                if parseErr != nil {
                                                                    return commonResponseHandler(&types.Empty{}, parseErr), true
                                                        
                                                        
                                                        Severity: Minor
                                                        Found in rpc/web3/v1.go and 1 other location - About 30 mins to fix
                                                        rpc/web3/v1.go on lines 419..429

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

                                                        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