Showing 207 of 546 total issues
Function blockType
has 10 return statements (exceeds 4 allowed). Open
Open
func blockType(i int64) int {
var p, a, b int64
p = BlockSize / pointerSize
Function runHyperV
has 10 return statements (exceeds 4 allowed). Open
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() {
Method SparseWriter.writeGrainData
has 10 return statements (exceeds 4 allowed). Open
Open
func (w *SparseWriter) writeGrainData() error {
var err error
firstDataSector := int64(w.hdr.OverHead) * SectorsPerGrain
Method Bundle.Reader
has 10 return statements (exceeds 4 allowed). Open
Open
func (bundle *Bundle) Reader(tags ...string) io.ReadCloser {
pr, pw := io.Pipe()
go func(pw *io.PipeWriter) {
Function runVirtualBox
has 9 return statements (exceeds 4 allowed). Open
Open
func runVirtualBox(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name, diskOutput string) error {
if !virtualbox.Allocator.IsAvailable() {
return errors.New("virtualbox not found installed on system")
}
// Create base folder to store virtualbox vms so the socket can be grouped
Function runQEMU
has 9 return statements (exceeds 4 allowed). Open
Open
func runQEMU(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name string, diskOutput string) error {
if !qemu.Allocator.IsAvailable() {
return errors.New("qemu not installed on system")
}
Method Virtualizer.Close
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
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 LazyOpen
has 9 return statements (exceeds 4 allowed). Open
Open
func LazyOpen(path string) (File, error) {
fi, err := os.Lstat(path)
if err != nil {
return nil, err
Function runVMware
has 9 return statements (exceeds 4 allowed). Open
Open
func runVMware(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name, diskOutput string) error {
if !vmware.Allocator.IsAvailable() {
return errors.New("vmware is not installed on your system")
}
Function DUImageFile
has 9 return statements (exceeds 4 allowed). Open
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 StreamOptimizedWriter.writeFooter
has 9 return statements (exceeds 4 allowed). Open
Open
func (w *StreamOptimizedWriter) writeFooter() error {
// flush last table
// write table marker to disk
marker := make([]uint32, 128)
Function Load
has 9 return statements (exceeds 4 allowed). Open
Open
func Load(r io.Reader) (Reader, error) {
var err error
hdr := new(header)
Method Bundle.Size
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func (bundle *Bundle) Size(tags ...string) int64 {
var size int64
var skip bool
- 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 ConvertToVM
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func ConvertToVM(name string, pname string, state string, routes []virtualizers.NetworkInterface, created time.Time, cfg *vcfg.VCFG, source interface{}) interface{} {
Method ContainerConverter.ConvertToProject
has 8 return statements (exceeds 4 allowed). Open
Open
func (cc *ContainerConverter) ConvertToProject(dst, user, pwd string) error {
// check if folder exists
err := checkDirectory(dst)
if err != nil {
Method Writer.Close
has 8 return statements (exceeds 4 allowed). Open
Open
func (w *Writer) Close() error {
defer w.tw.Close()
defer os.Remove(w.vmdkTmpFile.Name())
err := w.vmdkWriter.Close()
if err != nil {
Method ContainerConverter.untarLayers
has 8 return statements (exceeds 4 allowed). Open
Open
func (cc *ContainerConverter) untarLayers(targetDir string) error {
err := checkDirectory(targetDir)
if err != nil {
return err
Function findBinary
has 8 return statements (exceeds 4 allowed). Open
Open
func findBinary(name string, env []string, cwd string, targetDir string, log elog.View) (string, error) {
log.Debugf("finding %s in %s (cwd: %s, env %v)", name, targetDir, cwd, env)
if strings.HasPrefix(name, "./") {
Method Builder.validateConfig
has 8 return statements (exceeds 4 allowed). Open
Open
func (b *Builder) validateConfig() error {
for i, p := range b.vcfg.Programs {
if p.Binary == "" && p.Args == "" {
Method importSharedObjectsOperation.copyLib
has 8 return statements (exceeds 4 allowed). Open
Open
func (isoOp *importSharedObjectsOperation) copyLib(libPath, destPath string) (bool, error) {
destPath = isoOp.adjustPath(destPath)
isoOp.logger.Infof("copying '%s' > '%s", libPath, destPath)
// evaluate libPath so see if its a symlink