[Partial Fix - #16623]: Fix initialism errors in codebase. (#16877)

* Update files in /app

* Update files in /plugin

* Update files in /store

* Update files in /utils

* Update files in /web

* Update store.go

* Update command_response.go

* check-mocks and check-store-layer checks

* Fix build errors

* Revert "Fix build errors"

This reverts commit 4ee38c3d0bf7bd7d8386f46f0985a0d03245a1d4.

* Update .golangci.yml

* make i18n-extract and make i18n-check

* Commit suggestions

* check-mocks and check-store-layers

* Update en.json

* Update product_notices.go

* Update main.go

* Fix translations

* Regenerate mocks

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
Этот коммит содержится в:
Haardik Dharma
2021-02-18 20:06:56 +05:30
коммит произвёл GitHub
родитель 5f190b5624
Коммит 6356e906e0
60 изменённых файлов: 2335 добавлений и 2163 удалений

Просмотреть файл

@@ -10,34 +10,34 @@ import (
"github.com/pkg/errors"
)
type HumanizedJsonError struct {
type HumanizedJSONError struct {
Err error
Line int
Character int
}
func (e *HumanizedJsonError) Error() string {
func (e *HumanizedJSONError) Error() string {
return e.Err.Error()
}
// HumanizeJsonError extracts error offsets and annotates the error with useful context
func HumanizeJsonError(err error, data []byte) error {
// HumanizeJSONError extracts error offsets and annotates the error with useful context
func HumanizeJSONError(err error, data []byte) error {
if syntaxError, ok := err.(*json.SyntaxError); ok {
return NewHumanizedJsonError(syntaxError, data, syntaxError.Offset)
return NewHumanizedJSONError(syntaxError, data, syntaxError.Offset)
} else if unmarshalError, ok := err.(*json.UnmarshalTypeError); ok {
return NewHumanizedJsonError(unmarshalError, data, unmarshalError.Offset)
return NewHumanizedJSONError(unmarshalError, data, unmarshalError.Offset)
} else {
return err
}
}
func NewHumanizedJsonError(err error, data []byte, offset int64) *HumanizedJsonError {
func NewHumanizedJSONError(err error, data []byte, offset int64) *HumanizedJSONError {
if err == nil {
return nil
}
if offset < 0 || offset > int64(len(data)) {
return &HumanizedJsonError{
return &HumanizedJSONError{
Err: errors.Wrapf(err, "invalid offset %d", offset),
}
}
@@ -48,7 +48,7 @@ func NewHumanizedJsonError(err error, data []byte, offset int64) *HumanizedJsonE
lastLineOffset := bytes.LastIndex(data[:offset], lineSep)
character := int(offset) - (lastLineOffset + 1) + 1
return &HumanizedJsonError{
return &HumanizedJSONError{
Line: line,
Character: character,
Err: errors.Wrapf(err, "parsing error at line %d, character %d", line, character),

Просмотреть файл

@@ -63,7 +63,7 @@ func TestHumanizeJsonError(t *testing.T) {
for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.Description, func(t *testing.T) {
actual := jsonutils.HumanizeJsonError(testCase.Err, testCase.Data)
actual := jsonutils.HumanizeJSONError(testCase.Err, testCase.Data)
if testCase.ExpectedErr == "" {
assert.NoError(t, actual)
} else {
@@ -73,7 +73,7 @@ func TestHumanizeJsonError(t *testing.T) {
}
}
func TestNewHumanizedJsonError(t *testing.T) {
func TestNewHumanizedJSONError(t *testing.T) {
t.Parallel()
testCases := []struct {
@@ -81,7 +81,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
Data []byte
Offset int64
Err error
Expected *jsonutils.HumanizedJsonError
Expected *jsonutils.HumanizedJSONError
}{
{
"nil error",
@@ -95,7 +95,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
-1,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "invalid offset -1"),
},
},
@@ -104,7 +104,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
0,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 1, character 1"),
Line: 1,
Character: 1,
@@ -115,7 +115,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
5,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 1, character 6"),
Line: 1,
Character: 6,
@@ -126,7 +126,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
6,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 1, character 7"),
Line: 1,
Character: 7,
@@ -137,7 +137,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
7,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 2, character 1"),
Line: 2,
Character: 1,
@@ -148,7 +148,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
12,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 2, character 6"),
Line: 2,
Character: 6,
@@ -159,7 +159,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
13,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 2, character 7"),
Line: 2,
Character: 7,
@@ -170,7 +170,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
17,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 3, character 4"),
Line: 3,
Character: 4,
@@ -181,7 +181,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
19,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 3, character 6"),
Line: 3,
Character: 6,
@@ -192,7 +192,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
20,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 3, character 7"),
Line: 3,
Character: 7,
@@ -203,7 +203,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3\n"),
21,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "parsing error at line 4, character 1"),
Line: 4,
Character: 1,
@@ -214,7 +214,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
[]byte("line 1\nline 2\nline 3"),
21,
errors.New("message"),
&jsonutils.HumanizedJsonError{
&jsonutils.HumanizedJSONError{
Err: errors.Wrap(errors.New("message"), "invalid offset 21"),
},
},
@@ -223,7 +223,7 @@ func TestNewHumanizedJsonError(t *testing.T) {
for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.Description, func(t *testing.T) {
actual := jsonutils.NewHumanizedJsonError(testCase.Err, testCase.Data, testCase.Offset)
actual := jsonutils.NewHumanizedJSONError(testCase.Err, testCase.Data, testCase.Offset)
if testCase.Expected != nil && actual.Err != nil {
if assert.EqualValues(t, testCase.Expected.Err.Error(), actual.Err.Error()) {
actual.Err = testCase.Expected.Err