pkg/clustermanager/cluster.go
Method Manager.InstallWorkers
has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring. Open
Open
func (manager *Manager) InstallWorkers(nodes []Node) error {
node, err := manager.clusterProvider.GetMasterNode()
if err != nil {
return err
}
- 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
Method Manager.InstallWorkers
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (manager *Manager) InstallWorkers(nodes []Node) error {
node, err := manager.clusterProvider.GetMasterNode()
if err != nil {
return err
}
Function NewClusterManager
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func NewClusterManager(provider ClusterProvider, nodeCommunicator NodeCommunicator, eventService EventService, name string, haEnabled bool, isolatedEtcd bool, cloudInitFile string) *Manager {
Method Manager.installMasterStep
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (manager *Manager) installMasterStep(node Node, numMaster int, masterNode Node, commands []NodeCommand, trueChan chan bool, errChan chan error) {
Method Manager.InstallMasters
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func (manager *Manager) InstallMasters(keepCerts KeepCerts) error {
commands := []NodeCommand{
{"sysctl settings", `printf '# Strict RPF mode as required by canal/Calico\nnet.ipv4.conf.default.rp_filter=1\nnet.ipv4.conf.all.rp_filter=1\n' >/etc/sysctl.d/50-canal-calico.conf && sysctl --load=/etc/sysctl.d/50-canal-calico.conf`},
{"kubeadm init", "kubectl version > /dev/null &> /dev/null || kubeadm init --ignore-preflight-errors=all --config /root/master-config.yaml"},
{"configure kubectl", "rm -rf $HOME/.kube && mkdir -p $HOME/.kube && cp -i /etc/kubernetes/admin.conf $HOME/.kube/config && chown $(id -u):$(id -g) $HOME/.kube/config"},
- 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
Your code does not pass gofmt in 1 place. Go fmt your code! Open
Open
package clustermanager
- Exclude checks