NO-TCIKET fix bad smells - error strings should not be capitalized (#16930)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
30b0523983
Коммит
e44190f4cc
@@ -307,18 +307,18 @@ func (a *App) getBuiltinDynamicListArgument(commandArgs *model.CommandArgs, arg
|
||||
dynamicArg := arg.Data.(*model.AutocompleteDynamicListArg)
|
||||
arr := strings.Split(dynamicArg.FetchURL, ":")
|
||||
if len(arr) < 2 {
|
||||
return nil, errors.New("Dynamic list URL missing built-in command name")
|
||||
return nil, errors.New("dynamic list URL missing built-in command name")
|
||||
}
|
||||
cmdName := arr[1]
|
||||
|
||||
provider := GetCommandProvider(cmdName)
|
||||
if provider == nil {
|
||||
return nil, fmt.Errorf("No command provider for %s", cmdName)
|
||||
return nil, fmt.Errorf("no command provider for %s", cmdName)
|
||||
}
|
||||
|
||||
dp, ok := provider.(AutocompleteDynamicArgProvider)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Auto-completion not available for built-in command %s", cmdName)
|
||||
return nil, fmt.Errorf("auto-completion not available for built-in command %s", cmdName)
|
||||
}
|
||||
|
||||
return dp.GetAutoCompleteListItems(a, commandArgs, arg, parsed, toBeParsed)
|
||||
|
||||
@@ -278,11 +278,12 @@ func TestCreateZipFileAndAddFiles(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
mockBackend := mocks.FileBackend{}
|
||||
mockBackend.On("WriteFile", mock.Anything, "directory-to-heaven/zip-file-name-to-heaven.zip").Return(int64(666), errors.New("Only those who dare to fail greatly can ever achieve greatly"))
|
||||
mockBackend.On("WriteFile", mock.Anything, "directory-to-heaven/zip-file-name-to-heaven.zip").Return(int64(666), errors.New("only those who dare to fail greatly can ever achieve greatly"))
|
||||
|
||||
err := th.App.CreateZipFileAndAddFiles(&mockBackend, []model.FileData{}, "zip-file-name-to-heaven.zip", "directory-to-heaven")
|
||||
require.Error(t, err)
|
||||
require.Equal(t, err.Error(), "Only those who dare to fail greatly can ever achieve greatly")
|
||||
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Error(), "only those who dare to fail greatly can ever achieve greatly")
|
||||
|
||||
mockBackend = mocks.FileBackend{}
|
||||
mockBackend.On("WriteFile", mock.Anything, "directory-to-heaven/zip-file-name-to-heaven.zip").Return(int64(666), nil)
|
||||
|
||||
@@ -160,7 +160,7 @@ func extractStoreMetadata() (*storeMetadata, error) {
|
||||
|
||||
file, err := os.Open(inputFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to open %s file: %w", inputFile, err)
|
||||
return nil, fmt.Errorf("unable to open %s file: %w", inputFile, err)
|
||||
}
|
||||
src, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
|
||||
@@ -436,7 +436,7 @@ func (s *apiRPCServer) PluginHTTP(args *Z_PluginHTTPArgs, returns *Z_PluginHTTPR
|
||||
returns.Response = response
|
||||
returns.ResponseBody = responseBody
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API PluginHTTP called but not implemented."))
|
||||
return encodableError(fmt.Errorf("API PluginHTTP called but not implemented"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -524,7 +524,7 @@ func (s *hooksRPCServer) FileWillBeUploaded(args *Z_FileWillBeUploadedArgs, retu
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.FileWillBeUploaded(args.A, args.B, fileReader, returnFileWriter)
|
||||
} else {
|
||||
return fmt.Errorf("Hook FileWillBeUploaded called but not implemented.")
|
||||
return fmt.Errorf("hook FileWillBeUploaded called but not implemented")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -564,7 +564,7 @@ func (s *hooksRPCServer) MessageWillBePosted(args *Z_MessageWillBePostedArgs, re
|
||||
returns.A, returns.B = hook.MessageWillBePosted(args.A, args.B)
|
||||
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("Hook MessageWillBePosted called but not implemented."))
|
||||
return encodableError(fmt.Errorf("hook MessageWillBePosted called but not implemented"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -605,7 +605,7 @@ func (s *hooksRPCServer) MessageWillBeUpdated(args *Z_MessageWillBeUpdatedArgs,
|
||||
returns.A, returns.B = hook.MessageWillBeUpdated(args.A, args.B, args.C)
|
||||
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("Hook MessageWillBeUpdated called but not implemented."))
|
||||
return encodableError(fmt.Errorf("hook MessageWillBeUpdated called but not implemented"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -634,7 +634,7 @@ func (s *apiRPCServer) LogDebug(args *Z_LogDebugArgs, returns *Z_LogDebugReturns
|
||||
}); ok {
|
||||
hook.LogDebug(args.A, args.B...)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API LogDebug called but not implemented."))
|
||||
return encodableError(fmt.Errorf("API LogDebug called but not implemented"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -663,7 +663,7 @@ func (s *apiRPCServer) LogInfo(args *Z_LogInfoArgs, returns *Z_LogInfoReturns) e
|
||||
}); ok {
|
||||
hook.LogInfo(args.A, args.B...)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API LogInfo called but not implemented."))
|
||||
return encodableError(fmt.Errorf("API LogInfo called but not implemented"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -692,7 +692,7 @@ func (s *apiRPCServer) LogWarn(args *Z_LogWarnArgs, returns *Z_LogWarnReturns) e
|
||||
}); ok {
|
||||
hook.LogWarn(args.A, args.B...)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API LogWarn called but not implemented."))
|
||||
return encodableError(fmt.Errorf("API LogWarn called but not implemented"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -720,7 +720,7 @@ func (s *apiRPCServer) LogError(args *Z_LogErrorArgs, returns *Z_LogErrorReturns
|
||||
}); ok {
|
||||
hook.LogError(args.A, args.B...)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API LogError called but not implemented."))
|
||||
return encodableError(fmt.Errorf("API LogError called but not implemented"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -762,7 +762,7 @@ func (s *apiRPCServer) InstallPlugin(args *Z_InstallPluginArgs, returns *Z_Insta
|
||||
InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)
|
||||
})
|
||||
if !ok {
|
||||
return encodableError(fmt.Errorf("API InstallPlugin called but not implemented."))
|
||||
return encodableError(fmt.Errorf("API InstallPlugin called but not implemented"))
|
||||
}
|
||||
|
||||
receivePluginConnection, err := s.muxBroker.Dial(args.PluginStreamID)
|
||||
|
||||
@@ -122,8 +122,7 @@ func (sup *supervisor) PerformHealthCheck() error {
|
||||
}
|
||||
}
|
||||
if pingErr != nil {
|
||||
mlog.Debug("Error pinging plugin", mlog.Err(pingErr))
|
||||
return fmt.Errorf("Plugin RPC connection is not responding")
|
||||
return fmt.Errorf("plugin RPC connection is not responding")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func (de *documentExtractor) Extract(filename string, r io.Reader) (string, erro
|
||||
extension := strings.TrimPrefix(path.Ext(filename), ".")
|
||||
converter, ok := doconvConverterByExtensions[extension]
|
||||
if !ok {
|
||||
return "", errors.New("Unknown converter")
|
||||
return "", errors.New("unknown converter")
|
||||
}
|
||||
|
||||
f, err := ioutil.TempFile(os.TempDir(), "docconv")
|
||||
|
||||
@@ -70,19 +70,19 @@ func GetMailBox(email string) (results JSONMessageHeaderInbucket, err error) {
|
||||
}()
|
||||
|
||||
if resp.Body == nil {
|
||||
return nil, fmt.Errorf("No Mailbox")
|
||||
return nil, fmt.Errorf("no mailbox")
|
||||
}
|
||||
|
||||
var record JSONMessageHeaderInbucket
|
||||
err = json.NewDecoder(resp.Body).Decode(&record)
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
return nil, fmt.Errorf("Error: %s", err)
|
||||
return nil, fmt.Errorf("error: %s", err)
|
||||
case err != nil:
|
||||
return nil, fmt.Errorf("Error: %s", err)
|
||||
return nil, fmt.Errorf("error: %s", err)
|
||||
}
|
||||
if len(record) == 0 {
|
||||
return nil, fmt.Errorf("No mailbox")
|
||||
return nil, fmt.Errorf("no mailbox")
|
||||
}
|
||||
|
||||
return record, nil
|
||||
@@ -171,7 +171,7 @@ func RetryInbucket(attempts int, callback func() error) (err error) {
|
||||
|
||||
fmt.Println("retrying...")
|
||||
}
|
||||
return fmt.Errorf("After %d attempts, last error: %s", attempts, err)
|
||||
return fmt.Errorf("after %d attempts, last error: %s", attempts, err)
|
||||
}
|
||||
|
||||
func getInbucketHost() (host string) {
|
||||
|
||||
@@ -153,7 +153,7 @@ func extractStoreMetadata() (*storeMetadata, error) {
|
||||
|
||||
file, err := os.Open("store.go")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to open store/store.go file: %w", err)
|
||||
return nil, fmt.Errorf("unable to open store/store.go file: %w", err)
|
||||
}
|
||||
src, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
|
||||
@@ -54,7 +54,7 @@ func InitTranslations(localizationSettings model.LocalizationSettings) error {
|
||||
func InitTranslationsWithDir(dir string) error {
|
||||
i18nDirectory, found := fileutils.FindDirRelBinary(dir)
|
||||
if !found {
|
||||
return fmt.Errorf(fmt.Sprintf("Unable to find i18n directory at %q", dir))
|
||||
return fmt.Errorf("unable to find i18n directory at %q", dir)
|
||||
}
|
||||
|
||||
files, _ := ioutil.ReadDir(i18nDirectory)
|
||||
@@ -80,12 +80,12 @@ func GetTranslationsBySystemLocale() (i18n.TranslateFunc, error) {
|
||||
}
|
||||
|
||||
if locales[locale] == "" {
|
||||
return nil, fmt.Errorf("Failed to load system translations for '%v'", model.DEFAULT_LOCALE)
|
||||
return nil, fmt.Errorf("failed to load system translations for '%v'", model.DEFAULT_LOCALE)
|
||||
}
|
||||
|
||||
translations := TfuncWithFallback(locale)
|
||||
if translations == nil {
|
||||
return nil, fmt.Errorf("Failed to load system translations")
|
||||
return nil, fmt.Errorf("failed to load system translations")
|
||||
}
|
||||
|
||||
mlog.Info("Loaded system translations", mlog.String("for locale", locale), mlog.String("from locale", locales[locale]))
|
||||
|
||||
Ссылка в новой задаче
Block a user