Skip to content

Commit cd2b196

Browse files
committed
chore: add typos check linter in github actions (#285)
* refactor: Disable JSON handling in logger/logger.go. * chore: Standardize spelling and add typos check workflows. - Update GitHub Action name to 'unit tests' - Add spell-check step with custom config to lint workflow - Use latest version of golangci/lint-action in lint workflow - Rename variable 'crypted' to 'encrypted' in crypto_windows.go - Fix typos in comments and error/log messages throughout the codebase - Update .gitignore to exclude typos.toml file
1 parent 559e8ca commit cd2b196

8 files changed

Lines changed: 23 additions & 7 deletions

File tree

.github/workflows/lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ jobs:
1616
go-version: "1.21.x"
1717
- name: Checkout code
1818
uses: actions/checkout@v3
19+
20+
- name: Check spelling with custom config file
21+
uses: crate-ci/typos@master
22+
with:
23+
config: ./typos.toml
24+
1925
- name: Lint
2026
uses: golangci/golangci-lint-action@v3
2127
with:

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- main
66
workflow_dispatch:
77

8-
name: run tests
8+
name: unit tests
99
jobs:
1010
test:
1111
strategy:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,7 @@ hack-browser-data
201201
!/.github/*.md
202202

203203
# Community
204-
!CONTRIBUTING.md
204+
!CONTRIBUTING.md
205+
206+
# CICD Config
207+
!typos.toml

browsingdata/localstorage/localstorage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (c *ChromiumLocalStorage) Parse(_ []byte) error {
4646
if len(value) < maxLocalStorageValueLength {
4747
s.fillValue(value)
4848
} else {
49-
s.Value = fmt.Sprintf("value is too long, length is %d, supportted max length is %d", len(value), maxLocalStorageValueLength)
49+
s.Value = fmt.Sprintf("value is too long, length is %d, supported max length is %d", len(value), maxLocalStorageValueLength)
5050
}
5151
if s.IsMeta {
5252
s.Value = fmt.Sprintf("meta data, value bytes is %v", value)

browsingdata/sessionstorage/sessionstorage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (c *ChromiumSessionStorage) Parse(_ []byte) error {
4646
if len(value) < maxLocalStorageValueLength {
4747
s.fillValue(value)
4848
} else {
49-
s.Value = fmt.Sprintf("value is too long, length is %d, supportted max length is %d", len(value), maxLocalStorageValueLength)
49+
s.Value = fmt.Sprintf("value is too long, length is %d, supported max length is %d", len(value), maxLocalStorageValueLength)
5050
}
5151
if s.IsMeta {
5252
s.Value = fmt.Sprintf("meta data, value bytes is %v", value)

crypto/crypto_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func DecryptPassForYandex(key, encryptPass []byte) ([]byte, error) {
3030
}
3131

3232
// chromium > 80 https://source.chromium.org/chromium/chromium/src/+/master:components/os_crypt/os_crypt_win.cc
33-
func aesGCMDecrypt(crypted, key, nounce []byte) ([]byte, error) {
33+
func aesGCMDecrypt(encrypted, key, nounce []byte) ([]byte, error) {
3434
block, err := aes.NewCipher(key)
3535
if err != nil {
3636
return nil, err
@@ -39,7 +39,7 @@ func aesGCMDecrypt(crypted, key, nounce []byte) ([]byte, error) {
3939
if err != nil {
4040
return nil, err
4141
}
42-
origData, err := blockMode.Open(nil, nounce, crypted, nil)
42+
origData, err := blockMode.Open(nil, nounce, encrypted, nil)
4343
if err != nil {
4444
return nil, err
4545
}

logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
var Default = &Logger{
1212
AddSource: true,
1313
IsVerbose: false,
14-
IsJSONHandler: true,
14+
IsJSONHandler: false,
1515
Level: slog.LevelWarn,
1616
ReplaceAttr: defaultReplaceAttrFunc,
1717
Output: os.Stderr,

typos.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos
2+
[default.extend-words]
3+
Readed = "Readed"
4+
Sie = "Sie"
5+
OT = "OT"
6+
[files]
7+
extend-exclude = ["go.mod", "go.sum"]

0 commit comments

Comments
 (0)