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{},
- 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 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 {
- 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 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,
- 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 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",
- 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 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 {
- 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 123 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Untar(options UntarOptions) []error {
var err error
status := UntarStatus{}
if options.Events == nil {
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 {
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"},
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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"},
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
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 {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
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)
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
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{},
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
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",
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",
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))