Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
9652a141
Unverified
Commit
9652a141
authored
Apr 16, 2020
by
Carl Bergquist
Committed by
GitHub
Apr 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build: Stricter linting should break the build (#23606)
parent
19f03e59
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
11 deletions
+41
-11
.circleci/config.yml
+5
-3
Makefile
+1
-0
pkg/services/alerting/conditions/query.go
+2
-2
pkg/services/alerting/notifiers/opsgenie_test.go
+4
-3
pkg/services/alerting/rule.go
+3
-3
scripts/go/configs/revive-strict.toml
+26
-0
No files found.
.circleci/config.yml
View file @
9652a141
...
...
@@ -731,9 +731,11 @@ jobs:
golangci-lint run -v -j 4 --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 ./pkg/services/alerting/...
./scripts/go/bin/revive -formatter stylish ./pkg/services/provisioning/datasources/...
./scripts/go/bin/revive -formatter stylish ./pkg/services/provisioning/dashboards/...
./scripts/go/bin/revive -formatter stylish -config ./scripts/go/configs/revive-strict.toml \
./pkg/services/alerting/... \
./pkg/services/provisioning/datasources/... \
./pkg/services/provisioning/dashboards/...
./scripts/go/bin/gosec -quiet -exclude=G104,G107,G108,G201,G202,G204,G301,G304,G401,G402,G501 \
-conf=./scripts/go/configs/gosec.json ./pkg/...
...
...
Makefile
View file @
9652a141
...
...
@@ -84,6 +84,7 @@ revive-alerting: scripts/go/bin/revive
@
echo
"lint alerting via revive"
@
scripts/go/bin/revive
\
-formatter
stylish
\
-config
./scripts/go/configs/revive-strict.toml
\
./pkg/services/alerting/...
\
./pkg/services/provisioning/datasources/...
\
./pkg/services/provisioning/dashboards/...
...
...
pkg/services/alerting/conditions/query.go
View file @
9652a141
...
...
@@ -127,7 +127,7 @@ func (c *QueryCondition) executeQuery(context *alerting.EvalContext, timeRange *
}
type
queryDto
struct
{
RefI
d
string
`json:"refId"`
RefI
D
string
`json:"refId"`
Model
*
simplejson
.
Json
`json:"model"`
Datasource
*
simplejson
.
Json
`json:"datasource"`
MaxDataPoints
int64
`json:"maxDataPoints"`
...
...
@@ -137,7 +137,7 @@ func (c *QueryCondition) executeQuery(context *alerting.EvalContext, timeRange *
queries
:=
[]
*
queryDto
{}
for
_
,
q
:=
range
req
.
Queries
{
queries
=
append
(
queries
,
&
queryDto
{
RefI
d
:
q
.
RefId
,
RefI
D
:
q
.
RefId
,
Model
:
q
.
Model
,
Datasource
:
simplejson
.
NewFromAny
(
map
[
string
]
interface
{}{
"id"
:
q
.
DataSource
.
Id
,
...
...
pkg/services/alerting/notifiers/opsgenie_test.go
View file @
9652a141
...
...
@@ -2,12 +2,13 @@ package notifiers
import
(
"context"
"testing"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/alerting"
.
"github.com/smartystreets/goconvey/convey"
"testing"
)
func
TestOpsGenieNotifier
(
t
*
testing
.
T
)
{
...
...
@@ -83,9 +84,9 @@ func TestOpsGenieNotifier(t *testing.T) {
receivedTags
:=
make
([]
string
,
0
)
bus
.
AddHandlerCtx
(
"alerting"
,
func
(
ctx
context
.
Context
,
cmd
*
models
.
SendWebhookSync
)
error
{
bodyJ
son
,
err
:=
simplejson
.
NewJson
([]
byte
(
cmd
.
Body
))
bodyJ
SON
,
err
:=
simplejson
.
NewJson
([]
byte
(
cmd
.
Body
))
if
err
==
nil
{
receivedTags
=
bodyJ
son
.
Get
(
"tags"
)
.
MustStringArray
([]
string
{})
receivedTags
=
bodyJ
SON
.
Get
(
"tags"
)
.
MustStringArray
([]
string
{})
}
return
err
})
...
...
pkg/services/alerting/rule.go
View file @
9652a141
...
...
@@ -173,16 +173,16 @@ func NewRuleFromDBAlert(ruleDef *models.Alert) (*Rule, error) {
}
func
translateNotificationIDToUID
(
id
int64
,
orgID
int64
)
(
string
,
error
)
{
notificationU
id
,
err
:=
getAlertNotificationUid
ByIDAndOrgID
(
id
,
orgID
)
notificationU
ID
,
err
:=
getAlertNotificationUID
ByIDAndOrgID
(
id
,
orgID
)
if
err
!=
nil
{
logger
.
Debug
(
"Failed to translate Notification Id to Uid"
,
"orgID"
,
orgID
,
"Id"
,
id
)
return
""
,
err
}
return
notificationU
id
,
nil
return
notificationU
ID
,
nil
}
func
getAlertNotificationU
id
ByIDAndOrgID
(
notificationID
int64
,
orgID
int64
)
(
string
,
error
)
{
func
getAlertNotificationU
ID
ByIDAndOrgID
(
notificationID
int64
,
orgID
int64
)
(
string
,
error
)
{
query
:=
&
models
.
GetAlertNotificationUidQuery
{
OrgId
:
orgID
,
Id
:
notificationID
,
...
...
scripts/go/configs/revive-strict.toml
0 → 100644
View file @
9652a141
ignoreGeneratedHeader
=
false
severity
=
"error"
confidence
=
0.8
errorCode
=
1
warningCode
=
1
[rule.context-as-argument]
[rule.error-return]
[rule.package-comments]
[rule.range]
[rule.superfluous-else]
[rule.modifies-parameter]
[rule.indent-error-flow]
[rule.error-strings]
[rule.error-naming]
[rule.exported]
[rule.unexported-return]
[rule.dot-imports]
[rule.receiver-naming]
[rule.blank-imports]
[rule.var-naming]
# This can be checked by other tools like megacheck
[rule.unreachable-code]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment