vorteil/vorteil

View on GitHub
pkg/vkern/cli.go

Summary

Maintainability
C
1 day
Test Coverage

Method CLIRemoteManager.get has 115 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (mgr *CLIRemoteManager) get(version CalVer) error {

    prog := mgr.log.NewProgress(fmt.Sprintf("Fetching kernel: %s", version.String()), "", 0)
    defer prog.Finish(false)

Severity: Major
Found in pkg/vkern/cli.go - About 3 hrs to fix

    Method CLIRemoteManager.get has 17 return statements (exceeds 4 allowed).
    Open

    func (mgr *CLIRemoteManager) get(version CalVer) error {
    
        prog := mgr.log.NewProgress(fmt.Sprintf("Fetching kernel: %s", version.String()), "", 0)
        defer prog.Finish(false)
    
    
    Severity: Major
    Found in pkg/vkern/cli.go - About 1 hr to fix

      Method CLIRemoteManager.get has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
      Open

      func (mgr *CLIRemoteManager) get(version CalVer) error {
      
          prog := mgr.log.NewProgress(fmt.Sprintf("Fetching kernel: %s", version.String()), "", 0)
          defer prog.Finish(false)
      
      
      Severity: Minor
      Found in pkg/vkern/cli.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 CLIRemoteManager.updateList has 57 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (mgr *CLIRemoteManager) updateList(ctx context.Context) (List, error) {
          var list List
          list = mgr.cache
      
          // request remote manifest
      Severity: Minor
      Found in pkg/vkern/cli.go - About 1 hr to fix

        Method CLIRemoteManager.Get has 11 return statements (exceeds 4 allowed).
        Open

        func (mgr *CLIRemoteManager) Get(ctx context.Context, version CalVer) (*ManagedBundle, error) {
        
            list, err := mgr.List(ctx)
            if err != nil {
                return nil, err
        Severity: Major
        Found in pkg/vkern/cli.go - About 1 hr to fix

          Method CLIRemoteManager.updateList has 5 return statements (exceeds 4 allowed).
          Open

          func (mgr *CLIRemoteManager) updateList(ctx context.Context) (List, error) {
              var list List
              list = mgr.cache
          
              // request remote manifest
          Severity: Major
          Found in pkg/vkern/cli.go - About 35 mins to fix

            Method CLIRemoteManager.forceUpdate has 5 return statements (exceeds 4 allowed).
            Open

            func (mgr *CLIRemoteManager) forceUpdate(ctx context.Context) error {
            
                err := ctx.Err()
                if err != nil {
                    return err
            Severity: Major
            Found in pkg/vkern/cli.go - About 35 mins to fix

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

              func NewCLIRemoteManager(url, dir string, logger elog.View) (*CLIRemoteManager, error) {
                  mgr := new(CLIRemoteManager)
                  mgr.log = logger
                  mgr.url = url
                  mgr.dir = dir
              Severity: Major
              Found in pkg/vkern/cli.go - About 35 mins to fix

                exported type CLIRemoteManager should have comment or be unexported
                Open

                type CLIRemoteManager struct {
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                exported function NewCLIRemoteManager should have comment or be unexported
                Open

                func NewCLIRemoteManager(url, dir string, logger elog.View) (*CLIRemoteManager, error) {
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                exported method CLIRemoteManager.List should have comment or be unexported
                Open

                func (mgr *CLIRemoteManager) List(ctx context.Context) (List, error) {
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                exported function CLI should have comment or be unexported
                Open

                func CLI(args CLIArgs, logger elog.View) (Manager, error) {
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                exported var CLIUpdateInterval should have comment or be unexported
                Open

                var CLIUpdateInterval time.Duration = time.Hour * 24
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                exported method CLIRemoteManager.Latest should have comment or be unexported
                Open

                func (mgr *CLIRemoteManager) Latest() (out string, err error) {
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                exported method CLIRemoteManager.Get should have comment or be unexported
                Open

                func (mgr *CLIRemoteManager) Get(ctx context.Context, version CalVer) (*ManagedBundle, error) {
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                exported type CLIArgs should have comment or be unexported
                Open

                type CLIArgs struct {
                Severity: Minor
                Found in pkg/vkern/cli.go by golint

                There are no issues that match your filters.

                Category
                Status