vorteil/vorteil

View on GitHub

Showing 546 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          func (b *Builder) writeGPT(ctx context.Context, w io.WriteSeeker) error {
          
              err := b.writeMBR(ctx, w)
              if err != nil {
                  return err
          Severity: Minor
          Found in pkg/vimg/partitions.go and 1 other location - About 1 hr to fix
          pkg/vimg/partitions.go on lines 108..126

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 129.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          func (b *Builder) writePartitions(ctx context.Context, w io.WriteSeeker) error {
          
              err := b.writeGPT(ctx, w)
              if err != nil {
                  return err
          Severity: Minor
          Found in pkg/vimg/partitions.go and 1 other location - About 1 hr to fix
          pkg/vimg/partitions.go on lines 55..74

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 129.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          func (v *Virtualizer) Download() (vio.File, error) {
              v.logger.Debugf("Downloading Disk")
          
              if !(v.state == virtualizers.Ready) {
                  return nil, fmt.Errorf("the machine must be in a stopped or ready state")
          Severity: Major
          Found in pkg/virtualizers/qemu/virtualizer.go and 2 other locations - About 1 hr to fix
          pkg/virtualizers/firecracker/virtualizer_linux.go on lines 137..149
          pkg/virtualizers/vmware/virtualizer.go on lines 446..459

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 128.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          func (v *Virtualizer) Download() (vio.File, error) {
              v.logger.Debugf("Downloading Disk")
              if !(v.state == virtualizers.Ready) {
                  return nil, fmt.Errorf("the machine must be in a stopped or ready state")
              }
          Severity: Major
          Found in pkg/virtualizers/firecracker/virtualizer_linux.go and 2 other locations - About 1 hr to fix
          pkg/virtualizers/qemu/virtualizer.go on lines 304..317
          pkg/virtualizers/vmware/virtualizer.go on lines 446..459

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 128.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          func (v *Virtualizer) Download() (vio.File, error) {
              v.logger.Debugf("Downloading Disk")
          
              if !(v.state == virtualizers.Ready) {
                  return nil, fmt.Errorf("the machine must be in a stopped or ready state")
          Severity: Major
          Found in pkg/virtualizers/vmware/virtualizer.go and 2 other locations - About 1 hr to fix
          pkg/virtualizers/firecracker/virtualizer_linux.go on lines 137..149
          pkg/virtualizers/qemu/virtualizer.go on lines 304..317

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 128.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              footer := &footer{
                                  Cookie:             conectix,
                                  Features:           0x00000002,
                                  FileFormatVersion:  0x00010000,
                                  DataOffset:         0xFFFFFFFFFFFFFFFF,
                          Severity: Minor
                          Found in pkg/vhd/fixed.go and 1 other location - About 50 mins to fix
                          pkg/vhd/dynamic.go on lines 92..106

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 122.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language