vorteil/vorteil

View on GitHub

Showing 207 of 546 total issues

Method SparseWriter.writeGrainData has 10 return statements (exceeds 4 allowed).
Open

func (w *SparseWriter) writeGrainData() error {
    var err error

    firstDataSector := int64(w.hdr.OverHead) * SectorsPerGrain

Severity: Major
Found in pkg/vmdk/sparse.go - About 1 hr to fix

    Function runHyperV has 10 return statements (exceeds 4 allowed).
    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() {
    Severity: Major
    Found in pkg/cli/virtualizers.go - About 1 hr to fix

      Function blockType has 10 return statements (exceeds 4 allowed).
      Open

      func blockType(i int64) int {
      
          var p, a, b int64
          p = BlockSize / pointerSize
      
      
      Severity: Major
      Found in pkg/ext/common.go - About 1 hr to fix

        Method Bundle.Reader has 10 return statements (exceeds 4 allowed).
        Open

        func (bundle *Bundle) Reader(tags ...string) io.ReadCloser {
        
            pr, pw := io.Pipe()
        
            go func(pw *io.PipeWriter) {
        Severity: Major
        Found in pkg/vkern/bundle.go - About 1 hr to fix

          Function Load has 9 return statements (exceeds 4 allowed).
          Open

          func Load(r io.Reader) (Reader, error) {
          
              var err error
          
              hdr := new(header)
          Severity: Major
          Found in pkg/vpkg/package.go - About 55 mins to fix

            Function LazyOpen has 9 return statements (exceeds 4 allowed).
            Open

            func LazyOpen(path string) (File, error) {
            
                fi, err := os.Lstat(path)
                if err != nil {
                    return nil, err
            Severity: Major
            Found in pkg/vio/file.go - About 55 mins to fix

              Function runVMware has 9 return statements (exceeds 4 allowed).
              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")
                  }
              
              
              Severity: Major
              Found in pkg/cli/virtualizers.go - About 55 mins to fix

                Function DUImageFile has 9 return statements (exceeds 4 allowed).
                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)
                Severity: Major
                Found in pkg/imagetools/du.go - About 55 mins to fix

                  Method Virtualizer.Close has a Cognitive Complexity of 24 (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 {
                  Severity: Minor
                  Found in pkg/virtualizers/virtualbox/virtualizer.go - About 55 mins 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 StreamOptimizedWriter.writeFooter has 9 return statements (exceeds 4 allowed).
                  Open

                  func (w *StreamOptimizedWriter) writeFooter() error {
                  
                      // flush last table
                      // write table marker to disk
                      marker := make([]uint32, 128)
                  Severity: Major
                  Found in pkg/vmdk/stream-optimized.go - About 55 mins to fix

                    Function runVirtualBox has 9 return statements (exceeds 4 allowed).
                    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
                    Severity: Major
                    Found in pkg/cli/virtualizers.go - About 55 mins to fix

                      Function runQEMU has 9 return statements (exceeds 4 allowed).
                      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")
                          }
                      Severity: Major
                      Found in pkg/cli/virtualizers.go - About 55 mins to fix

                        Method Bundle.Size has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (bundle *Bundle) Size(tags ...string) int64 {
                        
                            var size int64
                            var skip bool
                        
                        
                        Severity: Minor
                        Found in pkg/vkern/bundle.go - About 55 mins 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 ConvertToVM has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func ConvertToVM(name string, pname string, state string, routes []virtualizers.NetworkInterface, created time.Time, cfg *vcfg.VCFG, source interface{}) interface{} {
                        Severity: Major
                        Found in pkg/virtualizers/util/util.go - About 50 mins to fix

                          Method Builder.validateConfig has 8 return statements (exceeds 4 allowed).
                          Open

                          func (b *Builder) validateConfig() error {
                          
                              for i, p := range b.vcfg.Programs {
                          
                                  if p.Binary == "" && p.Args == "" {
                          Severity: Major
                          Found in pkg/vimg/os.go - About 50 mins to fix

                            Method Writer.Close has 8 return statements (exceeds 4 allowed).
                            Open

                            func (w *Writer) Close() error {
                                defer w.tw.Close()
                                defer os.Remove(w.vmdkTmpFile.Name())
                                err := w.vmdkWriter.Close()
                                if err != nil {
                            Severity: Major
                            Found in pkg/ova/ova.go - About 50 mins to fix

                              Method ContainerConverter.untarLayers has 8 return statements (exceeds 4 allowed).
                              Open

                              func (cc *ContainerConverter) untarLayers(targetDir string) error {
                              
                                  err := checkDirectory(targetDir)
                                  if err != nil {
                                      return err
                              Severity: Major
                              Found in pkg/vconvert/vconvert.go - About 50 mins to fix

                                Method ContainerConverter.ConvertToProject has 8 return statements (exceeds 4 allowed).
                                Open

                                func (cc *ContainerConverter) ConvertToProject(dst, user, pwd string) error {
                                
                                    // check if folder exists
                                    err := checkDirectory(dst)
                                    if err != nil {
                                Severity: Major
                                Found in pkg/vconvert/vconvert.go - About 50 mins to fix

                                  Function findBinary has 8 return statements (exceeds 4 allowed).
                                  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, "./") {
                                  Severity: Major
                                  Found in pkg/vconvert/misc.go - About 50 mins to fix

                                    Function run has 8 return statements (exceeds 4 allowed).
                                    Open

                                    func run(virt virtualizers.Virtualizer, diskpath string, cfg *vcfg.VCFG, name string) error {
                                    
                                        // Gather home directory for firecracker storage path
                                        home, err := homedir.Dir()
                                        if err != nil {
                                    Severity: Major
                                    Found in pkg/cli/run.go - About 50 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language