Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Ressel <[email protected]>
  • Loading branch information
markusressel committed Oct 13, 2024
1 parent fb7e4a8 commit 12e9f95
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
// determine the width needed for the largest label
maxXAxisLabelWidth := 0
for _, d := range plot.data {

Check failure on line 300 in plot.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary leading newline (whitespace)

for i := range d {
label := plot.xAxisLabelFunc(i)
labelMap[i] = label
Expand All @@ -324,6 +325,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
// stopping when there is no more space
lastUsedLabelEnd := math.MinInt
initialOffset := xAxisAreaStartX

for i := 0; i < maxDataPoints; i++ {
labelStart := labelStartMap[i]
if labelStart < lastUsedLabelEnd {
Expand All @@ -333,6 +335,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(

rawLabel := labelMap[i]
labelWithGap := rawLabel

if i == 0 {
labelWithGap += strings.Repeat(gapRune, plotXAxisLabelsGap/2)

Check failure on line 340 in plot.go

View workflow job for this annotation

GitHub Actions / golangci-lint

mnd: Magic number: 2, in <argument> detected (gomnd)
} else {
Expand All @@ -341,6 +344,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(

expectedLabelWidth := len(labelWithGap)
remainingWidth := xAxisAvailableWidth - labelStart

if expectedLabelWidth > remainingWidth {
// the label would be too long to fit in the remaining space
if expectedLabelWidth-1 <= remainingWidth {
Expand Down

0 comments on commit 12e9f95

Please sign in to comment.