Showing 25 of 69 total issues
Method Impl.OnCommand
has a Cognitive Complexity of 36 (exceeds 6 allowed). Consider refactoring. Open
func (p Impl) OnCommand(item raw.Activity) (bool, error) {
_, isThisCommand := helpers.IsOnCommand(item.Text, []string{"ковид", "covid", "корона", "corona", "насморк"})
if !isThisCommand {
return false, 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
Method Impl.OnCommand
has 60 lines of code (exceeds 30 allowed). Consider refactoring. Open
func (p Impl) OnCommand(item raw.Activity) (bool, error) {
_, isThisCommand := helpers.IsOnCommand(item.Text, []string{"ковид", "covid", "корона", "corona", "насморк"})
if !isThisCommand {
return false, nil
Method zagadka.onZagadka
has 41 lines of code (exceeds 30 allowed). Consider refactoring. Open
func (p zagadka) onZagadka(item raw.Activity) {
SendMsg := func(message string) (int, error) {
return p.presenter.ShowMessage(output.ShowMessageData{ChatID: item.ChatID, Text: message})
}
Function isGoodChar
has a Cognitive Complexity of 12 (exceeds 6 allowed). Consider refactoring. Open
func isGoodChar(ch rune) bool {
if ch >= '0' && ch <= '9' {
return true
}
- 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 wordToKoKo
has 33 lines of code (exceeds 30 allowed). Consider refactoring. Open
func wordToKoKo(word string) string {
var res strings.Builder
wordLen := utf8.RuneCountInString(word)
Method impl.OnCommand
has 33 lines of code (exceeds 30 allowed). Consider refactoring. Open
func (p impl) OnCommand(item domain.Activity) (bool, error) {
msg, isThisCommand := helpers.IsOnCommand(item.Text, []string{"голосом", "голос", "гг"})
if !isThisCommand {
return false, nil
Method Impl.OnCommand
has 33 lines of code (exceeds 30 allowed). Consider refactoring. Open
func (p Impl) OnCommand(item raw.Activity) (bool, error) {
command, isThisCommand := helpers.IsOnCommand(item.Text, []string{"add_magic"})
if isThisCommand {
// here we should process internal add_magic\update_magic etc. commands
err := p.onAddMagic(command)
Function delectLang
has a Cognitive Complexity of 11 (exceeds 6 allowed). Consider refactoring. Open
func delectLang(message string) (bool, bool) {
// lets assume we are on qwerty keyboard
rus := 0
eng := 0
- 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
Method Search.SearchImage
has 31 lines of code (exceeds 30 allowed). Consider refactoring. Open
func (s Search) SearchImage(query string, searchDepth int) []string {
log.Printf("Searching for: %s\n", query)
hc := &http.Client{Transport: &transport.APIKey{Key: s.apiKey}}
Function GetTopComment
has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring. Open
func GetTopComment(messageID int, ownerID int, commentsCount int, minLikes int) string {
offset := 0
const blockSize = 100
if commentsCount == 0 {
- 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 wordToKoKo
has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring. Open
func wordToKoKo(word string) string {
var res strings.Builder
wordLen := utf8.RuneCountInString(word)
- 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
Method Search.SearchImage
has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring. Open
func (s Search) SearchImage(query string, searchDepth int) []string {
log.Printf("Searching for: %s\n", query)
hc := &http.Client{Transport: &transport.APIKey{Key: s.apiKey}}
- 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 wordToKoKo
has 8 return statements (exceeds 6 allowed). Open
func wordToKoKo(word string) string {
var res strings.Builder
wordLen := utf8.RuneCountInString(word)
Method MessageReader.activitiesProducer
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
func (r *MessageReader) activitiesProducer() error {
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
updates, err := r.bot.GetUpdatesChan(u)
- 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 getLoopaAndPoopaNews
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
func getLoopaAndPoopaNews(depth string) (string, error) {
parameters := make(map[string]string)
parameters["count"] = depth // message
parameters["domain"] = "pupa_and_lupa"
- 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
Method zagadka.onZagadka
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
func (p zagadka) onZagadka(item raw.Activity) {
SendMsg := func(message string) (int, error) {
return p.presenter.ShowMessage(output.ShowMessageData{ChatID: item.ChatID, Text: message})
}
- 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
Method impl.OnCommand
has 7 return statements (exceeds 6 allowed). Open
func (p impl) OnCommand(item raw.Activity) (bool, error) {
_, isThisCommand := helpers.IsOnCommand(item.Text, []string{"отпетуши", "петуши", "petushi", "otpetushi"})
if !isThisCommand || item.RepliedTo == nil {
return false, nil
Function textToSpeech
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
func textToSpeech(msg string) (string, error) {
convID := os.Getenv("IVONA_TEXT_TO_SPEECH_CONVERSATION_ID")
if len(convID) == 0 {
return "", fmt.Errorf("IVONA_TEXT_TO_SPEECH_CONVERSATION_ID env var is EMPTY!!!")
- 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 toString
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
func toString(num int64) string {
s := strconv.FormatInt(num, 10)
const devider int = 3
if len(s) <= devider {
return s
- 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
Method ActivityHandlerFacade.ProcessActivities
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
func (h *ActivityHandlerFacade) ProcessActivities(reader activities.IActivityReader) error {
for {
activity, err := reader.GetActivity()
if err != nil {
return err
- 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"