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
-1
View File
@@ -217,7 +217,6 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I
} else {
sql.WriteString(fmt.Sprintf(" AND (%s) = %d ", tagsSubQuery, len(tags)))
}
}
}
-1
View File
@@ -279,7 +279,6 @@ func TestAnnotations(t *testing.T) {
So(len(items), ShouldEqual, 0)
})
})
})
})
}
-1
View File
@@ -27,7 +27,6 @@ func TestApiKeyDataAccess(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, query.Result)
})
})
t.Run("Add non expiring key", func(t *testing.T) {
-2
View File
@@ -73,9 +73,7 @@ func GetDashboardAclInfoList(query *models.GetDashboardAclInfoListQuery) error {
WHERE da.dashboard_id = -1`
query.Result = make([]*models.DashboardAclInfoDTO, 0)
err = x.SQL(sql).Find(&query.Result)
} else {
rawSQL := `
-- get permissions for the dashboard and its parent folder
SELECT
@@ -129,7 +129,6 @@ func TestIntegratedDashboardService(t *testing.T) {
// Given user has no permission to save
permissionScenario("Given user has no permission to save", false, func(sc *dashboardPermissionScenarioContext) {
Convey("When creating a new dashboard in the General folder", func() {
cmd := models.SaveDashboardCommand{
OrgId: testOrgId,
@@ -370,7 +369,6 @@ func TestIntegratedDashboardService(t *testing.T) {
// Given user has permission to save
permissionScenario("Given user has permission to save", true, func(sc *dashboardPermissionScenarioContext) {
Convey("and overwrite flag is set to false", func() {
shouldOverwrite := false
@@ -39,7 +39,6 @@ func DeleteExpiredSnapshots(cmd *models.DeleteExpiredSnapshotsCommand) error {
func CreateDashboardSnapshot(cmd *models.CreateDashboardSnapshotCommand) error {
return inTransaction(func(sess *DBSession) error {
// never
var expires = time.Now().Add(time.Hour * 24 * 365 * 50)
if cmd.Expires > 0 {
@@ -12,7 +12,6 @@ import (
)
func TestDashboardSnapshotDBAccess(t *testing.T) {
Convey("Testing DashboardSnapshot data access", t, func() {
InitTestDB(t)
-1
View File
@@ -205,7 +205,6 @@ func UpdateDataSource(cmd *models.UpdateDataSourceCommand) error {
// updates to datasources using the datasource.yaml file without knowing exactly what version
// a datasource have in the db.
updateSession = sess.Where("id=? and org_id=? and version < ?", ds.Id, ds.OrgId, ds.Version)
} else {
updateSession = sess.Where("id=? and org_id=?", ds.Id, ds.OrgId)
}
@@ -5,7 +5,6 @@ import (
)
func addAlertMigrations(mg *Migrator) {
alertV1 := Table{
Name: "alert",
Columns: []*Column{
@@ -6,7 +6,6 @@ import (
)
func addAnnotationMig(mg *Migrator) {
table := Table{
Name: "annotation",
Columns: []*Column{
@@ -219,5 +219,4 @@ func addDashboardMigration(mg *Migrator) {
Cols: []string{"title"},
Type: IndexType,
}))
}
@@ -3,7 +3,6 @@ package migrations
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func addAppSettingsMigration(mg *Migrator) {
pluginSettingTable := Table{
Name: "plugin_setting",
Columns: []*Column{
@@ -3,7 +3,6 @@ package migrations
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func addPreferencesMigrations(mg *Migrator) {
mg.AddMigration("drop preferences table v2", NewDropTableMigration("preferences"))
preferencesV2 := Table{
@@ -5,7 +5,6 @@ import (
)
func addQuotaMigration(mg *Migrator) {
var quotaV1 = Table{
Name: "quota",
Columns: []*Column{
@@ -3,7 +3,6 @@ package migrations
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func addTagMigration(mg *Migrator) {
tagTable := Table{
Name: "tag",
Columns: []*Column{
-2
View File
@@ -91,7 +91,6 @@ func isOrgNameTaken(name string, existingId int64, sess *DBSession) (bool, error
func CreateOrg(cmd *models.CreateOrgCommand) error {
return inTransaction(func(sess *DBSession) error {
if isNameTaken, err := isOrgNameTaken(cmd.Name, 0, sess); err != nil {
return err
} else if isNameTaken {
@@ -131,7 +130,6 @@ func CreateOrg(cmd *models.CreateOrgCommand) error {
func UpdateOrg(cmd *models.UpdateOrgCommand) error {
return inTransaction(func(sess *DBSession) error {
if isNameTaken, err := isOrgNameTaken(cmd.Name, cmd.OrgId, sess); err != nil {
return err
} else if isNameTaken {
-2
View File
@@ -114,7 +114,6 @@ func TestAccountDataAccess(t *testing.T) {
So(err, ShouldBeNil)
So(orgUsersQuery.Result[1].Role, ShouldEqual, models.ROLE_ADMIN)
})
Convey("Can get logged in user projection", func() {
@@ -282,7 +281,6 @@ func TestAccountDataAccess(t *testing.T) {
So(permQuery.Result[0].OrgId, ShouldEqual, ac3.OrgId)
So(permQuery.Result[0].UserId, ShouldEqual, ac3.Id)
})
})
})
})
-1
View File
@@ -9,7 +9,6 @@ import (
)
func TestPlaylistDataAccess(t *testing.T) {
Convey("Testing Playlist data access", t, func() {
InitTestDB(t)
-2
View File
@@ -107,9 +107,7 @@ func UpdatePluginSetting(cmd *models.UpdatePluginSettingCmd) error {
func UpdatePluginSettingVersion(cmd *models.UpdatePluginSettingVersionCmd) error {
return inTransaction(func(sess *DBSession) error {
_, err := sess.Exec("UPDATE plugin_setting SET plugin_version=? WHERE org_id=? AND plugin_id=?", cmd.PluginVersion, cmd.OrgId, cmd.PluginId)
return err
})
}
-1
View File
@@ -80,7 +80,6 @@ func GetPreferences(query *models.GetPreferencesQuery) error {
func SavePreferences(cmd *models.SavePreferencesCommand) error {
return inTransaction(func(sess *DBSession) error {
var prefs models.Preferences
exists, err := sess.Where("org_id=? AND user_id=? AND team_id=?", cmd.OrgId, cmd.UserId, cmd.TeamId).Get(&prefs)
if err != nil {
-2
View File
@@ -10,7 +10,6 @@ import (
)
func TestQuotaCommandsAndQueries(t *testing.T) {
Convey("Testing Quota commands & queries", t, func() {
InitTestDB(t)
userId := int64(1)
@@ -101,7 +100,6 @@ func TestQuotaCommandsAndQueries(t *testing.T) {
}
So(res.Limit, ShouldEqual, limit)
So(res.Used, ShouldEqual, used)
}
})
})
-1
View File
@@ -13,7 +13,6 @@ func init() {
}
func sqlRandomWalk(m1 string, m2 string, intWalker int64, floatWalker float64, sess *DBSession) error {
timeWalker := time.Now().UTC().Add(time.Hour * -200)
now := time.Now().UTC()
step := time.Minute
-1
View File
@@ -29,7 +29,6 @@ func (sb *SqlBuilder) AddParams(params ...interface{}) {
}
func (sb *SqlBuilder) writeDashboardPermissionFilter(user *models.SignedInUser, permission models.PermissionType) {
if user.OrgRole == models.ROLE_ADMIN {
return
}
-1
View File
@@ -35,7 +35,6 @@ func StarDashboard(cmd *models.StarDashboardCommand) error {
}
return inTransaction(func(sess *DBSession) error {
entity := models.Star{
UserId: cmd.UserId,
DashboardId: cmd.DashboardId,
-1
View File
@@ -8,7 +8,6 @@ import (
)
func TestUserStarsDataAccess(t *testing.T) {
Convey("Testing User Stars Data Access", t, func() {
InitTestDB(t)
-2
View File
@@ -48,7 +48,6 @@ func getTeamSelectSqlBase() string {
func CreateTeam(cmd *models.CreateTeamCommand) error {
return inTransaction(func(sess *DBSession) error {
if isNameTaken, err := isTeamNameTaken(cmd.OrgId, cmd.Name, 0, sess); err != nil {
return err
} else if isNameTaken {
@@ -73,7 +72,6 @@ func CreateTeam(cmd *models.CreateTeamCommand) error {
func UpdateTeam(cmd *models.UpdateTeamCommand) error {
return inTransaction(func(sess *DBSession) error {
if isNameTaken, err := isTeamNameTaken(cmd.OrgId, cmd.Name, cmd.Id, sess); err != nil {
return err
} else if isNameTaken {
-1
View File
@@ -11,7 +11,6 @@ import (
)
func TestTeamCommandsAndQueries(t *testing.T) {
Convey("Testing Team commands & queries", t, func() {
InitTestDB(t)
-1
View File
@@ -25,7 +25,6 @@ func UpdateTempUserStatus(cmd *models.UpdateTempUserStatusCommand) error {
func CreateTempUser(cmd *models.CreateTempUserCommand) error {
return inTransaction(func(sess *DBSession) error {
// create user
user := &models.TempUser{
Email: cmd.Email,
-1
View File
@@ -8,7 +8,6 @@ import (
)
func TestTempUserCommandsAndQueries(t *testing.T) {
Convey("Testing Temp User commands & queries", t, func() {
InitTestDB(t)
-3
View File
@@ -213,7 +213,6 @@ func GetUserByEmail(query *models.GetUserByEmailQuery) error {
func UpdateUser(cmd *models.UpdateUserCommand) error {
return inTransaction(func(sess *DBSession) error {
user := models.User{
Name: cmd.Name,
Email: cmd.Email,
@@ -240,7 +239,6 @@ func UpdateUser(cmd *models.UpdateUserCommand) error {
func ChangeUserPassword(cmd *models.ChangeUserPasswordCommand) error {
return inTransaction(func(sess *DBSession) error {
user := models.User{
Password: cmd.NewPassword,
Updated: time.Now(),
@@ -614,7 +612,6 @@ func UpdateUserPermissions(cmd *models.UpdateUserPermissionsCommand) error {
func SetUserHelpFlag(cmd *models.SetUserHelpFlagCommand) error {
return inTransaction(func(sess *DBSession) error {
user := models.User{
Id: cmd.UserId,
HelpFlags1: cmd.HelpFlags1,
-1
View File
@@ -167,7 +167,6 @@ func TestUserAuth(t *testing.T) {
So(getAuthQuery.Result.OAuthAccessToken, ShouldEqual, token.AccessToken)
So(getAuthQuery.Result.OAuthRefreshToken, ShouldEqual, token.RefreshToken)
So(getAuthQuery.Result.OAuthTokenType, ShouldEqual, token.TokenType)
})
Convey("Always return the most recently used auth_module", func() {
-1
View File
@@ -14,7 +14,6 @@ import (
)
func TestUserDataAccess(t *testing.T) {
Convey("Testing DB", t, func() {
ss := InitTestDB(t)