vorteil/vorteil

View on GitHub

Showing 546 of 546 total issues

Method Provisioner.Provision has 16 return statements (exceeds 4 allowed).
Open

func (p *Provisioner) Provision(args *provisioners.ProvisionArgs) error {
    var err error

    // report that the 'description' flag is ignored if using this provisioner
    if args.Description != "" {
Severity: Major
Found in pkg/provisioners/vcenter/vcenter.go - About 1 hr to fix

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

        if totalSectors >= 65525*16*63 {
            sectorsPerTrack = 255
            heads = 16
            cylinderTimesHeads = totalSectors / sectorsPerTrack
        } else {
    Severity: Major
    Found in pkg/vhd/dynamic.go and 2 other locations - About 1 hr to fix
    pkg/vhd/fixed.go on lines 72..93
    pkg/vhd/fixed.go on lines 181..202

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

    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 3 locations. Consider refactoring.
    Open

        if totalSectors >= 65525*16*63 {
            sectorsPerTrack = 255
            heads = 16
            cylinderTimesHeads = totalSectors / sectorsPerTrack
        } else {
    Severity: Major
    Found in pkg/vhd/fixed.go and 2 other locations - About 1 hr to fix
    pkg/vhd/dynamic.go on lines 67..88
    pkg/vhd/fixed.go on lines 181..202

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

    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 (s *super) regionIsHole(begin, size int64) bool {
    
        first := begin / BlockSize
        end := begin + size
        last := (end - 1) / BlockSize
    Severity: Major
    Found in pkg/ext4/super.go and 1 other location - About 1 hr to fix
    pkg/ext/block-usage.go on lines 74..92

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

    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

        PreRunE: func(cmd *cobra.Command, args []string) error {
            if len(args) < 2 {
                return errors.New("must provide a NAME and TOKEN")
            }
            usr, err := os.UserHomeDir()
    Severity: Major
    Found in pkg/cli/repositories.go and 1 other location - About 1 hr to fix
    pkg/cli/repositories.go on lines 324..341

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

    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 (c *blockUsage) regionIsHole(begin, size int64) bool {
    
        first := begin / BlockSize
        end := begin + size
        last := (end - 1) / BlockSize
    Severity: Major
    Found in pkg/ext/block-usage.go and 1 other location - About 1 hr to fix
    pkg/ext4/super.go on lines 600..619

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

    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

        PreRunE: func(cmd *cobra.Command, args []string) error {
            if len(args) != 1 {
                return errors.New("Must provide the name of the key you want to delete")
            }
            usr, err := os.UserHomeDir()
    Severity: Major
    Found in pkg/cli/repositories.go and 1 other location - About 1 hr to fix
    pkg/cli/repositories.go on lines 150..167

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

    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 3 locations. Consider refactoring.
    Open

        if totalSectors >= 65525*16*63 {
            sectorsPerTrack = 255
            heads = 16
            cylinderTimesHeads = totalSectors / sectorsPerTrack
        } else {
    Severity: Major
    Found in pkg/vhd/fixed.go and 2 other locations - About 1 hr to fix
    pkg/vhd/dynamic.go on lines 67..88
    pkg/vhd/fixed.go on lines 72..93

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

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

    func decompileImageRecursive(vorteilImage *vdecompiler.IO, report DecompileReport, symlinkCallbacks []func() error, ino int, rpath string, dpath string) (DecompileReport, []func() error, error) {
        var entries []*vdecompiler.DirectoryEntry
    
        inode, err := vorteilImage.ResolveInode(ino)
        if err != nil {
    Severity: Minor
    Found in pkg/imagetools/decompile.go - About 1 hr to fix

      Function BindPort has 62 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

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

        Function StatImageFile has 62 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func StatImageFile(vorteilImagePath string, imageFilePath string, seekOS bool) (StatFileReport, error) {
            var statOut StatFileReport
            vorteilImage, err := vdecompiler.Open(vorteilImagePath)
            if err != nil {
                return statOut, err
        Severity: Minor
        Found in pkg/imagetools/stat.go - About 1 hr to fix

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

          func (f *UintFlag) AddTo(flagSet *pflag.FlagSet) {
              if f.short == "" {
                  flagSet.UintVar(&f.Value, f.Key, f.Value, f.usage)
              } else {
                  flagSet.UintVarP(&f.Value, f.Key, f.short, f.Value, f.usage)
          Severity: Major
          Found in pkg/flag/int.go and 3 other locations - About 1 hr to fix
          pkg/flag/bool.go on lines 23..33
          pkg/flag/string.go on lines 195..205
          pkg/flag/string.go on lines 240..250

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

          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 4 locations. Consider refactoring.
          Open

          func (f *StringSliceFlag) AddTo(flagSet *pflag.FlagSet) {
              if f.short == "" {
                  flagSet.StringSliceVar(&f.Value, f.Key, f.Value, f.usage)
              } else {
                  flagSet.StringSliceVarP(&f.Value, f.Key, f.short, f.Value, f.usage)
          Severity: Major
          Found in pkg/flag/string.go and 3 other locations - About 1 hr to fix
          pkg/flag/bool.go on lines 23..33
          pkg/flag/int.go on lines 26..36
          pkg/flag/string.go on lines 195..205

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

          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 4 locations. Consider refactoring.
          Open

          func (f *StringFlag) AddTo(flagSet *pflag.FlagSet) {
              if f.short == "" {
                  flagSet.StringVar(&f.Value, f.Key, f.Value, f.usage)
              } else {
                  flagSet.StringVarP(&f.Value, f.Key, f.short, f.Value, f.usage)
          Severity: Major
          Found in pkg/flag/string.go and 3 other locations - About 1 hr to fix
          pkg/flag/bool.go on lines 23..33
          pkg/flag/int.go on lines 26..36
          pkg/flag/string.go on lines 240..250

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

          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 4 locations. Consider refactoring.
          Open

          func (f *BoolFlag) AddTo(flagSet *pflag.FlagSet) {
              if f.short == "" {
                  flagSet.BoolVar(&f.Value, f.Key, f.Value, f.usage)
              } else {
                  flagSet.BoolVarP(&f.Value, f.Key, f.short, f.Value, f.usage)
          Severity: Major
          Found in pkg/flag/bool.go and 3 other locations - About 1 hr to fix
          pkg/flag/int.go on lines 26..36
          pkg/flag/string.go on lines 195..205
          pkg/flag/string.go on lines 240..250

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

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

          func main() {
          
              defer cli.HandleErrors()
          
              // Init FOSS COMMANDS
          Severity: Minor
          Found in cmd/vorteil/main.go - About 1 hr to fix

            Function decompileImageRecursive has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
            Open

            func decompileImageRecursive(vorteilImage *vdecompiler.IO, report DecompileReport, symlinkCallbacks []func() error, ino int, rpath string, dpath string) (DecompileReport, []func() error, error) {
                var entries []*vdecompiler.DirectoryEntry
            
                inode, err := vorteilImage.ResolveInode(ino)
                if err != nil {
            Severity: Minor
            Found in pkg/imagetools/decompile.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 compiler.precompile has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
            Open

            func (c *compiler) precompile(ctx context.Context) error {
            
                var err error
            
                // alloc group sizes
            Severity: Minor
            Found in pkg/xfs/xfs.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 Virtualizer.Close has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
            Open

            func (v *Virtualizer) Close(force bool) error {
                v.logger.Debugf("Deleting VM")
                if force && v.state != virtualizers.Ready {
                    err := v.ForceStop()
                    if err != nil {
            Severity: Minor
            Found in pkg/virtualizers/vmware/virtualizer.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 CLIRemoteManager.get has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
            Open

            func (mgr *CLIRemoteManager) get(version CalVer) error {
            
                prog := mgr.log.NewProgress(fmt.Sprintf("Fetching kernel: %s", version.String()), "", 0)
                defer prog.Finish(false)
            
            
            Severity: Minor
            Found in pkg/vkern/cli.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

            Severity
            Category
            Status
            Source
            Language