ipfs/ipfs-cluster

View on GitHub
api/ipfsproxy/ipfsproxy.go

Summary

Maintainability
D
1 day
Test Coverage

File ipfsproxy.go has 796 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Package ipfsproxy implements the Cluster API interface by providing an
// IPFS HTTP interface as exposed by the go-ipfs daemon.
//
// In this API, select endpoints like pin*, add*, and repo* endpoints are used
// to instead perform cluster operations. Requests for any other endpoints are
Severity: Major
Found in api/ipfsproxy/ipfsproxy.go - About 1 day to fix

    Function New has 143 lines of code (exceeds 80 allowed). Consider refactoring.
    Wontfix

    func New(cfg *Config) (*Server, error) {
        err := cfg.Validate()
        if err != nil {
            return nil, err
        }
    Severity: Major
    Found in api/ipfsproxy/ipfsproxy.go - About 3 hrs to fix

      Method Server.pinLsHandler has a Cognitive Complexity of 26 (exceeds 15 allowed). Consider refactoring.
      Open

      func (proxy *Server) pinLsHandler(w http.ResponseWriter, r *http.Request) {
          proxy.setHeaders(w.Header(), r)
      
          arg := r.URL.Query().Get("arg")
      
      
      Severity: Minor
      Found in api/ipfsproxy/ipfsproxy.go - About 2 hrs 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 Server.pinLsHandler has 98 lines of code (exceeds 80 allowed). Consider refactoring.
      Open

      func (proxy *Server) pinLsHandler(w http.ResponseWriter, r *http.Request) {
          proxy.setHeaders(w.Header(), r)
      
          arg := r.URL.Query().Get("arg")
      
      
      Severity: Major
      Found in api/ipfsproxy/ipfsproxy.go - About 1 hr to fix

        Method Server.repoGCHandler has a Cognitive Complexity of 17 (exceeds 15 allowed). Consider refactoring.
        Open

        func (proxy *Server) repoGCHandler(w http.ResponseWriter, r *http.Request) {
            queryValues := r.URL.Query()
            streamErrors := queryValues.Get("stream-errors") == "true"
            // ignoring `quiet` since it only affects text output
        
        
        Severity: Minor
        Found in api/ipfsproxy/ipfsproxy.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

        BUG found
        Invalid

                //     logger.Critical("BUG: wrong use of slashHandler")
        Severity: Minor
        Found in api/ipfsproxy/ipfsproxy.go by fixme

        There are no issues that match your filters.

        Category
        Status