Skip to content

Commit 5f2c9ee

Browse files
committed
chore: edit linter settings
1 parent 9e57361 commit 5f2c9ee

9 files changed

Lines changed: 41 additions & 20 deletions

File tree

.golangci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ linters:
1212
- paralleltest
1313
- revive
1414
settings:
15+
revive:
16+
enable-all-rules: true
17+
rules:
18+
- name: add-constant
19+
disabled: true
20+
- name: var-naming
21+
disabled: true
22+
- name: line-length-limit
23+
disabled: true
24+
- name: function-length
25+
disabled: true
26+
- name: cognitive-complexity
27+
arguments: [ 30 ]
28+
- name: cyclomatic
29+
disabled: true
30+
- name: import-alias-naming
31+
disabled: true
32+
- name: unused-receiver
33+
disabled: true
34+
- name: unhandled-error
35+
arguments: [ "fmt.Println" ]
1536
goheader:
1637
template: |-
1738
Copyright {{ YEAR }} LLC "Ozon Technologies".

internal/utils/database/database.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ import (
1616
var errInvalidArguments = errors.New("invalid arguments")
1717

1818
// CreateTableAs ...
19-
func CreateTableAs(ctx context.Context, shard database.Shard, database, srcTable, dstTable string) error {
20-
if sqlUtils.ValidateEntityName(database) != nil || sqlUtils.ValidateEntityName(srcTable) != nil || sqlUtils.ValidateEntityName(dstTable) != nil {
19+
func CreateTableAs(ctx context.Context, shard database.Shard, databaseName, srcTableName, dstTableName string) error {
20+
if sqlUtils.ValidateEntityName(databaseName) != nil || sqlUtils.ValidateEntityName(srcTableName) != nil || sqlUtils.ValidateEntityName(dstTableName) != nil {
2121
return errInvalidArguments
2222
}
2323

24-
if err := shard.Exec(ctx, fmt.Sprintf("CREATE TABLE %s AS %s", sqlUtils.QuotedDatabaseEntity(database, dstTable), sqlUtils.QuotedDatabaseEntity(database, srcTable))); err != nil {
25-
return fmt.Errorf("failed to create table %s as %s in %s: %w", dstTable, srcTable, database, err)
24+
if err := shard.Exec(ctx, fmt.Sprintf("CREATE TABLE %s AS %s", sqlUtils.QuotedDatabaseEntity(databaseName, dstTableName), sqlUtils.QuotedDatabaseEntity(databaseName, srcTableName))); err != nil {
25+
return fmt.Errorf("failed to create table %s as %s in %s: %w", dstTableName, srcTableName, databaseName, err)
2626
}
2727

2828
return nil
2929
}
3030

3131
// DropTable ...
32-
func DropTable(ctx context.Context, shard database.Shard, database, table string) error {
33-
if sqlUtils.ValidateEntityName(database) != nil || sqlUtils.ValidateEntityName(table) != nil {
32+
func DropTable(ctx context.Context, shard database.Shard, databaseName, tableName string) error {
33+
if sqlUtils.ValidateEntityName(databaseName) != nil || sqlUtils.ValidateEntityName(tableName) != nil {
3434
return errInvalidArguments
3535
}
3636

37-
if err := shard.Exec(ctx, "DROP TABLE "+sqlUtils.QuotedDatabaseEntity(database, table)); err != nil {
38-
return fmt.Errorf("failed to drop table %s in %s: %w", table, database, err)
37+
if err := shard.Exec(ctx, "DROP TABLE "+sqlUtils.QuotedDatabaseEntity(databaseName, tableName)); err != nil {
38+
return fmt.Errorf("failed to drop table %s in %s: %w", tableName, databaseName, err)
3939
}
4040

4141
return nil

internal/utils/time/time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
// Package time is a utils for working with time.
5-
package time //revive:disable-line:var-naming
5+
package time
66

77
import "time"
88

internal/utils/time/time_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 LLC "Ozon Technologies".
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package time //revive:disable-line:var-naming
4+
package time
55

66
import (
77
"testing"

pkg/database/error_wrappers/clickhouse_go/wrap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
// Package clickhouse_go implements error wrapper for 'clickhouse-go'.
5-
package clickhouse_go //revive:disable:var-naming
5+
package clickhouse_go
66

77
import (
88
"errors"

pkg/database/error_wrappers/clickhouse_go/wrap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 LLC "Ozon Technologies".
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package clickhouse_go //revive:disable:var-naming
4+
package clickhouse_go
55

66
import (
77
"errors"

pkg/database/error_wrappers/common/wrap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 LLC "Ozon Technologies".
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package common //revive:disable:var-naming
4+
package common
55

66
import (
77
"context"

pkg/rollup/partitions.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import (
1313
"github.com/ozontech/ch-rollup/pkg/database"
1414
)
1515

16-
func getPartitionsOnShard(ctx context.Context, shard database.Shard, database, table string) ([]string, error) {
16+
func getPartitionsOnShard(ctx context.Context, shard database.Shard, databaseName, tableName string) ([]string, error) {
1717
sb := sqlbuilder.NewSelectBuilder().From("system.parts")
1818

1919
sb.Select("partition")
2020
sb.Where(
21-
sb.Equal("database", database),
22-
sb.Equal("table", table),
21+
sb.Equal("database", databaseName),
22+
sb.Equal("table", tableName),
2323
sb.Equal("active", 1),
2424
)
2525
sb.GroupBy("partition")
@@ -56,14 +56,14 @@ func getPartitionsOnShard(ctx context.Context, shard database.Shard, database, t
5656

5757
// replacePartitionsOnShard replaces partitions on shard.
5858
// Arguments must be sanitized.
59-
func replacePartitionsOnShard(ctx context.Context, shard database.Shard, database, from, to string, partitions []string) error {
59+
func replacePartitionsOnShard(ctx context.Context, shard database.Shard, databaseName, from, to string, partitions []string) error {
6060
// TODO: generate multistatement query.
6161
for _, partition := range partitions {
6262
b := sqlbuilder.Build(
6363
"ALTER TABLE $? REPLACE PARTITION $? FROM $?",
64-
sqlbuilder.Raw(sqlUtils.QuotedDatabaseEntity(database, to)),
64+
sqlbuilder.Raw(sqlUtils.QuotedDatabaseEntity(databaseName, to)),
6565
partition,
66-
sqlbuilder.Raw(sqlUtils.QuotedDatabaseEntity(database, from)),
66+
sqlbuilder.Raw(sqlUtils.QuotedDatabaseEntity(databaseName, from)),
6767
)
6868

6969
sql, args := b.BuildWithFlavor(sqlbuilder.ClickHouse)

pkg/types/types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 LLC "Ozon Technologies".
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package types //revive:disable:var-naming
4+
package types
55

66
import (
77
"testing"

0 commit comments

Comments
 (0)