diff --git a/.circleci/config.yml b/.circleci/config.yml index 54c4545212f..a327cd009e4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -734,8 +734,10 @@ jobs: name: Lint Go command: | go vet ./pkg/... - # Adjust golangci-lint concurrency since it can run out of memory - golangci-lint run -v -j 2 --config scripts/go/configs/.golangci.yml ./pkg/... + golangci-lint run -v -j 2 --config scripts/go/configs/ci/.golangci.yml -E deadcode -E gofmt \ + -E gosimple -E ineffassign -E structcheck -E typecheck ./pkg/... + golangci-lint run -v -j 2 --config scripts/go/configs/ci/.golangci.yml -E unconvert -E unused \ + -E varcheck -E goconst -E errcheck -E staticcheck ./pkg/... ./scripts/go/bin/revive -formatter stylish -config ./scripts/go/configs/revive.toml ./pkg/... ./scripts/go/bin/revive -formatter stylish ./pkg/services/alerting/... ./scripts/go/bin/gosec -quiet -exclude=G104,G107,G108,G201,G202,G204,G301,G304,G401,G402,G501 \ diff --git a/public/app/core/components/FilterInput/FilterInput.tsx b/public/app/core/components/FilterInput/FilterInput.tsx index 5505166befa..0bf09eb494f 100644 --- a/public/app/core/components/FilterInput/FilterInput.tsx +++ b/public/app/core/components/FilterInput/FilterInput.tsx @@ -15,9 +15,9 @@ export const FilterInput = forwardRef((props, ref) => ( ref={ref} type="text" className={props.inputClassName} - value={unEscapeStringFromRegex(props.value)} + value={props.value ? unEscapeStringFromRegex(props.value) : ''} onChange={event => props.onChange(escapeStringForRegex(event.target.value))} - placeholder={props.placeholder ? props.placeholder : null} + placeholder={props.placeholder ?? ''} /> diff --git a/public/app/core/time_series2.ts b/public/app/core/time_series2.ts index e09c59ee062..1452863b84f 100644 --- a/public/app/core/time_series2.ts +++ b/public/app/core/time_series2.ts @@ -344,8 +344,8 @@ export default class TimeSeries { updateLegendValues(formater: ValueFormatter, decimals: DecimalCount, scaledDecimals: DecimalCount) { this.valueFormater = formater; - this.decimals = decimals; - this.scaledDecimals = scaledDecimals; + this.decimals = decimals ?? 0; + this.scaledDecimals = scaledDecimals ?? 0; } formatValue(value: number) { diff --git a/scripts/go/configs/ci/.golangci.yml b/scripts/go/configs/ci/.golangci.yml new file mode 100644 index 00000000000..7e5a604532b --- /dev/null +++ b/scripts/go/configs/ci/.golangci.yml @@ -0,0 +1,12 @@ +run: + timeout: 10m + +linters: + disable-all: true + +linters-settings: + goconst: + # minimal length of string constant, 3 by default + min-len: 5 + # minimal occurrences count to trigger, 3 by default + min-occurrences: 5