Chore: Enable whitespace linter (#25903)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-07-06 20:17:28 +02:00
committed by GitHub
parent 42295898b8
commit 41d432b5ae
189 changed files with 3 additions and 303 deletions

View File

@@ -39,7 +39,6 @@ func AdminGetSettings(c *models.ReqContext) {
}
func AdminGetStats(c *models.ReqContext) {
statsQuery := models.GetAdminStatsQuery{}
if err := bus.Dispatch(&statsQuery); err != nil {

View File

@@ -21,7 +21,6 @@ const (
func TestAdminApiEndpoint(t *testing.T) {
role := models.ROLE_ADMIN
Convey("Given a server admin attempts to remove themself as an admin", t, func() {
updateCmd := dtos.AdminUpdateUserPermissionsForm{
IsGrafanaAdmin: false,
}

View File

@@ -13,7 +13,6 @@ import (
func TestAlertingApiEndpoint(t *testing.T) {
Convey("Given an alert in a dashboard with an acl", t, func() {
singleAlert := &models.Alert{Id: 1, DashboardId: 1, Name: "singlealert"}
bus.AddHandler("test", func(query *models.GetAlertByIdQuery) error {

View File

@@ -11,7 +11,6 @@ import (
)
func GetAnnotations(c *models.ReqContext) Response {
query := &annotations.ItemQuery{
From: c.QueryInt64("from"),
To: c.QueryInt64("to"),

View File

@@ -112,7 +112,6 @@ func (hs *HTTPServer) registerRoutes() {
// authed api
r.Group("/api", func(apiRoute routing.RouteRegister) {
// user (signed in)
apiRoute.Group("/user", func(userRoute routing.RouteRegister) {
userRoute.Get("/", Wrap(GetSignedInUser))
@@ -383,7 +382,6 @@ func (hs *HTTPServer) registerRoutes() {
// error test
r.Get("/metrics/error", Wrap(GenerateError))
}, reqSignedIn)
// admin api

View File

@@ -31,7 +31,6 @@ type NormalResponse struct {
}
func Wrap(action interface{}) macaron.Handler {
return func(c *models.ReqContext) {
var res Response
val, err := c.Invoke(action)
@@ -48,7 +47,6 @@ func Wrap(action interface{}) macaron.Handler {
func (r *NormalResponse) WriteTo(ctx *models.ReqContext) {
if r.err != nil {
ctx.Logger.Error(r.errMessage, "error", r.err, "remote_addr", ctx.RemoteAddr())
}
header := ctx.Resp.Header()

View File

@@ -458,7 +458,6 @@ func GetDashboardVersion(c *models.ReqContext) Response {
// POST /api/dashboards/calculate-diff performs diffs on two dashboards
func CalculateDashboardDiff(c *models.ReqContext, apiOptions dtos.CalculateDiffOptions) Response {
guardianBase := guardian.New(apiOptions.Base.DashboardId, c.OrgId, c.SignedInUser)
if canSave, err := guardianBase.CanSave(); err != nil || !canSave {
return dashboardGuardianResponse(err)

View File

@@ -716,7 +716,6 @@ func TestDashboardApiEndpoint(t *testing.T) {
})
Convey("Post dashboard response tests", t, func() {
// This tests that a valid request returns correct response
Convey("Given a correct request for creating a dashboard", func() {
@@ -953,7 +952,6 @@ func TestDashboardApiEndpoint(t *testing.T) {
})
Convey("Given provisioned dashboard", t, func() {
bus.AddHandler("test", func(query *models.GetDashboardsBySlugQuery) error {
query.Result = []*models.Dashboard{{}}
return nil
@@ -1062,7 +1060,6 @@ func GetDashboardShouldReturn200(sc *scenarioContext) dtos.DashboardFullWithMeta
}
func CallGetDashboard(sc *scenarioContext, hs *HTTPServer) {
sc.handlerFunc = hs.GetDashboard
sc.fakeReqWithParams("GET", sc.url, map[string]string{}).exec()
}

View File

@@ -225,7 +225,6 @@ func fillWithSecureJSONData(cmd *models.UpdateDataSourceCommand) error {
secureJSONData := ds.SecureJsonData.Decrypt()
for k, v := range secureJSONData {
if _, ok := cmd.SecureJsonData[k]; !ok {
cmd.SecureJsonData[k] = v
}

View File

@@ -19,7 +19,6 @@ const (
func TestDataSourcesProxy(t *testing.T) {
Convey("Given a user is logged in", t, func() {
loggedInUserScenario("When calling GET on", "/api/datasources/", func(sc *scenarioContext) {
// Stubs the database query
bus.AddHandler("test", func(query *models.GetDataSourcesQuery) error {
So(query.OrgId, ShouldEqual, TestOrgID)

View File

@@ -93,7 +93,6 @@ func (c *connection) handleMessage(message []byte) {
case "unsubscribe":
c.hub.subChannel <- &streamSubscription{name: streamName, conn: c, remove: true}
}
}
func (c *connection) write(mt int, payload []byte) error {

View File

@@ -88,7 +88,6 @@ func NewStream(name string) *Stream {
}
func (s *Stream) Push(packet *models.StreamPacket) {
messageBytes, _ := simplejson.NewFromAny(packet).Encode()
for _, sub := range s.subscribers {

View File

@@ -30,7 +30,6 @@ import (
)
func TestDSRouteRule(t *testing.T) {
Convey("DataSourceProxy", t, func() {
Convey("Plugin with routes", func() {
plugin := &plugins.DataSourcePlugin{

View File

@@ -60,7 +60,6 @@ func NewApiPluginProxy(ctx *models.ReqContext, proxyPath string, route *plugins.
targetURL, _ := url.Parse(route.URL)
director := func(req *http.Request) {
req.URL.Scheme = targetURL.Scheme
req.URL.Host = targetURL.Host
req.Host = targetURL.Host

View File

@@ -13,7 +13,6 @@ import (
)
func TestPluginProxy(t *testing.T) {
Convey("When getting proxy headers", t, func() {
route := &plugins.AppPluginRoute{
Headers: []plugins.AppPluginRouteHeader{
@@ -129,7 +128,6 @@ func TestPluginProxy(t *testing.T) {
So(route.URL, ShouldEqual, "{{.JsonData.dynamicUrl}}")
})
})
}
// getPluginProxiedRequest is a helper for easier setup of tests based on global config and ReqContext.

View File

@@ -8,7 +8,6 @@ import (
// POST /api/preferences/set-home-dash
func SetHomeDashboard(c *models.ReqContext, cmd models.SavePreferencesCommand) Response {
cmd.UserId = c.UserId
cmd.OrgId = c.OrgId

View File

@@ -72,10 +72,8 @@ type routeRegister struct {
}
func (rr *routeRegister) Insert(pattern string, fn func(RouteRegister), handlers ...macaron.Handler) {
//loop over all groups at current level
for _, g := range rr.groups {
// apply routes if the prefix matches the pattern
if g.prefix == pattern {
g.Group("", fn)

View File

@@ -108,7 +108,6 @@ func TestRouteGroupedRegister(t *testing.T) {
user.Group("/admin", func(admin RouteRegister) {
admin.Delete("", emptyHandler("3"))
admin.Get("/all", emptyHandler("3"), emptyHandler("4"), emptyHandler("5"))
}, emptyHandler("3"))
})
@@ -235,7 +234,6 @@ func TestNamedMiddlewareRouteRegister(t *testing.T) {
user.Group("/admin", func(admin RouteRegister) {
admin.Delete("", emptyHandler("3"))
admin.Get("/all", emptyHandler("3"), emptyHandler("4"), emptyHandler("5"))
}, emptyHandler("3"))
})

View File

@@ -24,7 +24,6 @@ func StarDashboard(c *models.ReqContext) Response {
}
func UnstarDashboard(c *models.ReqContext) Response {
cmd := models.UnstarDashboardCommand{UserId: c.UserId, DashboardId: c.ParamsInt64(":id")}
if cmd.DashboardId <= 0 {