pkg/util/volume.go
Function GetVolume
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func GetVolume(ctx context.Context, f util.Factory, ns, podName string) (map[string][]mount.Mount, error) {
clientSet, err := f.KubernetesClientSet()
if err != nil {
return nil, err
}
Function GetVolume
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func GetVolume(ctx context.Context, f util.Factory, ns, podName string) (map[string][]mount.Mount, error) {
clientSet, err := f.KubernetesClientSet()
if err != nil {
return nil, 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
Function CreateFolder
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func CreateFolder(ctx context.Context, cli *client.Client, id string, src string, target string) (string, error) {
Function GetVolume
has 5 return statements (exceeds 4 allowed). Open
Open
func GetVolume(ctx context.Context, f util.Factory, ns, podName string) (map[string][]mount.Mount, error) {
clientSet, err := f.KubernetesClientSet()
if err != nil {
return nil, err
}
Function CreateFolder
has 5 return statements (exceeds 4 allowed). Open
Open
func CreateFolder(ctx context.Context, cli *client.Client, id string, src string, target string) (string, error) {
lstat, err := os.Lstat(src)
if err != nil {
return "", err
}
Function CopyVolumeIntoContainer
has 5 return statements (exceeds 4 allowed). Open
Open
func CopyVolumeIntoContainer(ctx context.Context, volume []mount.Mount, cli *client.Client, id string) error {
// copy volume into container
for _, v := range volume {
target, err := CreateFolder(ctx, cli, id, v.Source, v.Target)
if err != nil {