vorteil/vorteil

View on GitHub

Showing 546 of 546 total issues

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() {
Severity: Minor
Found in pkg/cli/virtualizers.go - About 1 hr to fix

    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)
        }
    
    
    Severity: Minor
    Found in pkg/virtualizers/vmware/util.go - About 1 hr to fix

      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)
      Severity: Minor
      Found in pkg/ext4/layout.go - About 1 hr to fix

        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`)
        Severity: Major
        Found in pkg/provisioners/nutanix/nutanix.go - About 1 hr to fix

          Function runVMware has 58 lines of code (exceeds 50 allowed). Consider refactoring.
          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: Minor
          Found in pkg/cli/virtualizers.go - About 1 hr to fix

            Function runVirtualBox has 58 lines of code (exceeds 50 allowed). Consider refactoring.
            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: Minor
            Found in pkg/cli/virtualizers.go - About 1 hr to fix

              Method compiler.buildBitmap has 58 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (c *compiler) buildBitmap() {
                  c.allocGroupFreeBlocks = make([]int64, c.allocGroups)
                  c.allocGroupFreeInodes = make([]int64, c.allocGroups)
              
                  for i := int64(0); i < c.allocGroups; i++ {
              Severity: Minor
              Found in pkg/xfs/xfs.go - About 1 hr to fix

                Function runQEMU has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                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: Minor
                Found in pkg/cli/virtualizers.go - About 1 hr to fix

                  Function InitializeCommands has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func InitializeCommands() {
                  
                      // Here we attack VCFG modification flags to relevant commands. Because of
                      // the order Go runs init functions this is the safest place to do this.
                      addModifyFlags(buildCmd.Flags())
                  Severity: Minor
                  Found in pkg/cli/cli.go - About 1 hr to fix

                    Method CLIRemoteManager.updateList has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

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

                      Function copyImageFileFromVPartition has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func copyImageFileFromVPartition(vorteilImage *vdecompiler.IO, imageFilePath string, destFilePath string) error {
                          var err error
                          var r io.Reader
                          var f *os.File
                          if imageFilePath != "" && imageFilePath != "/" && imageFilePath != "." {
                      Severity: Minor
                      Found in pkg/imagetools/cp.go - About 1 hr 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 importSharedObjectsOperation.loadLDPathsFromLinkerConfig has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (isoOp *importSharedObjectsOperation) loadLDPathsFromLinkerConfig(path string) error {
                          if strings.Contains(path, "*") {
                              return nil
                          }
                          data, err := ioutil.ReadFile(path)
                      Severity: Minor
                      Found in pkg/vproj/import-so.go - About 1 hr 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 generateHashDirectoryData has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func generateHashDirectoryData(node *node) []byte {
                          n := node.node
                          entries := make(hashDirEntriesMetdata, len(n.Children))
                      
                          for i, child := range n.Children {
                      Severity: Minor
                      Found in pkg/ext4/dir.go - About 1 hr to fix

                        Method super.init has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (s *super) init(totalBlocks, inodesPerGroup int64, nodes *[]node) {
                            s.timestamp = time.Now()
                            s.layout.inodesPerGroup = inodesPerGroup
                            s.layout.totalBlocks = totalBlocks
                            s.layout.totalGroupDescriptors = totalGroupsAllowingForGrowth(divide(totalBlocks, BlocksPerGroup))
                        Severity: Minor
                        Found in pkg/ext4/super.go - About 1 hr to fix

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

                          var initRequiredProgramsFromString = func(f flag.NStringFlag, fn func(prog *vcfg.Program, s string)) error {
                              return initFromNStringFlag(f, func(i int, s string) {
                                  for len(overrideVCFG.Programs) < i+1 {
                                      overrideVCFG.Programs = append(overrideVCFG.Programs, vcfg.Program{})
                                  }
                          Severity: Major
                          Found in pkg/cli/vcfg-flags.go and 1 other location - About 1 hr to fix
                          pkg/cli/vcfg-flags.go on lines 188..195

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

                          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

                          var initRequiredNFS = func(f flag.NStringFlag, fn func(nfs *vcfg.NFSSettings, s string)) error {
                              return initFromNStringFlag(f, func(i int, s string) {
                                  for len(overrideVCFG.NFS) < i+1 {
                                      overrideVCFG.NFS = append(overrideVCFG.NFS, vcfg.NFSSettings{})
                                  }
                          Severity: Major
                          Found in pkg/cli/vcfg-flags.go and 1 other location - About 1 hr to fix
                          pkg/cli/vcfg-flags.go on lines 452..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 144.

                          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 LookForIP has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func LookForIP(l *logger.Logger, routes []virtualizers.NetworkInterface) []virtualizers.NetworkInterface {
                          
                              sub := l.Subscribe()
                              inbox := sub.Inbox()
                              var msg string
                          Severity: Minor
                          Found in pkg/virtualizers/util/util.go - About 1 hr to fix

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

                            func (b *nodeDirBuilder) writeDataBlock(w io.Writer, n int64, dentries []*dentry) {
                            
                                space := b.c.blockSize() - 16
                                offset := 16 + n*b.c.blockSize()
                            
                            
                            Severity: Major
                            Found in pkg/xfs/dir.go and 1 other location - About 1 hr to fix
                            pkg/xfs/dir.go on lines 441..450

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

                            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 *leafDirBuilder) writeDataBlock(w io.Writer, n int64, dentries []*dentry) {
                            
                                space := b.c.blockSize() - 16
                                offset := 16 + n*b.c.blockSize()
                            
                            
                            Severity: Major
                            Found in pkg/xfs/dir.go and 1 other location - About 1 hr to fix
                            pkg/xfs/dir.go on lines 618..627

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

                            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 (o *operation) checkIfBridged() (bool, error) {
                                var deviceIsBridged bool
                                if o.networkType == "bridged" {
                                    devices, err := virtualizers.BridgedDevices()
                                    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 665..684

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language