Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
4 months ago4 months old
func getTextAndDate has a cyclomatic complexity of 18 with "high" risk
199	y       int
200}
201
202func (widget *Widget) getTextAndDate(text string) (string, *time.Time) {203	now := time.Now()
204	textLower := strings.ToLower(text)
205	// check for "in X days/weeks/months/years" pattern
func encodeGetParams has a cyclomatic complexity of 17 with "high" risk
49	return nil
50}
51
52func encodeGetParams(params map[string]interface{}) string {53	s := url.Values{}
54	for k, v := range params {
55		switch val := v.(type) {
func nbascore has a cyclomatic complexity of 23 with "high" risk
 42	widget.Redraw(widget.nbascore)
 43}
 44
 45func (widget *Widget) nbascore() (string, string, bool) { 46	title := widget.CommonSettings().Title
 47	cur := time.Now().AddDate(0, 0, offset) // Go back/forward offset days
 48	curString := cur.Format("20060102")     // Need 20060102 format to feed to api
func displayStatus has a cyclomatic complexity of 18 with "high" risk
24	return title, str, false
25}
26
27func (widget *Widget) displayStatus() string {28	status, err := widget.client.MonStatus()
29
30	if err != nil || len(status.Lines) == 0 {
func MakeWidget has a cyclomatic complexity of 89 with "critical" risk
 91)
 92
 93// MakeWidget creates and returns instances of widgets
 94func MakeWidget( 95	tviewApp *tview.Application,
 96	pages *tview.Pages,
 97	moduleName string,