minishift/minishift

View on GitHub

Showing 106 of 151 total issues

File trayicon_unix.go has 2064 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// +build !windows

/*
Copyright (C) 2018 Red Hat, Inc.

Severity: Major
Found in pkg/minishift/systemtray/icon/trayicon_unix.go - About 4 days to fix

    Method RedHatRegistrator.Register has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
    Open

    func (registrator *RedHatRegistrator) Register(param *RegistrationParameters) error {
        keyringDocsLink := "https://docs.okd.io/latest/minishift/troubleshooting/troubleshooting-misc.html#Remove-password-from-keychain"
        if isRegistered, err := registrator.IsRegistered(); !isRegistered && err == nil {
            for i := 1; i < 4; i++ {
                // request username (disallow empty value)
    Severity: Minor
    Found in pkg/minishift/registration/redhat.go - About 6 hrs 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

    File start.go has 677 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    /*
    Copyright 2016 The Kubernetes Authors All rights reserved.
    
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    Severity: Minor
    Found in cmd/minishift/cmd/start.go - About 6 hrs to fix

      Function GenerateZshCompletion has 159 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func GenerateZshCompletion(out io.Writer, cmd *cobra.Command) error {
          zsh_initialization := `
      __minishift_bash_source() {
          alias shopt=':'
          alias _expand=_bash_expand
      Severity: Major
      Found in cmd/minishift/cmd/completion.go - About 5 hrs to fix

        Function serveConnections has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
        Open

        func serveConnections(listener net.Listener, serverConfig *ssh.ServerConfig) {
            for {
                nConn, err := listener.Accept()
                if err != nil {
                    glog.Fatal("failed to accept incoming connection", err)
        Severity: Minor
        Found in cmd/minishift/cmd/daemon/sftpd.go - About 5 hrs 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

        Function runStart has 131 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func runStart(cmd *cobra.Command, args []string) {
            fmt.Println(fmt.Sprintf("-- Starting profile '%s'", constants.ProfileName))
        
            libMachineClient := libmachine.NewClient(state.InstanceDirs.Home, state.InstanceDirs.Certs)
            defer libMachineClient.Close()
        Severity: Major
        Found in cmd/minishift/cmd/start.go - About 4 hrs to fix

          Function DownloadOpenShiftReleaseBinary has 126 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func DownloadOpenShiftReleaseBinary(binaryType OpenShiftBinaryType, osType minishiftos.OS, version, outputPath string) error {
              client := Client()
              ctx := context.Background()
              var (
                  err     error
          Severity: Major
          Found in pkg/util/github/github.go - About 4 hrs to fix

            Function preflightChecksBeforeStartingHost has 119 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func preflightChecksBeforeStartingHost() {
                if shouldPreflightChecksBeSkipped() {
                    return
                }
                driverErrorMessage := "See the 'Setting Up the Virtualization Environment' topic (https://docs.okd.io/latest/minishift/getting-started/setting-up-virtualization-environment.html) for more information"
            Severity: Major
            Found in cmd/minishift/cmd/start_preflight.go - About 3 hrs to fix

              Function runStart has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
              Open

              func runStart(cmd *cobra.Command, args []string) {
                  fmt.Println(fmt.Sprintf("-- Starting profile '%s'", constants.ProfileName))
              
                  libMachineClient := libmachine.NewClient(state.InstanceDirs.Home, state.InstanceDirs.Certs)
                  defer libMachineClient.Close()
              Severity: Minor
              Found in cmd/minishift/cmd/start.go - About 3 hrs 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

              Function file_passes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              def file_passes(filename, refs, regexs):
                  try:
                      f = open(filename, 'r')
                  except:
                      return False
              Severity: Minor
              Found in scripts/boilerplate/boilerplate.py - About 2 hrs 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

              Function DownloadOpenShiftReleaseBinary has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
              Open

              func DownloadOpenShiftReleaseBinary(binaryType OpenShiftBinaryType, osType minishiftos.OS, version, outputPath string) error {
                  client := Client()
                  ctx := context.Background()
                  var (
                      err     error
              Severity: Minor
              Found in pkg/util/github/github.go - About 2 hrs 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

              Function get_files has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_files(extensions):
                  files = []
                  if len(args.filenames) > 0:
                      files = args.filenames
                  else:
              Severity: Minor
              Found in scripts/boilerplate/boilerplate.py - About 2 hrs 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 RedHatRegistrator.Register has 82 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (registrator *RedHatRegistrator) Register(param *RegistrationParameters) error {
                  keyringDocsLink := "https://docs.okd.io/latest/minishift/troubleshooting/troubleshooting-misc.html#Remove-password-from-keychain"
                  if isRegistered, err := registrator.IsRegistered(); !isRegistered && err == nil {
                      for i := 1; i < 4; i++ {
                          // request username (disallow empty value)
              Severity: Major
              Found in pkg/minishift/registration/redhat.go - About 2 hrs to fix

                File start_preflight.go has 510 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                /*
                Copyright (C) 2017 Red Hat, Inc.
                
                Licensed under the Apache License, Version 2.0 (the "License");
                you may not use this file except in compliance with the License.
                Severity: Minor
                Found in cmd/minishift/cmd/start_preflight.go - About 2 hrs to fix

                  File testdata.go has 507 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  /*
                  Copyright (C) 2017 Red Hat, Inc.
                  
                  Licensed under the Apache License, Version 2.0 (the "License");
                  you may not use this file except in compliance with the License.
                  Severity: Minor
                  Found in pkg/testing/testdata/testdata.go - About 2 hrs to fix

                    Method navigation_menu has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def navigation_menu
                        navigation = ""
                        topic_map = YAML.load_file('build/_topic_map.yml')
                        topic_map["Topics"].each_with_index do |topic, index|
                          topic_directory = topic["Dir"]
                    Severity: Minor
                    Found in docs/helpers/custom_helpers.rb - 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

                    Function DownloadOpenShiftReleaseBinary has 20 return statements (exceeds 4 allowed).
                    Open

                    func DownloadOpenShiftReleaseBinary(binaryType OpenShiftBinaryType, osType minishiftos.OS, version, outputPath string) error {
                        client := Client()
                        ctx := context.Background()
                        var (
                            err     error
                    Severity: Major
                    Found in pkg/util/github/github.go - About 1 hr to fix

                      Function compareComponentVersions has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func compareComponentVersions(currentVersion, requiredVersion string, componentName string, versionRange string) error {
                          if strings.HasPrefix(requiredVersion, ">=") {
                              currentVersion, err := semver.Make(currentVersion)
                              if err != nil {
                                  return err
                      Severity: Minor
                      Found in pkg/minishift/addon/manager/addon_manager.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 navigation_menu has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def navigation_menu
                          navigation = ""
                          topic_map = YAML.load_file('build/_topic_map.yml')
                          topic_map["Topics"].each_with_index do |topic, index|
                            topic_directory = topic["Dir"]
                      Severity: Minor
                      Found in docs/helpers/custom_helpers.rb - About 1 hr to fix

                        Function compareComponentVersions has 18 return statements (exceeds 4 allowed).
                        Open

                        func compareComponentVersions(currentVersion, requiredVersion string, componentName string, versionRange string) error {
                            if strings.HasPrefix(requiredVersion, ">=") {
                                currentVersion, err := semver.Make(currentVersion)
                                if err != nil {
                                    return err
                        Severity: Major
                        Found in pkg/minishift/addon/manager/addon_manager.go - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language