cogolabs/fleet2kubes

View on GitHub
pkg/unit/mflag.go

Summary

Maintainability
A
2 hrs
Test Coverage

Method FlagSet.Parse has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

func (f *FlagSet) Parse(arguments []string) error {
    f.parsed = true
    f.args = arguments
    f.actual = map[string]string{}
    f.env = map[string]string{}
Severity: Minor
Found in pkg/unit/mflag.go - About 1 hr 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 FlagSet.parseOne has 5 return statements (exceeds 4 allowed).
Open

func (f *FlagSet) parseOne() (bool, string, error) {
    if len(f.args) == 0 {
        return false, "", nil
    }
    s := f.args[0]
Severity: Major
Found in pkg/unit/mflag.go - About 35 mins to fix

    exported method FlagSet.Env should have comment or be unexported
    Open

    func (f *FlagSet) Env() map[string]string {
    Severity: Minor
    Found in pkg/unit/mflag.go by golint

    exported type FlagSet should have comment or be unexported
    Open

    type FlagSet struct {
    Severity: Minor
    Found in pkg/unit/mflag.go by golint

    don't use underscores in Go names; var has_value should be hasValue
    Open

        has_value := false
    Severity: Minor
    Found in pkg/unit/mflag.go by golint

    exported method FlagSet.Values should have comment or be unexported
    Open

    func (f *FlagSet) Values() map[string]string {
    Severity: Minor
    Found in pkg/unit/mflag.go by golint

    exported method FlagSet.Args should have comment or be unexported
    Open

    func (f *FlagSet) Args() []string {
    Severity: Minor
    Found in pkg/unit/mflag.go by golint

    There are no issues that match your filters.

    Category
    Status