Showing 207 of 546 total issues
Function runFirecracker
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
func runFirecracker(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name, diskOutput string) error {
var err error
if runtime.GOOS != "linux" {
return errors.New("firecracker is only available on linux")
}
Method Virtualizer.RemoveEntry
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (v *Virtualizer) RemoveEntry() error {
env, err := os.UserHomeDir()
if err != nil {
return err
}
Function StatImageFile
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func StatImageFile(vorteilImagePath string, imageFilePath string, seekOS bool) (StatFileReport, error) {
var statOut StatFileReport
vorteilImage, err := vdecompiler.Open(vorteilImagePath)
if err != nil {
return statOut, 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 Provisioner.Provision
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *Provisioner) Provision(args *provisioners.ProvisionArgs) error {
var err error
var imageID *string
p.args = *args
Function DUImageFile
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func DUImageFile(vorteilImage *vdecompiler.IO, imageFilePath string, calcFreeSpace bool, maxDepth int, all bool) (DUImageReport, error) {
var duOut DUImageReport
var depth = 0
var recurse func(*ext.Inode, string) (int, error)
- 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 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)
Function DUImageFile
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func DUImageFile(vorteilImage *vdecompiler.IO, imageFilePath string, calcFreeSpace bool, maxDepth int, all bool) (DUImageReport, error) {
var duOut DUImageReport
var depth = 0
var recurse func(*ext.Inode, string) (int, error)
Method Provisioner.Provision
has 16 return statements (exceeds 4 allowed). Open
func (p *Provisioner) Provision(args *provisioners.ProvisionArgs) error {
var err error
// report that the 'description' flag is ignored if using this provisioner
if args.Description != "" {
Function BindPort
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func BindPort(netType, protocol, port string) (string, string, error) {
var (
bind string
netRoute string
isBound bool
Function decompileImageRecursive
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func decompileImageRecursive(vorteilImage *vdecompiler.IO, report DecompileReport, symlinkCallbacks []func() error, ino int, rpath string, dpath string) (DecompileReport, []func() error, error) {
var entries []*vdecompiler.DirectoryEntry
inode, err := vorteilImage.ResolveInode(ino)
if err != nil {
Function StatImageFile
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func StatImageFile(vorteilImagePath string, imageFilePath string, seekOS bool) (StatFileReport, error) {
var statOut StatFileReport
vorteilImage, err := vdecompiler.Open(vorteilImagePath)
if err != nil {
return statOut, err
Function main
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
defer cli.HandleErrors()
// Init FOSS COMMANDS
Method Virtualizer.Close
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (v *Virtualizer) Close(force bool) error {
v.logger.Debugf("Deleting VM")
if force && v.state != virtualizers.Ready {
err := v.ForceStop()
if err != nil {
- 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 decompileImageRecursive
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func decompileImageRecursive(vorteilImage *vdecompiler.IO, report DecompileReport, symlinkCallbacks []func() error, ino int, rpath string, dpath string) (DecompileReport, []func() error, error) {
var entries []*vdecompiler.DirectoryEntry
inode, err := vorteilImage.ResolveInode(ino)
if err != nil {
- 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 compiler.precompile
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (c *compiler) precompile(ctx context.Context) error {
var err error
// alloc group sizes
- 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 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)
- 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 runHyperV
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func runHyperV(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name, diskOutput string) error {
if runtime.GOOS != "windows" {
return errors.New("hyper-v is only available on windows system")
}
if !hyperv.Allocator.IsAvailable() {
Function GenerateVMX
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GenerateVMX(cores, memory, disk, name, dir string, numberOfNetworkCards int, networkType string, id string) string {
replace := func(in, replace, with string) string {
return strings.Replace(in, replace, with, -1)
}
Method Compiler.setPrecompileConstants
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *Compiler) setPrecompileConstants(size, minDataBlocks, minInodes, minInodesPer64 int64) error {
c.size = size
blocks := c.size / BlockSize
groups := divide(blocks, BlocksPerGroup)
Method Provisioner.Provision
has 14 return statements (exceeds 4 allowed). Open
func (p *Provisioner) Provision(args *provisioners.ProvisionArgs) error {
authHeader := fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", p.cfg.Username, p.cfg.Password))))
if args.Description != "" {
p.log.Warnf(`The 'description' field is ignored by Nutanix provision operation`)