Showing 102 of 102 total issues
Avoid deeply nested control flow statements. Open
Open
if err != nil {
if attempt == 1 {
r.err <- err
} else {
attempt = attempt + 1
Avoid deeply nested control flow statements. Open
Open
if u == "" {
a.done = true
return nil, vault.ErrDone
}
Avoid deeply nested control flow statements. Open
Open
if err != nil {
return nil, fmt.Errorf("(Azure/%s): %w", a.v.config.Vault, err)
}
Method Server.authenticateSignRequest
has 7 return statements (exceeds 4 allowed). Open
Open
func (s *Server) authenticateSignRequest(req *signatory.SignRequest, r *http.Request) error {
v := r.FormValue("authentication")
if v == "" {
return errors.Wrap(stderr.New("missing authentication signature field"), http.StatusUnauthorized)
}
Avoid deeply nested control flow statements. Open
Open
if status != 0 {
err = errors.Wrap(err, status)
}
Method usbHIDRoundTripper.readCommand
has 6 return statements (exceeds 4 allowed). Open
Open
func (u *usbHIDRoundTripper) readCommand() (channel uint16, cmd uint8, data []byte, err error) {
var (
dataLen int
idx uint16
)
Method cloudKMSIterator.Next
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *cloudKMSIterator) Next() (vault.StoredKey, error) {
if c.keyIter == nil {
return nil, vault.ErrDone
}
Method usbHIDRoundTripper.Exchange
has 6 return statements (exceeds 4 allowed). Open
Open
func (u *usbHIDRoundTripper) Exchange(req *APDUCommand) (*APDUResponse, error) {
//fmt.Printf("%#v\n", req)
r := req.Bytes()
if err := u.writeCommand(cmdAPDU, r); err != nil {
return nil, err
Function parseKeyID
has 6 return statements (exceeds 4 allowed). Open
Open
func parseKeyID(s string) (*keyID, error) {
p := strings.SplitN(s, "/", 2)
if len(p) != 2 {
return nil, fmt.Errorf("error parsing key id: %s", s)
}
Method Config.jwtTokenSource
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *Config) jwtTokenSource(ctx context.Context, scopes []string) (oauth2.TokenSource, error) {
var (
pk interface{}
thumbprint []byte
err error
Method Server.signHandler
has 6 return statements (exceeds 4 allowed). Open
Open
func (s *Server) signHandler(w http.ResponseWriter, r *http.Request) {
pkh, err := b58.ParsePublicKeyHash([]byte(mux.Vars(r)["key"]))
if err != nil {
tezosJSONError(w, errors.Wrap(err, http.StatusBadRequest))
return
Function wrapPrivateKey
has 6 return statements (exceeds 4 allowed). Open
Open
func wrapPrivateKey(pubKey *rsa.PublicKey, priv crypt.PrivateKey) ([]byte, error) {
pkcs8Key, err := cryptoutils.MarshalPKCS8PrivateKey(priv)
if err != nil {
return nil, err
}
Function SetupBaking
has 6 return statements (exceeds 4 allowed). Open
Open
func SetupBaking(transport string, id, keyID, chainID string, mainHWM, testHWM uint32) (pkh string, err error) {
var hwm tezosapp.HWM
if chainID != "" {
cid, err := b58.ParseChainID([]byte(chainID))
if err != nil {
Function validateSecretAndPass
has 6 return statements (exceeds 4 allowed). Open
Open
func validateSecretAndPass(secret []string) error {
var length int = 16
var stype string = "password"
for _, s := range secret {
// Check length
Function fetchToken
has 6 return statements (exceeds 4 allowed). Open
Open
func fetchToken(ctx context.Context, url string, v url.Values) (*oauth2.Token, error) {
client := oauth2.NewClient(ctx, nil)
resp, err := client.PostForm(url, v)
if err != nil {
return nil, fmt.Errorf("auth: cannot fetch token: %w", err)
Function init
has 6 return statements (exceeds 4 allowed). Open
Open
func init() {
vault.RegisterVault("file", func(ctx context.Context, node *yaml.Node) (vault.Vault, error) {
var conf cfg
if node == nil || node.Kind == 0 {
return nil, errors.New("(File): config is missing")
Method Signatory.Import
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (s *Signatory) Import(ctx context.Context, importerName string, secretKey string, passCB func() ([]byte, error), opt utils.Options) (*PublicKey, error) {
Method Vault.request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (v *Vault) request(ctx context.Context, client *http.Client, method, url string, body io.Reader, result interface{}) (status int, err error) {
Method Vault.GetPublicKey
has 5 return statements (exceeds 4 allowed). Open
Open
func (v *Vault) GetPublicKey(ctx context.Context, keyID string) (vault.StoredKey, error) {
u, err := v.makeURL(keyID, "")
if err != nil {
return nil, fmt.Errorf("(Azure/%s): %w", v.config.Vault, err)
}
Method scanner.openPath
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *scanner) openPath(path string) (app *tezosapp.App, dev *deviceInfo, err error) {
ex, err := s.tr.Open(path)
if err != nil {
return nil, nil, err
}