octomation/maintainer

View on GitHub

Showing 16 of 16 total issues

Function TableView has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TableView(
    cmd *cobra.Command,
    heats contribution.HeatMap,
    scope xtime.Range,
    opts ...func(time.Time, string) string,
Severity: Minor
Found in internal/command/github/contribution/helper.go - About 1 hr to fix

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

    func (r *packer) Unpack(file Input, ptr any) error {
        ext := strings.ToLower(filepath.Ext(file.Name()))
    
        r.guard.RLock()
        decoder, has := r.decoders[ext]
    Severity: Major
    Found in internal/pkg/io/packer.go and 1 other location - About 1 hr to fix
    internal/pkg/io/packer.go on lines 66..77

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

    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 (r *packer) Pack(file Output, data any) error {
        ext := strings.ToLower(filepath.Ext(file.Name()))
    
        r.guard.RLock()
        encoder, has := r.encoders[ext]
    Severity: Major
    Found in internal/pkg/io/packer.go and 1 other location - About 1 hr to fix
    internal/pkg/io/packer.go on lines 79..90

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

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

    func Suggest(cmd *cobra.Command, cnf *config.Tool) *cobra.Command {
        var (
            delta  bool
            short  bool
            target uint
    Severity: Minor
    Found in internal/command/github/contribution/suggest.go - About 1 hr to fix

      Function Suggest has 8 return statements (exceeds 4 allowed).
      Open

      func Suggest(cmd *cobra.Command, cnf *config.Tool) *cobra.Command {
          var (
              delta  bool
              short  bool
              target uint
      Severity: Major
      Found in internal/command/github/contribution/suggest.go - About 50 mins to fix

        Function Diff has 7 return statements (exceeds 4 allowed).
        Open

        func Diff(cmd *cobra.Command, cnf *config.Tool) *cobra.Command {
            cmd.Args = cobra.ExactArgs(2)
        
            isYear := regexp.MustCompile(`^\d{4}$`)
            wrap := func(err error, arg string) error {
        Severity: Major
        Found in internal/command/github/contribution/diff.go - About 45 mins to fix

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

          func New(cnf *config.Tool) *cobra.Command {
              command := cobra.Command{
                  Args:  cobra.NoArgs,
                  Use:   "hub",
                  Short: "fetch data from GitHub and Trello to manage it",
          Severity: Major
          Found in internal/command/hub/root.go - About 40 mins to fix

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

            func Everyday(intervals ...Interval) Schedule {
                assert.True(func() bool { return len(intervals) > 0 })
                sort.Slice(intervals, func(i, j int) bool {
                    assert.True(func() bool { return intervals[i].isValid() })
                    assert.True(func() bool { return intervals[j].isValid() })
            Severity: Major
            Found in internal/pkg/time/interval.go - About 40 mins to fix

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

              func Suggest(
                  heats HeatMap,
                  scope xtime.Range,
                  hours xtime.Schedule,
                  basis uint,
              Severity: Major
              Found in internal/model/github/contribution/suggest.go - About 40 mins to fix

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

                func NewVanityCommand() *cobra.Command {
                    command := cobra.Command{
                        Args:  cobra.NoArgs,
                        Use:   "vanity",
                        Short: "vanity URL manager",
                Severity: Major
                Found in internal/command/golang/vanity.go - About 35 mins to fix

                  Method Schedule.Suggest has 5 return statements (exceeds 4 allowed).
                  Open

                  func (s Schedule) Suggest(t time.Time) time.Time {
                      if len(s) == 0 || len(s[t.Weekday()]) == 0 {
                          return time.Time{}
                      }
                  
                  
                  Severity: Major
                  Found in internal/pkg/time/interval.go - About 35 mins to fix

                    Method Makefile.AppendTo has 5 return statements (exceeds 4 allowed).
                    Open

                    func (makefile Makefile) AppendTo(output io.Writer) error {
                        file, err := os.Open(makefile.Name())
                        if err != nil {
                            return err
                        }
                    Severity: Major
                    Found in internal/command/makefile/entity.go - About 35 mins to fix

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

                      func Histogram(cmd *cobra.Command, cnf *config.Tool) *cobra.Command {
                          var (
                              zero bool
                          )
                          cmd.Args = cobra.MaximumNArgs(1)
                      Severity: Major
                      Found in internal/command/github/contribution/histogram.go - About 35 mins to fix

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

                        func Snapshot(cmd *cobra.Command, cnf *config.Tool) *cobra.Command {
                            cmd.Args = cobra.MaximumNArgs(1)
                        
                            cmd.RunE = func(cmd *cobra.Command, args []string) error {
                                // dependencies and defaults
                        Severity: Major
                        Found in internal/command/github/contribution/snapshot.go - About 35 mins to fix

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

                          func FallbackDate(args []string) time.Time {
                              fallback := time.Now()
                              if len(args) > 0 {
                                  raw := strings.Split(args[0], "/")
                                  rawDate := raw[0]
                          Severity: Major
                          Found in internal/command/github/contribution/helper.go - About 35 mins to fix

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

                            func New(cnf *config.Tool) *cobra.Command {
                                command := cobra.Command{
                                    Args:  cobra.NoArgs,
                                    Use:   "github",
                                    Short: "GitHub manager",
                            Severity: Major
                            Found in internal/command/github/root.go - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language