antonmarin/secret-yaml

View on GitHub

Showing 23 of 31 total issues

Method YamlManipulator.ApplyToLeafs has 11 return statements (exceeds 4 allowed).
Open

func (manipulator YamlManipulator) ApplyToLeafs(callback func([]byte) ([]byte, error), data interface{}) (interface{}, error) {
    switch data.(type) {
    case yaml.MapSlice:
        result := make(yaml.MapSlice, len(data.(yaml.MapSlice)))
        for ind, elm := range data.(yaml.MapSlice) {
Severity: Major
Found in document/yamlManipulator.go - About 1 hr to fix

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

    func (manipulator YamlManipulator) ApplyToLeafs(callback func([]byte) ([]byte, error), data interface{}) (interface{}, error) {
        switch data.(type) {
        case yaml.MapSlice:
            result := make(yaml.MapSlice, len(data.(yaml.MapSlice)))
            for ind, elm := range data.(yaml.MapSlice) {
    Severity: Minor
    Found in document/yamlManipulator.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

    Your code does not pass gofmt in 3 places. Go fmt your code!
    Open

    package aes
    Severity: Minor
    Found in encryption/aes/aes.go by gofmt

    Your code does not pass gofmt in 2 places. Go fmt your code!
    Open

    package dummy
    Severity: Minor
    Found in encryption/dummy/dummy.go by gofmt

    Your code does not pass gofmt in 2 places. Go fmt your code!
    Open

    package encrypt
    Severity: Minor
    Found in useCases/encrypt/Encrypt.go by gofmt

    Your code does not pass gofmt in 1 place. Go fmt your code!
    Open

    package document
    Severity: Minor
    Found in document/yamlManipulator.go by gofmt

    Your code does not pass gofmt in 1 place. Go fmt your code!
    Open

    package io
    Severity: Minor
    Found in io/file.go by gofmt

    exported func NewDecrypt returns unexported type *decrypt.decrypt, which can be annoying to use
    Confirmed

    func NewDecrypt(encryptionService DecryptionService, documentManipulator YamlManipulator) *decrypt {
    Severity: Minor
    Found in useCases/decrypt/Decrypt.go by golint

    don't use MixedCaps in package name; generateSecretKey should be generatesecretkey
    Open

    package generateSecretKey

    exported function NewGenerateSecretKey should have comment or be unexported
    Open

    func NewGenerateSecretKey(generator SecretKeyGenerator) *generateSecretKey {

    exported type SecretKeyGenerator should have comment or be unexported
    Open

    type SecretKeyGenerator interface {

    comment on exported type YamlManipulator should be of the form "YamlManipulator ..." (with optional leading article)
    Open

    //data types: yaml.MapSlice, yaml.MapItem, and Exact value
    Severity: Minor
    Found in useCases/decrypt/Decrypt.go by golint

    exported type EncryptionService should have comment or be unexported
    Open

    type EncryptionService interface {
    Severity: Minor
    Found in useCases/encrypt/Encrypt.go by golint

    exported func NewFile returns unexported type *io.file, which can be annoying to use
    Confirmed

    func NewFile(path string) *file {
    Severity: Minor
    Found in io/file.go by golint

    exported type CryptoGeneratorService should have comment or be unexported
    Open

    type CryptoGeneratorService struct {
    Severity: Minor
    Found in random/crypto.go by golint

    2: cannot find package "github.com/antonmarin/secret-yaml/document" in any of:
    Open

        "github.com/antonmarin/secret-yaml/document"
    Severity: Minor
    Found in cmd/decrypt.go by govet

    exported type DecryptionService should have comment or be unexported
    Open

    type DecryptionService interface {
    Severity: Minor
    Found in useCases/decrypt/Decrypt.go by golint

    exported func NewGenerateSecretKey returns unexported type *generateSecretKey.generateSecretKey, which can be annoying to use
    Open

    func NewGenerateSecretKey(generator SecretKeyGenerator) *generateSecretKey {

    Your code does not pass gofmt in 1 place. Go fmt your code!
    Open

    package decrypt
    Severity: Minor
    Found in useCases/decrypt/Decrypt.go by gofmt

    exported method CryptoGeneratorService.GenerateSecretKey should have comment or be unexported
    Open

    func (service CryptoGeneratorService) GenerateSecretKey() ([]byte, error) {
    Severity: Minor
    Found in random/crypto.go by golint
    Severity
    Category
    Status
    Source
    Language