vorteil/vorteil

View on GitHub

Showing 546 of 546 total issues

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

func (o *operation) checkIfHost() (bool, error) {
    var deviceIsHost bool
    if o.networkType == "hostonly" {
        devices, err := virtualizers.HostDevices()
        if err != nil {
Severity: Major
Found in pkg/virtualizers/virtualbox/virtualizer.go and 1 other location - About 1 hr to fix
pkg/virtualizers/virtualbox/virtualizer.go on lines 644..662

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 141.

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 main has 12 return statements (exceeds 4 allowed).
Open

func main() {

    defer cli.HandleErrors()

    // Init FOSS COMMANDS
Severity: Major
Found in cmd/vorteil/main.go - About 1 hr to fix

    Function LazyOpen has 54 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      Method Virtualizer.Start has 54 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (v *Virtualizer) Start() error {
          v.logger.Debugf("Starting VM")
          v.command = exec.Command(v.command.Args[0], v.command.Args[1:]...)
          v.command.SysProcAttr = &syscall.SysProcAttr{
              Setpgid: true,
      Severity: Minor
      Found in pkg/virtualizers/qemu/virtualizer_notwindows.go - About 1 hr to fix

        Method DynamicWriter.Seek has 54 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (w *DynamicWriter) Seek(offset int64, whence int) (int64, error) {
        
            var abs int64
            switch whence {
            case io.SeekStart:
        Severity: Minor
        Found in pkg/vhd/dynamic.go - About 1 hr to fix

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

          func (iio *IO) BGDT(index int) ([]*ext.BlockGroupDescriptorTableEntry, error) {
          
              // only return a cached bgdt if index is zero
              if index == 0 && iio.fs.bgdt != nil {
                  return iio.fs.bgdt, nil
          Severity: Major
          Found in pkg/vdecompiler/fs.go and 1 other location - About 1 hr to fix
          pkg/vdecompiler/fs.go on lines 59..82

          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 137.

          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

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

              addEntry := func(inode uint64, name string, ftype uint8) {
          
                  l := align(int64(11+len(name)), 8)
                  if space-l < 16 { // TODO: Really? Why 16? Why not zero?
                      space = b.c.blockSize() - 16
          Severity: Major
          Found in pkg/xfs/dir.go and 1 other location - About 1 hr to fix
          pkg/xfs/dir.go on lines 586..601

          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 137.

          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

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

              addEntry := func(inode uint64, name string, ftype uint8) {
          
                  l := align(int64(11+len(name)), 8)
                  if space-l < 16 { // TODO: Really? Why 16? Why not zero?
                      space = b.c.blockSize() - 16
          Severity: Major
          Found in pkg/xfs/dir.go and 1 other location - About 1 hr to fix
          pkg/xfs/dir.go on lines 409..424

          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 137.

          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 (iio *IO) Superblock(index int) (*ext.Superblock, error) {
          
              // only return a cached superblock if index is zero
              if index == 0 && iio.fs.superblock != nil {
                  return iio.fs.superblock, nil
          Severity: Major
          Found in pkg/vdecompiler/fs.go and 1 other location - About 1 hr to fix
          pkg/vdecompiler/fs.go on lines 123..146

          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 137.

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

            Method StreamOptimizedWriter.flushGrain has 11 return statements (exceeds 4 allowed).
            Open

            func (w *StreamOptimizedWriter) flushGrain() error {
                var err error
                defer func() {
                    w.grainNo++
                    w.cursor = w.grainNo * GrainSize
            Severity: Major
            Found in pkg/vmdk/stream-optimized.go - About 1 hr to fix

              Method CalVer.Less has 11 return statements (exceeds 4 allowed).
              Open

              func (v CalVer) Less(version CalVer) bool {
                  if v.Major() < version.Major() {
                      return true
                  }
              
              
              Severity: Major
              Found in pkg/vkern/calver.go - About 1 hr to fix

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

                    PreRunE: func(cmd *cobra.Command, args []string) error {
                        usr, err := os.UserHomeDir()
                        if err != nil {
                            return err
                        }
                Severity: Major
                Found in pkg/cli/repositories.go and 1 other location - About 1 hr to fix
                pkg/cli/repositories.go on lines 48..62

                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 135.

                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

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

                    PreRunE: func(cmd *cobra.Command, args []string) error {
                        usr, err := os.UserHomeDir()
                        if err != nil {
                            return err
                        }
                Severity: Major
                Found in pkg/cli/repositories.go and 1 other location - About 1 hr to fix
                pkg/cli/repositories.go on lines 254..268

                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 135.

                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

                Method CLIRemoteManager.Get has 11 return statements (exceeds 4 allowed).
                Open

                func (mgr *CLIRemoteManager) Get(ctx context.Context, version CalVer) (*ManagedBundle, error) {
                
                    list, err := mgr.List(ctx)
                    if err != nil {
                        return nil, err
                Severity: Major
                Found in pkg/vkern/cli.go - About 1 hr to fix

                  Method RemoteManager.remoteList has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (mgr *RemoteManager) remoteList(ctx context.Context) (List, error) {
                  
                      var list List
                  
                      // request remote manifest
                  Severity: Minor
                  Found in pkg/vkern/manager-remote.go - About 1 hr to fix

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

                        for _, child := range n.node.Children {
                            var ftype uint8
                            if child.File.IsDir() {
                                ftype = FTypeDir
                            } else if child.File.IsSymlink() {
                    Severity: Major
                    Found in pkg/ext4/dir.go and 1 other location - About 1 hr to fix
                    pkg/ext/common.go on lines 288..298

                    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 134.

                    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

                        for _, child := range node.node.Children {
                            var ftype uint8
                            if child.File.IsDir() {
                                ftype = ftypeDir
                            } else if child.File.IsSymlink() {
                    Severity: Major
                    Found in pkg/ext/common.go and 1 other location - About 1 hr to fix
                    pkg/ext4/dir.go on lines 248..258

                    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 134.

                    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

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

                    func (c *Compiler) AddFile(path string, r io.ReadCloser, size int64, force bool) error {
                    
                        _, base := filepath.Split(path)
                        err := c.tree.Map(path, vio.CustomFile(vio.CustomFileArgs{
                            Name:       base,
                    Severity: Major
                    Found in pkg/xfs/compiler.go and 1 other location - About 1 hr to fix
                    pkg/ext4/compiler.go on lines 49..63

                    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 133.

                    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

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

                    func (c *Compiler) AddFile(path string, r io.ReadCloser, size int64, force bool) error {
                    
                        _, base := filepath.Split(path)
                        err := c.tree.Map(path, vio.CustomFile(vio.CustomFileArgs{
                            Name:       base,
                    Severity: Major
                    Found in pkg/ext4/compiler.go and 1 other location - About 1 hr to fix
                    pkg/xfs/compiler.go on lines 50..64

                    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 133.

                    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