ecadlabs/signatory

View on GitHub

Showing 91 of 102 total issues

Method Config.GetPrivateKey has 5 return statements (exceeds 4 allowed).
Open

func (conf *Config) GetPrivateKey() (crypt.PrivateKey, error) {
    var keyData []byte
    if conf.PrivateKey != "" {
        if priv, err := crypt.ParsePrivateKey([]byte(conf.PrivateKey)); err == nil {
            return priv, nil
Severity: Major
Found in cmd/approve-list-svc/config.go - About 35 mins to fix

    Method tcpRoundTripper.Exchange has 5 return statements (exceeds 4 allowed).
    Open

    func (t *tcpRoundTripper) Exchange(req *APDUCommand) (*APDUResponse, error) {
        data := req.Bytes()
        //log.Printf("> %s", hex.EncodeToString(data))
    
        buf := make([]byte, len(data)+4)
    Severity: Major
    Found in pkg/vault/ledger/ledger/tcp.go - About 35 mins to fix

      Function parsePrivateKey has 5 return statements (exceeds 4 allowed).
      Open

      func parsePrivateKey(name, password string) (pk interface{}, err error) {
          buf, err := ioutil.ReadFile(name)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in pkg/vault/azure/auth/auth.go - About 35 mins to fix

        Method scanner.open has 5 return statements (exceeds 4 allowed).
        Open

        func (s *scanner) open(id string) (*tezosapp.App, error) {
            s.mtx.Lock()
            defer s.mtx.Unlock()
        
            devs, err := s.tr.Enumerate()
        Severity: Major
        Found in pkg/vault/ledger/scan.go - About 35 mins to fix

          Method JWTMiddleware.LoginHandler has 5 return statements (exceeds 4 allowed).
          Open

          func (m *JWTMiddleware) LoginHandler(w http.ResponseWriter, r *http.Request) {
              user := r.Header.Get("username")
              pass := r.Header.Get("password")
              if user == "" || pass == "" {
                  w.WriteHeader(http.StatusUnauthorized)
          Severity: Major
          Found in pkg/middlewares/jwt.go - About 35 mins to fix

            Method JWK.ecPublicKey has 5 return statements (exceeds 4 allowed).
            Open

            func (j *JWK) ecPublicKey() (k *ecdsa.PublicKey, err error) {
                var key ecdsa.PublicKey
                if key.Curve = curveByName(j.Curve); key.Curve == nil {
                    return nil, fmt.Errorf("jwk: unknown curve: %s", j.Curve)
                }
            Severity: Major
            Found in pkg/vault/azure/jwk/jwk.go - About 35 mins to fix

              Method Transit.GetKeyWithContext has 5 return statements (exceeds 4 allowed).
              Open

              func (t *Transit) GetKeyWithContext(ctx context.Context, keyID string) (string, error) {
                  s, err := t.c.Logical().ReadWithContext(ctx, fmt.Sprintf("%s/keys/%s", t.cfg.MountPoint, keyID))
                  if err != nil {
                      return "", err
                  }
              Severity: Major
              Found in pkg/vault/hashicorp/vault_transit.go - About 35 mins to fix

                Method awsKMSIterator.Next has 5 return statements (exceeds 4 allowed).
                Open

                func (i *awsKMSIterator) Next() (key vault.StoredKey, err error) {
                    for {
                        if i.lko == nil || i.index == len(i.lko.Keys) {
                            // get next page
                            if i.lko != nil && i.lko.NextMarker == nil {
                Severity: Major
                Found in pkg/vault/aws/awskms.go - About 35 mins to fix

                  Method Vault.Unlock has 5 return statements (exceeds 4 allowed).
                  Open

                  func (v *Vault) Unlock(ctx context.Context) error {
                      v.mtx.Lock()
                      if v.unlocked {
                          v.mtx.Unlock()
                          return nil
                  Severity: Major
                  Found in pkg/vault/memory/vault.go - About 35 mins to fix

                    Method awsKMSIterator.Next has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (i *awsKMSIterator) Next() (key vault.StoredKey, err error) {
                        for {
                            if i.lko == nil || i.index == len(i.lko.Keys) {
                                // get next page
                                if i.lko != nil && i.lko.NextMarker == nil {
                    Severity: Minor
                    Found in pkg/vault/aws/awskms.go - About 25 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

                    Function Feature has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function Feature() {
                        const { error, loading, status, subscribe, message } = useMailChimp({
                            action: `https://ecadlabs.us20.list-manage.com/subscribe/post?u=8fdd00e1ab81d5f5550fadb32&id=de1bfb4af9`,
                        });
                    
                    
                    Severity: Minor
                    Found in website/src/components/FooterForm/FooterForm.js - About 25 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

                    Severity
                    Category
                    Status
                    Source
                    Language