Skip to content

Commit

Permalink
running golangci-lint
Browse files Browse the repository at this point in the history
Signed-off-by: Navid Yaghoobi <[email protected]>
  • Loading branch information
navidys committed Oct 13, 2024
1 parent 12e9f95 commit 091fcae
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func (plot *Plot) drawAxesToScreen(screen tcell.Screen) {
}
}

//nolint:funlen,cyclop
func (plot *Plot) drawXAxisLabelsToScreen(
screen tcell.Screen, plotYAxisLabelsWidth int, x int, y int, width int, height int,
) {
Expand All @@ -297,8 +298,8 @@ func (plot *Plot) drawXAxisLabelsToScreen(

// determine the width needed for the largest label
maxXAxisLabelWidth := 0
for _, d := range plot.data {

for _, d := range plot.data {
for i := range d {
label := plot.xAxisLabelFunc(i)
labelMap[i] = label
Expand All @@ -313,11 +314,12 @@ func (plot *Plot) drawXAxisLabelsToScreen(
for i, label := range labelMap {
expectedLabelWidth := len(label)
if i == 0 {
expectedLabelWidth += plotXAxisLabelsGap / 2
expectedLabelWidth += plotXAxisLabelsGap / 2 //nolint:gomnd
} else {
expectedLabelWidth += plotXAxisLabelsGap
}
currentLabelStart := i - int(math.Round(float64(expectedLabelWidth)/2))

currentLabelStart := i - int(math.Round(float64(expectedLabelWidth)/2)) //nolint:gomnd
labelStartMap[i] = currentLabelStart
}

Expand All @@ -337,9 +339,9 @@ func (plot *Plot) drawXAxisLabelsToScreen(
labelWithGap := rawLabel

if i == 0 {
labelWithGap += strings.Repeat(gapRune, plotXAxisLabelsGap/2)
labelWithGap += strings.Repeat(gapRune, plotXAxisLabelsGap/2) //nolint:gomnd
} else {
labelWithGap = strings.Repeat(gapRune, plotXAxisLabelsGap/2) + labelWithGap + strings.Repeat(gapRune, plotXAxisLabelsGap/2)
labelWithGap = strings.Repeat(gapRune, plotXAxisLabelsGap/2) + labelWithGap + strings.Repeat(gapRune, plotXAxisLabelsGap/2) //nolint:lll,gomnd
}

expectedLabelWidth := len(labelWithGap)
Expand Down

0 comments on commit 091fcae

Please sign in to comment.