zephinzer/dev

View on GitHub

Showing 57 of 79 total issues

Function WatchNotifications has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    accessToken string,
    fromProjects Projects,
    databaseConnection *sql.DB,
    updateInterval time.Duration,
    stop chan struct{},
Severity: Minor
Found in internal/pivotaltracker/watchers.go - About 35 mins to fix

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

    func WatchNotifications(
        accessToken string,
        fromProjects Projects,
        databaseConnection *sql.DB,
        updateInterval time.Duration,
    Severity: Major
    Found in internal/pivotaltracker/watchers.go - About 35 mins to fix

      Function GetAccount has 5 return statements (exceeds 4 allowed).
      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 - About 35 mins to fix

        Function run has a Cognitive Complexity of 22 (exceeds 20 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 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

        Function GetTodos has 5 return statements (exceeds 4 allowed).
        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 - About 35 mins to fix

          Method GrantRequest.Do has 5 return statements (exceeds 4 allowed).
          Open

          func (r GrantRequest) Do(mapping ...map[GrantRequestKey]string) (*GrantResponse, error) {
              client := http.Client{Timeout: time.Second * 5}
              request, getRequestError := r.GetRequest(mapping...)
              if getRequestError != nil {
                  return nil, fmt.Errorf("failed to create request: %s", getRequestError)
          Severity: Major
          Found in pkg/oauth/grant_request.go - About 35 mins to fix

            Method TodoSerializer.GetMessage has 5 return statements (exceeds 4 allowed).
            Open

            func (ts TodoSerializer) GetMessage() string {
                targetType := ts.getTargetType()
                createdAt := humanize.Time(ts.CreatedAt)
                switch ts.ActionName {
                case "assigned":
            Severity: Major
            Found in internal/gitlab/todos.go - About 35 mins to fix

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

              func GetAccount(client request.Doer, accessToken string) (*APIv3UserResponse, error) {
                  requestObject, requestError := request.Create(request.CreateOptions{
                      URL: "https://api.github.com/user",
                      Headers: map[string][]string{
                          "Accept":        {"application/vnd.github.v3+json"}, // as requested at https://developer.github.com/v3/#current-version
              Severity: Major
              Found in pkg/github/account.go - About 35 mins to fix

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

                func ApplyMigrations(tableName string, migrations []string, databasePath string) error {
                    connection, newConnectionError := NewConnection(databasePath)
                    defer connection.Close()
                    if newConnectionError != nil {
                        return newConnectionError
                Severity: Major
                Found in internal/db/migrate.go - About 35 mins to fix

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

                  func NewFromFile(filePath string) (*Config, error) {
                      var configuration Config
                  
                      absoluteFilePath, resolvePathError := utils.ResolvePath(filePath)
                      if resolvePathError != nil {
                  Severity: Major
                  Found in internal/config/utils.go - About 35 mins to fix

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

                    func GetNotifications(client request.Doer, accessToken string, since ...time.Time) (*APIv3Notifications, error) {
                        dateSinceFilter := time.Now().Add(-time.Hour * 24 * 365)
                        if len(since) > 0 {
                            dateSinceFilter = since[0]
                        }
                    Severity: Major
                    Found in pkg/github/notifications.go - About 35 mins to fix

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

                      func GetStories(accessToken string, inProjectID string, since ...time.Time) (*APIv5StoriesResponse, error) {
                          accountInfo, accountInfoError := GetAccount(accessToken)
                          if accountInfoError != nil {
                              return nil, accountInfoError
                          }
                      Severity: Major
                      Found in pkg/pivotaltracker/stories.go - About 35 mins to fix

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

                        func GetCommand() *cobra.Command {
                            cmd := cobra.Command{
                                Use:     constants.MergeRequestNoun,
                                Short:   "opens the browser to a merge/pull request at this repository's url",
                                Aliases: constants.MergeRequestAliases,
                        Severity: Major
                        Found in cmd/dev/open/merge_request/command.go - About 35 mins to fix

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

                          func GetFiles(opt ...GetFilesOptions) ([]string, error) {
                              configurationFiles := []string{}
                          
                              // local configurations
                              contextualConfigPath, getWdError := os.Getwd()
                          Severity: Major
                          Found in internal/config/utils.go - About 35 mins to fix

                            Method Repositories.Less has 5 return statements (exceeds 4 allowed).
                            Open

                            func (r Repositories) Less(i, j int) bool {
                                if len(r[i].Name) > 0 && len(r[j].Name) > 0 {
                                    comparison := strings.Compare(r[i].Name, r[j].Name)
                                    if comparison != 0 {
                                        return comparison <= 0
                            Severity: Major
                            Found in internal/config/repositories.go - About 35 mins to fix

                              Function Download has a Cognitive Complexity of 22 (exceeds 20 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 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

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

                              func GetCommand() *cobra.Command {
                                  cmd := cobra.Command{
                                      Use:     constants.AccountCanonicalNoun,
                                      Aliases: constants.AccountAliases,
                                      Short:   "Retrieves account information from Pivotal Tracker",
                              Severity: Minor
                              Found in cmd/dev/get/pivotaltracker/account/command.go - About 25 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

                              Severity
                              Category
                              Status
                              Source
                              Language