Showing 91 of 102 total issues
Method Config.GetPrivateKey
has 5 return statements (exceeds 4 allowed). Open
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
Method tcpRoundTripper.Exchange
has 5 return statements (exceeds 4 allowed). Open
Open
func (t *tcpRoundTripper) Exchange(req *APDUCommand) (*APDUResponse, error) {
data := req.Bytes()
//log.Printf("> %s", hex.EncodeToString(data))
buf := make([]byte, len(data)+4)
Function parsePrivateKey
has 5 return statements (exceeds 4 allowed). Open
Open
func parsePrivateKey(name, password string) (pk interface{}, err error) {
buf, err := ioutil.ReadFile(name)
if err != nil {
return nil, err
}
Method scanner.open
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *scanner) open(id string) (*tezosapp.App, error) {
s.mtx.Lock()
defer s.mtx.Unlock()
devs, err := s.tr.Enumerate()
Method JWTMiddleware.LoginHandler
has 5 return statements (exceeds 4 allowed). Open
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)
Method JWK.ecPublicKey
has 5 return statements (exceeds 4 allowed). Open
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)
}
Method Transit.GetKeyWithContext
has 5 return statements (exceeds 4 allowed). Open
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
}
Method awsKMSIterator.Next
has 5 return statements (exceeds 4 allowed). Open
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 {
Method Vault.Unlock
has 5 return statements (exceeds 4 allowed). Open
Open
func (v *Vault) Unlock(ctx context.Context) error {
v.mtx.Lock()
if v.unlocked {
v.mtx.Unlock()
return nil
Method awsKMSIterator.Next
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
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 {
- Read upRead up
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
Open
function Feature() {
const { error, loading, status, subscribe, message } = useMailChimp({
action: `https://ecadlabs.us20.list-manage.com/subscribe/post?u=8fdd00e1ab81d5f5550fadb32&id=de1bfb4af9`,
});
- Read upRead up
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"