vorteil/vorteil

View on GitHub

Showing 207 of 546 total issues

Method Provisioner.init has 6 return statements (exceeds 4 allowed).
Open

func (p *Provisioner) init() error {

    var (
        err        error
        oauthToken *jwt.Config
Severity: Major
Found in pkg/provisioners/google/google.go - About 40 mins to fix

    Function handleFile has 6 return statements (exceeds 4 allowed).
    Open

    func handleFile(args *handleFileArgs) (*tar.Header, error) {
    
        header, err := tar.FileInfoHeader(vio.Info(args.f), args.link)
        if err != nil {
            return nil, err
    Severity: Major
    Found in pkg/vproj/util.go - About 40 mins to fix

      Function TarFromPackage has 6 return statements (exceeds 4 allowed).
      Open

      func TarFromPackage(w io.Writer, pkg vpkg.Reader) error {
      
          // Create tar writer
          tw := tar.NewWriter(w)
          defer tw.Close()
      Severity: Major
      Found in pkg/vproj/projects.go - About 40 mins to fix

        Function getRestoreAsset has 6 return statements (exceeds 4 allowed).
        Open

        func getRestoreAsset(dir, name string) error {
            data, err := getAsset(name)
            if err != nil {
                return err
            }
        Severity: Major
        Found in pkg/vkern/gpg.go - About 40 mins to fix

          Method Provisioner.Validate has 6 return statements (exceeds 4 allowed).
          Open

          func (p *Provisioner) Validate() error {
              loginURL, err := url.Parse(p.cfg.Address + "/sdk")
              if err != nil {
                  return err
              }
          Severity: Major
          Found in pkg/provisioners/vcenter/vcenter.go - About 40 mins to fix

            Function NewBundle has 6 return statements (exceeds 4 allowed).
            Open

            func NewBundle(rs io.ReadSeeker) (*Bundle, error) {
            
                var err error
                var gz *gzip.Reader
                var tr *tar.Reader
            Severity: Major
            Found in pkg/vkern/bundle.go - About 40 mins to fix

              Method Provisioner.init has 6 return statements (exceeds 4 allowed).
              Open

              func (p *Provisioner) init() error {
                  ctx := context.Background()
              
                  // TODO test connection
                  loginURL, err := url.Parse(p.cfg.Address + "/sdk")
              Severity: Major
              Found in pkg/provisioners/vcenter/vcenter.go - About 40 mins to fix

                Function handleIcon has 6 return statements (exceeds 4 allowed).
                Open

                func handleIcon(iconName string, ico vio.File, tw *tar.Writer, iconFile *os.File) error {
                    if ico.Size() == 0 {
                        return nil
                    }
                    _, err := iconFile.Seek(0, 0)
                Severity: Major
                Found in pkg/vproj/util.go - About 40 mins to fix

                  Function Parse has 6 return statements (exceeds 4 allowed).
                  Open

                  func Parse(s string) (CalVer, error) {
                  
                      k := strings.Count(s, ".")
                      if k < 1 || k > 2 {
                          return CalVer(""), ErrInvalidCalVer
                  Severity: Major
                  Found in pkg/vkern/calver.go - About 40 mins to fix

                    Function createArgs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func createArgs(cpus uint, memory int, headless bool, diskpath string, diskformat string) string {
                    Severity: Minor
                    Found in pkg/virtualizers/qemu/virtualizer.go - About 35 mins to fix

                      Method Format.Build has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func (x *Format) Build(ctx context.Context, log elog.View, w io.WriteSeeker, b *vimg.Builder, cfg *vcfg.VCFG) error {
                      Severity: Minor
                      Found in pkg/vdisk/formats.go - About 35 mins to fix

                        Function RegisterNewDiskFormat has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func RegisterNewDiskFormat(format Format, extention string, alignment int64, mtu uint, builderFunc BuildWriterInstantiator) error {
                        Severity: Minor
                        Found in pkg/vdisk/formats.go - About 35 mins to fix

                          Function Create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          func Create(mgr *virtualizers.Manager, name string, headless bool, ntype string, ndevice string) error {
                          Severity: Minor
                          Found in pkg/virtualizers/virtualbox/allocator.go - About 35 mins to fix

                            Function DUImageFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func DUImageFile(vorteilImage *vdecompiler.IO, imageFilePath string, calcFreeSpace bool, maxDepth int, all bool) (DUImageReport, error) {
                            Severity: Minor
                            Found in pkg/imagetools/du.go - About 35 mins to fix

                              Function findBinary has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func findBinary(name string, env []string, cwd string, targetDir string, log elog.View) (string, error) {
                              Severity: Minor
                              Found in pkg/vconvert/misc.go - About 35 mins to fix

                                Method IO.exploreExtentsTree has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func (iio *IO) exploreExtentsTree(hdr *ext4ExtentHeader, blockSize int64, data []byte, blockAddrs *[]int, c *int) error {
                                Severity: Minor
                                Found in pkg/vdecompiler/fs.go - About 35 mins to fix

                                  Function walkFilesystem has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func walkFilesystem(pkg vpkg.Reader, files []string, tw *tar.Writer, vprjIncluded bool, vprj ProjectData) error {
                                  Severity: Minor
                                  Found in pkg/vproj/util.go - About 35 mins to fix

                                    Method ContainerConverter.createVCFG has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    func (cc *ContainerConverter) createVCFG(config v1.Config, targetDir string) error {
                                    
                                        if _, err := os.Stat(targetDir); err != nil {
                                            return fmt.Errorf("directory %s does not exist", targetDir)
                                        }
                                    Severity: Minor
                                    Found in pkg/vconvert/vconvert.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 ContainerConverter.downloadInformationContainerd has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (cc *ContainerConverter) downloadInformationContainerd(image, tag string) error {
                                    
                                        cc.logger.Infof("getting local containerd image %s (%s)", image, tag)
                                    
                                        if len(image) == 0 || len(tag) == 0 {
                                    Severity: Major
                                    Found in pkg/vconvert/local.go - About 35 mins to fix

                                      Method Compiler.setPrecompileConstants has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *Compiler) setPrecompileConstants(size, minDataBlocks, minInodes, minInodesPer64 int64) error {
                                      
                                          c.size = size
                                          blocks := c.size / BlockSize
                                          groups := divide(blocks, BlocksPerGroup)
                                      Severity: Major
                                      Found in pkg/ext4/layout.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language