Skip to content

Commit

Permalink
Fix a few linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Dec 22, 2023
1 parent 5d05957 commit a604815
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion encoder/golang/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (encoder *Encoder) EncodeDashboard(dashboard sdk.Board) (string, error) {

buffer := &bytes.Buffer{}
if err := file.Render(buffer); err != nil {
return "", nil
return "", err
}

return buffer.String(), nil
Expand Down
2 changes: 1 addition & 1 deletion encoder/golang/gauge.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (encoder *Encoder) encodeGaugeSettings(panel sdk.Panel) []jen.Code {
}

func (encoder *Encoder) encodeGaugeOrientation(panel sdk.Panel) jen.Code {
orientationConst := "OrientationAuto"
var orientationConst string
switch panel.GaugePanel.Options.Orientation {
case "":
orientationConst = "OrientationAuto"
Expand Down
1 change: 0 additions & 1 deletion encoder/golang/paneltargets.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func (encoder *Encoder) encodePrometheusTarget(target sdk.Target, grabanaPackage
formatConstName = "FormatTimeSeries"
default:
encoder.logger.Warn("unhandled prometheus target format: using 'time_series' instead", zap.String("format", target.Format))

}

// only emit code if the default isn't used
Expand Down
4 changes: 1 addition & 3 deletions encoder/golang/row.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ func (encoder *Encoder) encodeRow(row RowIR) *jen.Statement {
rowSettings = append(rowSettings, rowQual("Collapse").Call())
}

for _, panel := range row.Panels {
rowSettings = append(rowSettings, panel)
}
rowSettings = append(rowSettings, row.Panels...)

return dashboardQual("Row").MultiLineCall(rowSettings...)
}
Expand Down
8 changes: 5 additions & 3 deletions encoder/golang/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ func (encoder *Encoder) encodeStatFieldConfigDefaults(defaults sdk.FieldConfigDe
settings = append(settings, statQual("NoValue").Call(lit(defaults.NoValue)))
}

// TODO: thresholds
// RelativeThresholds/AbsoluteThresholds
if defaults.Thresholds.Mode != "" && len(defaults.Thresholds.Steps) != 0 {
// TODO: thresholds
}
/*
if defaults.Thresholds.Mode != "" && len(defaults.Thresholds.Steps) != 0 {
}
*/

return settings
}
Expand Down
8 changes: 4 additions & 4 deletions encoder/golang/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod

// Line interpolation mode
if fieldConfig.Defaults.Custom.DrawStyle == "line" {
lineInterpolationConst := "Linear"
var lineInterpolationConst string

switch fieldConfig.Defaults.Custom.LineInterpolation {
case "smooth":
Expand All @@ -193,7 +193,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod
}

// Tooltip mode
toolTipModeConst := "SingleSeries"
var toolTipModeConst string
switch panel.TimeseriesPanel.Options.Tooltip.Mode {
case "none":
toolTipModeConst = "NoSeries"
Expand All @@ -211,7 +211,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod
}

// Gradient mode
gradientModeConst := "Opacity"
var gradientModeConst string
switch fieldConfig.Defaults.Custom.GradientMode {
case "none":
gradientModeConst = "NoGradient"
Expand All @@ -231,7 +231,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod
}

// Stacking mode
stackingModeConst := "Unstacked"
var stackingModeConst string
switch fieldConfig.Defaults.Custom.Stacking.Mode {
case "none":
stackingModeConst = "Unstacked"
Expand Down

0 comments on commit a604815

Please sign in to comment.