vorteil/vorteil

View on GitHub

Showing 207 of 546 total issues

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

                  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

                    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

                            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

                                  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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language