zephinzer/dev

View on GitHub

Showing 69 of 79 total issues

Function WatchNotifications has a Cognitive Complexity of 64 (exceeds 20 allowed). Consider refactoring.
Open

func WatchNotifications(
    accounts []AccountConfig,
    databaseConnection *sql.DB,
    updateInterval time.Duration,
    stop chan struct{},
Severity: Minor
Found in internal/gitlab/watchers.go - About 7 hrs 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

Function Untar has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
Open

func Untar(options UntarOptions) []error {
    var err error
    status := UntarStatus{}

    if options.Events == nil {
Severity: Minor
Found in pkg/utils/untar.go - About 5 hrs 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

Function WatchNotifications has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
Open

func WatchNotifications(
    accessToken string,
    fromProjects Projects,
    databaseConnection *sql.DB,
    updateInterval time.Duration,
Severity: Minor
Found in internal/pivotaltracker/watchers.go - About 5 hrs 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

Function GetCommand has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
Open

func GetCommand() *cobra.Command {
    cmd := cobra.Command{
        Use:     constants.SoftwareCanonicalNoun,
        Aliases: constants.SoftwareAliases,
        Short:   "verifies that required software specified in the configuration is installed",
Severity: Minor
Found in cmd/dev/check/software/command.go - About 4 hrs 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

Function Unzip has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
Open

func Unzip(options UnzipOptions) []error {
    var err error
    status := UnzipStatus{}

    if options.Events == nil {
Severity: Minor
Found in pkg/utils/unzip.go - About 4 hrs 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

Function Untar has 123 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func Untar(options UntarOptions) []error {
    var err error
    status := UntarStatus{}

    if options.Events == nil {
Severity: Major
Found in pkg/utils/untar.go - About 3 hrs to fix

    Function Unzip has 102 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func Unzip(options UnzipOptions) []error {
        var err error
        status := UnzipStatus{}
    
        if options.Events == nil {
    Severity: Major
    Found in pkg/utils/unzip.go - About 3 hrs to fix

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

      func GetAccount(client request.Doer, hostname, accessToken string) (*APIv4UserResponse, error) {
          requestObject, createRequestError := request.Create(request.CreateOptions{
              URL: fmt.Sprintf("https://%s/api/v4/user", hostname),
              Headers: map[string][]string{
                  "Content-Type":  {"application/json"},
      Severity: Major
      Found in pkg/gitlab/account.go and 1 other location - About 2 hrs to fix
      pkg/gitlab/todos.go on lines 12..38

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

      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 GetTodos(client request.Doer, hostname, accessToken string, since ...time.Time) (*APIv4TodoResponse, error) {
          requestObject, createRequestError := request.Create(request.CreateOptions{
              URL: fmt.Sprintf("https://%s/api/v4/todos", hostname),
              Headers: map[string][]string{
                  "Content-Type":  {"application/json"},
      Severity: Major
      Found in pkg/gitlab/todos.go and 1 other location - About 2 hrs to fix
      pkg/gitlab/account.go on lines 11..37

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

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

      func run(command *cobra.Command, args []string) {
          if len(args) == 0 {
              command.Help()
              log.Errorf("no repository url(s) specified, see usage above for how to use this command")
              os.Exit(1)
      Severity: Major
      Found in cmd/dev/add/repository/command.go - About 2 hrs to fix

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

        package gitlab
        
        // Config defines the structure of the configuration for the
        // Gitlab integration
        type Config struct {
        Severity: Major
        Found in internal/gitlab/config.go and 1 other location - About 2 hrs to fix
        internal/github/config.go on lines 1..31

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

        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

        package github
        
        // Config defines the structure of the configuration
        // for the github platform
        type Config struct {
        Severity: Major
        Found in internal/github/config.go and 1 other location - About 2 hrs to fix
        internal/gitlab/config.go on lines 1..31

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

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

        func getOAuthCallbackHandler(res http.ResponseWriter, req *http.Request) {
            requestID := uuid.New().String()
        
            params := mux.Vars(req)
        
        
        Severity: Major
        Found in cmd/dev/start/server/get_oauth_callback.go - About 2 hrs to fix

          Function Download has 69 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func Download(options DownloadOptions) error {
              downloadStatus := DownloadStatus{}
              tmpFilePath := options.FilePath + ".download_" + time.Now().Format("20060102150405")
              if options.Events == nil {
                  options.Events = make(chan DownloadEvent, 16)
          Severity: Minor
          Found in pkg/utils/network/download.go - About 1 hr to fix

            Function run has 67 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func run(command *cobra.Command, args []string) {
                if config.Global.Repositories == nil {
                    log.Error("no repositories have been defined")
                    os.Exit(1)
                    return
            Severity: Minor
            Found in cmd/dev/install/repository/command.go - About 1 hr to fix

              Function WatchNotifications has 67 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func WatchNotifications(
                  accounts []AccountConfig,
                  databaseConnection *sql.DB,
                  updateInterval time.Duration,
                  stop chan struct{},
              Severity: Minor
              Found in internal/gitlab/watchers.go - About 1 hr to fix

                Function run has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func run(command *cobra.Command, args []string) {
                    if config.Global.Repositories == nil {
                        log.Error("no repositories have been defined")
                        os.Exit(1)
                        return
                Severity: Minor
                Found in cmd/dev/check/repositories/command.go - About 1 hr to fix

                  Function GetCommand has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func GetCommand() *cobra.Command {
                      cmd := cobra.Command{
                          Use:     constants.ClientCanonicalNoun,
                          Aliases: constants.ClientAliases,
                          Short:   "starts the dev client as a background process to provide notifications",
                  Severity: Minor
                  Found in cmd/dev/start/client/command.go - About 1 hr to fix

                    Function GetCommand has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func GetCommand() *cobra.Command {
                        cmd := cobra.Command{
                            Use:     constants.SoftwareCanonicalNoun,
                            Aliases: constants.SoftwareAliases,
                            Short:   "verifies that required software specified in the configuration is installed",
                    Severity: Minor
                    Found in cmd/dev/check/software/command.go - About 1 hr to fix

                      Function startFuzzySearchInterface has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func startFuzzySearchInterface() {
                          links := config.Global.Links
                          repositories := config.Global.Repositories
                          for _, link := range links {
                              searchTerms = append(searchTerms, fmt.Sprintf("%s [%s] @ %s", link.Label, strings.Join(link.Categories, ", "), link.URL))
                      Severity: Minor
                      Found in cmd/dev/go_to/gui.go - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language