vorteil/vorteil

View on GitHub
pkg/vconvert/vconvert.go

Summary

Maintainability
B
4 hrs
Test Coverage
F
0%

Method ContainerConverter.createVCFG has 73 lines of code (exceeds 50 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 1 hr to fix

    Method ContainerConverter.untarLayers has 8 return statements (exceeds 4 allowed).
    Open

    func (cc *ContainerConverter) untarLayers(targetDir string) error {
    
        err := checkDirectory(targetDir)
        if err != nil {
            return err
    Severity: Major
    Found in pkg/vconvert/vconvert.go - About 50 mins to fix

      Method ContainerConverter.ConvertToProject has 8 return statements (exceeds 4 allowed).
      Open

      func (cc *ContainerConverter) ConvertToProject(dst, user, pwd string) error {
      
          // check if folder exists
          err := checkDirectory(dst)
          if err != nil {
      Severity: Major
      Found in pkg/vconvert/vconvert.go - About 50 mins to fix

        Method ContainerConverter.createVCFG has 7 return statements (exceeds 4 allowed).
        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: Major
        Found in pkg/vconvert/vconvert.go - About 45 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

          TODO found
          Open

                  if _, err := archive.Apply(context.TODO(), targetDir, r, archive.WithFilter(func(hdr *tar.Header) (bool, error) {
          Severity: Minor
          Found in pkg/vconvert/vconvert.go by fixme

          There are no issues that match your filters.

          Category
          Status