vorteil/vorteil

View on GitHub

Showing 207 of 546 total issues

Method precompiler.setBlockSize has 5 return statements (exceeds 4 allowed).
Open

func (p *precompiler) setBlockSize(size int64) error {

    if size == 0 {
        p.exponents.blockSize = 12 // 4 KiB
        return nil
Severity: Major
Found in pkg/xfs/xfs.go - About 35 mins to fix

    Method Writer.writeL1Table has 5 return statements (exceeds 4 allowed).
    Open

    func (w *Writer) writeL1Table() error {
    
        l2Capacity := w.clusterSize * (w.clusterSize / 8)
    
        buf := new(bytes.Buffer)
    Severity: Major
    Found in pkg/qcow2/qcow2.go - About 35 mins to fix

      Method Virtualizer.GenerateScript has 5 return statements (exceeds 4 allowed).
      Open

      func (v *Virtualizer) GenerateScript(source string) error {
          var err error
      
          name := filepath.Base(v.folder)
          err = os.MkdirAll(filepath.Join(source), 0777)
      Severity: Major
      Found in pkg/virtualizers/qemu/virtualizer_notwindows.go - About 35 mins to fix

        Method ContainerConverter.downloadInformationRemote has 5 return statements (exceeds 4 allowed).
        Open

        func (cc *ContainerConverter) downloadInformationRemote(config *registryConfig) error {
        
            if config == nil || config.url == "" {
                return fmt.Errorf("config is nil or URL is empty")
            }
        Severity: Major
        Found in pkg/vconvert/remote.go - About 35 mins to fix

          Method builder.MergeVCFG has 5 return statements (exceeds 4 allowed).
          Open

          func (b *builder) MergeVCFG(cfg *vcfg.VCFG) error {
          
              v, err := vcfg.LoadFile(b.vcfg)
              if err != nil {
                  return err
          Severity: Major
          Found in pkg/vpkg/package.go - About 35 mins to fix

            Method Virtualizer.createAndConfigure has 5 return statements (exceeds 4 allowed).
            Open

            func (v *Virtualizer) createAndConfigure(diskpath string) error {
                cVMArgs := createVM(v.folder, v.name)
                cmd := exec.Command("VBoxManage", cVMArgs...)
                err := v.execute(cmd)
                if err != nil {
            Severity: Major
            Found in pkg/virtualizers/virtualbox/virtualizer.go - About 35 mins to fix

              Function checkIfNewVRepo has 5 return statements (exceeds 4 allowed).
              Open

              func checkIfNewVRepo(src string) (string, error) {
                  urlo, err := url.Parse(src)
                  if err != nil {
                      return "", err
                  }
              Severity: Major
              Found in pkg/cli/main.go - About 35 mins to fix

                Method Virtualizer.GenerateScript has 5 return statements (exceeds 4 allowed).
                Open

                func (v *Virtualizer) GenerateScript(source string) error {
                    var err error
                
                    // look up full path to qemu
                    v.command.Args[0], err = exec.LookPath(v.command.Args[0])
                Severity: Major
                Found in pkg/virtualizers/qemu/virtualizer_windows.go - About 35 mins to fix

                  Method Virtualizer.initializeNetworkCards has 5 return statements (exceeds 4 allowed).
                  Open

                  func (v *Virtualizer) initializeNetworkCards() ([]string, error) {
                      v.logger.Debugf("Initializing Network Cards")
                      var nicArgs string
                      var err error
                      var nr string
                  Severity: Major
                  Found in pkg/virtualizers/qemu/virtualizer.go - About 35 mins to fix

                    Method operation.setVMDetails has 5 return statements (exceeds 4 allowed).
                    Open

                    func (o *operation) setVMDetails(size string) error {
                        // set vm memory
                        cmd := exec.Command(virtualizers.Powershell, "Set-VMMemory", "-VMName", o.name, "-DynamicMemoryEnabled", "0", "-StartupBytes", size)
                        output, err := o.execute(cmd)
                        if err != nil {
                    Severity: Major
                    Found in pkg/virtualizers/hyperv/virtualizer.go - About 35 mins to fix

                      Method DynamicWriter.writeHeader has 5 return statements (exceeds 4 allowed).
                      Open

                      func (w *DynamicWriter) writeHeader() error {
                          // sparse drive header
                          cxsparse := uint64(0x6378737061727365)
                          header := &header{
                              Cookie:          cxsparse,
                      Severity: Major
                      Found in pkg/vhd/dynamic.go - About 35 mins to fix

                        Method compiler.buildBitmap has a Cognitive Complexity of 22 (exceeds 20 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 35 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 writeSeeker.Seek has 5 return statements (exceeds 4 allowed).
                        Open

                        func (ws *writeSeeker) Seek(offset int64, whence int) (int64, error) {
                            switch whence {
                            case io.SeekCurrent:
                                if ws.s == nil {
                                    if offset < 0 {
                        Severity: Major
                        Found in pkg/vio/writeseeker.go - About 35 mins to fix

                          Method Virtualizer.handlePorts has 5 return statements (exceeds 4 allowed).
                          Open

                          func (v *Virtualizer) handlePorts(args []string, route virtualizers.NetworkInterface, protocol string, i int) ([]string, bool, error) {
                              var err error
                              var nr string
                              var hasDefinedPorts bool
                              for j, port := range route.HTTP {
                          Severity: Major
                          Found in pkg/virtualizers/virtualbox/virtualizer.go - About 35 mins to fix

                            Method Size.String has 5 return statements (exceeds 4 allowed).
                            Open

                            func (x Size) String() string {
                                sign := ""
                                if int(x) < 0 {
                                    sign = "+"
                                }
                            Severity: Major
                            Found in pkg/vcfg/types.go - About 35 mins to fix

                              Function BindPort has 5 return statements (exceeds 4 allowed).
                              Open

                              func BindPort(netType, protocol, port string) (string, string, error) {
                                  var (
                                      bind     string
                                      netRoute string
                                      isBound  bool
                              Severity: Major
                              Found in pkg/virtualizers/util.go - About 35 mins to fix

                                Method Builder.validateOSArgs has 5 return statements (exceeds 4 allowed).
                                Open

                                func (b *Builder) validateOSArgs(ctx context.Context) error {
                                
                                    b.linuxArgs = b.vcfg.System.KernelArgs
                                
                                    b.determineKernelTags()
                                Severity: Major
                                Found in pkg/vimg/os.go - About 35 mins to fix

                                  Method tree.Close has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (t *tree) Close() error {
                                  
                                      t.lock.Lock()
                                      defer t.lock.Unlock()
                                      if t.closed {
                                  Severity: Major
                                  Found in pkg/vio/tree.go - About 35 mins to fix

                                    Function Open has 5 return statements (exceeds 4 allowed).
                                    Open

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

                                      Function NewBuilderFromReader has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func NewBuilderFromReader(rdr Reader) (Builder, error) {
                                      
                                          var err error
                                          b := NewBuilder()
                                          b.(*builder).closeFunc = rdr.Close
                                      Severity: Major
                                      Found in pkg/vpkg/package.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language