[MM-55409] Enable revive linter on enterprise code (#25391)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8e84adb176
Коммит
612e4458ef
@@ -42,12 +42,14 @@ issues:
|
|||||||
|
|
||||||
- linters:
|
- linters:
|
||||||
- revive
|
- revive
|
||||||
text: "var-naming|error-naming|exported|increment-decrement|error-strings|if-return|unused-parameter|blank-imports|context-as-argument|empty-block"
|
text: "var-naming|error-naming|exported|increment-decrement|error-strings|if-return|unused-parameter|blank-imports|empty-block"
|
||||||
# We need to fix the unused parameter issues and remove the exception.
|
# We need to fix the unused parameter issues and remove the exception.
|
||||||
|
|
||||||
|
# Use a seperate set of exception for the enterprise code to allow community members to fix only the open source issues.
|
||||||
- linters:
|
- linters:
|
||||||
- revive
|
- revive
|
||||||
path: "enterprise" # TODO: fix this
|
path: "enterprise"
|
||||||
|
text: "var-naming|error-naming|exported|increment-decrement|error-strings|if-return|unused-parameter|blank-imports|empty-block"
|
||||||
|
|
||||||
- linters:
|
- linters:
|
||||||
- misspell
|
- misspell
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ func (a *App) WriteExportFile(fr io.Reader, path string) (int64, *model.AppError
|
|||||||
|
|
||||||
func writeFileContext(ctx context.Context, backend filestore.FileBackend, fr io.Reader, path string) (int64, *model.AppError) {
|
func writeFileContext(ctx context.Context, backend filestore.FileBackend, fr io.Reader, path string) (int64, *model.AppError) {
|
||||||
// Check if we can provide a custom context, otherwise just use the default method.
|
// Check if we can provide a custom context, otherwise just use the default method.
|
||||||
written, err := filestore.TryWriteFileContext(backend, ctx, fr, path)
|
written, err := filestore.TryWriteFileContext(ctx, backend, fr, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return written, model.NewAppError("WriteFile", "api.file.write_file.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
return written, model.NewAppError("WriteFile", "api.file.write_file.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ func (glu *GitLabUser) getAuthData() string {
|
|||||||
return strconv.FormatInt(glu.Id, 10)
|
return strconv.FormatInt(glu.Id, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GitLabProvider) GetUserFromJSON(c request.CTX, data io.Reader, tokenUser *model.User) (*model.User, error) {
|
func (gp *GitLabProvider) GetUserFromJSON(c request.CTX, data io.Reader, tokenUser *model.User) (*model.User, error) {
|
||||||
glu, err := gitLabUserFromJSON(data)
|
glu, err := gitLabUserFromJSON(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -96,14 +96,14 @@ func (m *GitLabProvider) GetUserFromJSON(c request.CTX, data io.Reader, tokenUse
|
|||||||
return userFromGitLabUser(c.Logger(), glu), nil
|
return userFromGitLabUser(c.Logger(), glu), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GitLabProvider) GetSSOSettings(_ request.CTX, config *model.Config, service string) (*model.SSOSettings, error) {
|
func (gp *GitLabProvider) GetSSOSettings(_ request.CTX, config *model.Config, service string) (*model.SSOSettings, error) {
|
||||||
return &config.GitLabSettings, nil
|
return &config.GitLabSettings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GitLabProvider) GetUserFromIdToken(_ request.CTX, idToken string) (*model.User, error) {
|
func (gp *GitLabProvider) GetUserFromIdToken(_ request.CTX, idToken string) (*model.User, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GitLabProvider) IsSameUser(_ request.CTX, dbUser, oauthUser *model.User) bool {
|
func (gp *GitLabProvider) IsSameUser(_ request.CTX, dbUser, oauthUser *model.User) bool {
|
||||||
return dbUser.AuthData == oauthUser.AuthData
|
return dbUser.AuthData == oauthUser.AuthData
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ func newFileBackend(settings FileBackendSettings, canBeCloud bool) (FileBackend,
|
|||||||
// TryWriteFileContext checks if the file backend supports context writes and passes the context in that case.
|
// TryWriteFileContext checks if the file backend supports context writes and passes the context in that case.
|
||||||
// Should the file backend not support contexts, it just calls WriteFile instead. This can be used to disable
|
// Should the file backend not support contexts, it just calls WriteFile instead. This can be used to disable
|
||||||
// the timeouts for long writes (like exports).
|
// the timeouts for long writes (like exports).
|
||||||
func TryWriteFileContext(fb FileBackend, ctx context.Context, fr io.Reader, path string) (int64, error) {
|
func TryWriteFileContext(ctx context.Context, fb FileBackend, fr io.Reader, path string) (int64, error) {
|
||||||
type ContextWriter interface {
|
type ContextWriter interface {
|
||||||
WriteFileContext(context.Context, io.Reader, string) (int64, error)
|
WriteFileContext(context.Context, io.Reader, string) (int64, error)
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user