Showing 57 of 79 total issues
Function run
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(cmd *cobra.Command, args []string) {
pathToInitialiseAt := path.Join(args...)
log.Debug("resolving provided path %s...", pathToInitialiseAt)
pathToInitialiseAt, resolvePathError := utils.ResolvePath(pathToInitialiseAt)
if resolvePathError != nil {
Function Download
has 11 return statements (exceeds 4 allowed). 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)
Function GetCommand
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetCommand() *cobra.Command {
cmd := cobra.Command{
Use: constants.NotificationsCanonicalNoun,
Aliases: constants.NotificationsAliases,
Short: "Initialises telegram notifications",
Function Init
has 10 return statements (exceeds 4 allowed). Open
func Init(atPath string) error {
directory := filepath.Dir(atPath)
filename := filepath.Base(atPath)
fullPath := path.Join(directory, filename)
fullPathInfo, checkFileError := os.Lstat(fullPath)
Function Unzip
has 10 return statements (exceeds 4 allowed). Open
func Unzip(options UnzipOptions) []error {
var err error
status := UnzipStatus{}
if options.Events == nil {
Function run
has a Cognitive Complexity of 24 (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
- Read upRead up
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 run
has a Cognitive Complexity of 24 (exceeds 20 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)
- Read upRead up
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 GetSSH
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func GetSSH(keysDirectory string) ([]Key, error) {
directoryList, readDirError := ioutil.ReadDir(keysDirectory)
if readDirError != nil {
return nil, fmt.Errorf("failed to list directory at '%s': %s", keysDirectory, readDirError)
}
- Read upRead up
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 9 return statements (exceeds 4 allowed). Open
func Untar(options UntarOptions) []error {
var err error
status := UntarStatus{}
if options.Events == nil {
Function run
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func run(command *cobra.Command, args []string) {
targetWorkspaceName := strings.Join(args, ".")
if len(targetWorkspaceName) == 0 {
command.Help()
workspaces := c.Global.Repositories.GetWorkspaces()
- Read upRead up
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 getOAuthCallbackHandler
has 8 return statements (exceeds 4 allowed). Open
func getOAuthCallbackHandler(res http.ResponseWriter, req *http.Request) {
requestID := uuid.New().String()
params := mux.Vars(req)
Function WatchNotifications
has 7 return statements (exceeds 4 allowed). Open
func WatchNotifications(
accounts []AccountConfig,
databaseConnection *sql.DB,
updateInterval time.Duration,
stop chan struct{},
Method Repository.GetPath
has 7 return statements (exceeds 4 allowed). Open
func (r Repository) GetPath(rootPath ...string) (string, error) {
// if :rootPath is defined, use that as the root instead of the current directory
storagePath := "."
if len(rootPath) > 0 {
storagePath = rootPath[0]
Method VSCode.WriteTo
has 7 return statements (exceeds 4 allowed). Open
func (vsc VSCode) WriteTo(workspacePath string, overwrite ...bool) error {
isOverwritable := false
if len(overwrite) > 0 {
isOverwritable = overwrite[0]
}
Function Check
has 7 return statements (exceeds 4 allowed). Open
func Check(atPath string) error {
absolutePath, resolvePathError := utils.ResolvePath(atPath)
if resolvePathError != nil {
return fmt.Errorf("failed to resolve path '%s': %s", atPath, resolvePathError)
}
Method GrantResponse.LoadFromJSON
has 6 return statements (exceeds 4 allowed). Open
func (r *GrantResponse) LoadFromJSON(responseBody []byte, mapping ...map[GrantResponseKey]string) error {
responseFieldMap := DefaultGrantResponseMapping
if len(mapping) > 0 {
responseFieldMap = mapping[0]
}
Function GetRemote
has 6 return statements (exceeds 4 allowed). Open
func GetRemote(fromGitRepositoryAt string, remoteNameMatcher ...string) (*Remote, error) {
// validation checks
gitPath := path.Join(fromGitRepositoryAt, "/.git")
fileInfo, err := os.Lstat(gitPath)
if err != nil {
Method Repository.GetWebsiteURL
has 6 return statements (exceeds 4 allowed). Open
func (r Repository) GetWebsiteURL() (string, error) {
switch true {
case validator.IsGitHTTPUrl(r.URL):
link, err := str.GetHttpLinkFromHttpCloneUrl(r.URL)
if err != nil {
Function ToSelect
has 6 return statements (exceeds 4 allowed). Open
func ToSelect(options InputOptions) (int, error) {
helper := InputHelper(options)
fmt.Printf("\n")
helper.PrintBeforeMessage()
fmt.Printf("\n")
Function ResolvePath
has 6 return statements (exceeds 4 allowed). Open
func ResolvePath(relativePathFragments ...string) (string, error) {
fullPath := path.Join(relativePathFragments...)
if len(fullPath) == 0 {
fullPath = "."
}