asteris-llc/converge

View on GitHub

Showing 615 of 615 total issues

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

func getParentSubgraph(subgraphs SubgraphMap, thisSubgraph SubgraphID, id string) SubgraphID {
    parent := graph.ParentID(id)
    if thisSubgraph == SubgraphBottomID {
        return SubgraphBottomID
    }
Severity: Major
Found in prettyprinters/subgraph_printer.go - About 35 mins to fix

    Method Content.Check has 5 return statements (exceeds 4 allowed).
    Open

    func (t *Content) Check(context.Context, resource.Renderer) (resource.TaskStatus, error) {
        diffs := make(map[string]resource.Diff)
        contentDiff := resource.TextDiff{Values: [2]string{"", t.Content}}
        stat, err := os.Stat(t.Destination)
        if os.IsNotExist(err) {
    Severity: Major
    Found in resource/file/content/content.go - About 35 mins to fix

      Method Printer.DrawNode has 5 return statements (exceeds 4 allowed).
      Open

      func (p *Printer) DrawNode(g *graph.Graph, id string) (pp.Renderable, error) {
          type printerNode struct {
              ID string
              *resource.HealthStatus
          }
      Severity: Major
      Found in prettyprinters/health/health.go - About 35 mins to fix

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

                t.Run("swap", func(t *testing.T) {
                    t.Parallel()
                    u := &Unit{Type: UnitTypeSwap, SwapProperties: &SwapTypeProperties{Result: "success"}}
                    actual, err := getFailedReason(u)
                    require.NoError(t, err)
        Severity: Major
        Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
        resource/systemd/unit/resource_test.go on lines 254..260
        resource/systemd/unit/resource_test.go on lines 261..267
        resource/systemd/unit/resource_test.go on lines 268..274
        resource/systemd/unit/resource_test.go on lines 275..281
        resource/systemd/unit/resource_test.go on lines 289..295

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

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

                t.Run("timer", func(t *testing.T) {
                    t.Parallel()
                    u := &Unit{Type: UnitTypeTimer, TimerProperties: &TimerTypeProperties{Result: "success"}}
                    actual, err := getFailedReason(u)
                    require.NoError(t, err)
        Severity: Major
        Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
        resource/systemd/unit/resource_test.go on lines 254..260
        resource/systemd/unit/resource_test.go on lines 261..267
        resource/systemd/unit/resource_test.go on lines 268..274
        resource/systemd/unit/resource_test.go on lines 275..281
        resource/systemd/unit/resource_test.go on lines 282..288

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

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

                m.On("CreateLogicalVolume", mock.Anything, mock.Anything, mock.Anything).Return(nil).Run(func(args mock.Arguments) {
                    // Put data about fresh "created" volume to `lvs`, to allow query device path from engine
                    m.LvsOutput = map[string]*lowlevel.LogicalVolume{
                        "data": &lowlevel.LogicalVolume{
                            Name:       "data",
        Severity: Minor
        Found in resource/lvm/lv/lv_test.go and 1 other location - About 35 mins to fix
        resource/lvm/lv/lv_test.go on lines 93..101

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

        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 getParams has 5 return statements (exceeds 4 allowed).
        Open

        func getParams(g *graph.Graph, id string, node *parse.Node) (out []string, err error) {
            var nodeStrings []string
            nodeStrings, err = node.GetStrings()
            if err != nil {
                return nil, err
        Severity: Major
        Found in load/dependencyresolver.go - About 35 mins to fix

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

          func RenderPredicate(meta *node.Node, renderFunc func(string, string) (string, error)) (string, error) {
              rendered, ok := meta.LookupMetadata(MetaRenderedPredicate)
              if ok {
                  return rendered.(string), nil
              }
          Severity: Major
          Found in graph/node/conditional/conditional.go - About 35 mins to fix

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

                    m.On("CreateLogicalVolume", mock.Anything, mock.Anything, mock.Anything).Return(nil).Run(func(args mock.Arguments) {
                        // Put data about fresh "created" volume to `lvs`, to allow query device path from engine
                        m.LvsOutput = map[string]*lowlevel.LogicalVolume{
                            "data": &lowlevel.LogicalVolume{
                                Name:       "data",
            Severity: Minor
            Found in resource/lvm/lv/lv_test.go and 1 other location - About 35 mins to fix
            resource/lvm/lv/lv_test.go on lines 56..64

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

            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 ParseSize has 5 return statements (exceeds 4 allowed).
            Open

            func ParseSize(sizeToParse string) (*LvmSize, error) {
                var err error
                size := &LvmSize{}
                if m := pctRE.FindStringSubmatch(sizeToParse); m != nil {
                    size.Relative = true
            Severity: Major
            Found in resource/lvm/lowlevel/size.go - About 35 mins to fix

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

              func HTTP(ctx context.Context, loc string) ([]byte, error) {
                  var client http.Client
                  req, err := http.NewRequest("GET", loc, nil)
                  if err != nil {
                      return nil, err
              Severity: Major
              Found in fetch/http.go - About 35 mins to fix

                Method resourceLV.Apply has 5 return statements (exceeds 4 allowed).
                Open

                func (r *resourceLV) Apply(context.Context) (resource.TaskStatus, error) {
                    status := &Status{}
                    if _, err := r.checkVG(true); err != nil {
                        return nil, err
                    }
                Severity: Major
                Found in resource/lvm/lv/lv.go - About 35 mins to fix

                  Method Printer.drawSubgraph has 5 return statements (exceeds 4 allowed).
                  Open

                  func (p Printer) drawSubgraph(g *graph.Graph, id SubgraphID, subgraph Subgraph) (Renderable, error) {
                      subgraphPrinter, spOK := p.pp.(SubgraphPrinter)
                      nodePrinter, npOK := p.pp.(NodePrinter)
                  
                      if !spOK && !npOK {
                  Severity: Major
                  Found in prettyprinters/subgraph_printer.go - About 35 mins to fix

                    Method Keystore.StoreTrustedKey has 5 return statements (exceeds 4 allowed).
                    Open

                    func (ks *Keystore) StoreTrustedKey(pubkeyBytes []byte) (string, error) {
                        if err := os.MkdirAll(ks.UserPath, 0755); err != nil {
                            return "", err
                        }
                    
                    
                    Severity: Major
                    Found in keystore/keystore.go - About 35 mins to fix

                      Method Printer.drawEdges has 5 return statements (exceeds 4 allowed).
                      Open

                      func (p Printer) drawEdges(g *graph.Graph) (Renderable, error) {
                          edgePrinter, epOK := p.pp.(EdgePrinter)
                          edgeSectionPrinter, espOK := p.pp.(EdgeSectionPrinter)
                      
                          if !epOK && !espOK {
                      Severity: Major
                      Found in prettyprinters/prettyprinter.go - About 35 mins to fix

                        Method Keystore.CheckSignature has 5 return statements (exceeds 4 allowed).
                        Open

                        func (ks *Keystore) CheckSignature(signed, signature io.Reader) error {
                            if ks.keyring == nil {
                                keyring, err := loadKeyring(ks)
                                if err != nil {
                                    return errors.Wrap(err, "error loading keyring")
                        Severity: Major
                        Found in keystore/keystore.go - About 35 mins to fix

                          Method pipelineGen.DependencyCheck has 5 return statements (exceeds 4 allowed).
                          Open

                          func (g *pipelineGen) DependencyCheck(ctx context.Context, taskI interface{}) (interface{}, error) {
                              result, ok := taskI.(resultWrapper)
                              if !ok {
                                  return nil, errors.New("input node is not a task wrapper")
                              }
                          Severity: Major
                          Found in apply/pipeline.go - About 35 mins to fix

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

                                    t.Run("service", func(t *testing.T) {
                                        t.Parallel()
                                        u := &Unit{Type: UnitTypeService, ServiceProperties: &ServiceTypeProperties{Result: "success"}}
                                        actual, err := getFailedReason(u)
                                        require.NoError(t, err)
                            Severity: Major
                            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
                            resource/systemd/unit/resource_test.go on lines 261..267
                            resource/systemd/unit/resource_test.go on lines 268..274
                            resource/systemd/unit/resource_test.go on lines 275..281
                            resource/systemd/unit/resource_test.go on lines 282..288
                            resource/systemd/unit/resource_test.go on lines 289..295

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

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

                                    t.Run("socket", func(t *testing.T) {
                                        t.Parallel()
                                        u := &Unit{Type: UnitTypeSocket, SocketProperties: &SocketTypeProperties{Result: "success"}}
                                        actual, err := getFailedReason(u)
                                        require.NoError(t, err)
                            Severity: Major
                            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
                            resource/systemd/unit/resource_test.go on lines 254..260
                            resource/systemd/unit/resource_test.go on lines 268..274
                            resource/systemd/unit/resource_test.go on lines 275..281
                            resource/systemd/unit/resource_test.go on lines 282..288
                            resource/systemd/unit/resource_test.go on lines 289..295

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

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

                                    t.Run("mount", func(t *testing.T) {
                                        t.Parallel()
                                        u := &Unit{Type: UnitTypeMount, MountProperties: &MountTypeProperties{Result: "success"}}
                                        actual, err := getFailedReason(u)
                                        require.NoError(t, err)
                            Severity: Major
                            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
                            resource/systemd/unit/resource_test.go on lines 254..260
                            resource/systemd/unit/resource_test.go on lines 261..267
                            resource/systemd/unit/resource_test.go on lines 275..281
                            resource/systemd/unit/resource_test.go on lines 282..288
                            resource/systemd/unit/resource_test.go on lines 289..295

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language