Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linter): Upgrade and add some linters #1059

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kissken
Copy link
Member

@kissken kissken commented Jul 18, 2024

fix(linter): Upgrade and add some linters

@kissken kissken requested a review from a team as a code owner July 18, 2024 16:37
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 67.39130% with 60 lines in your changes missing coverage. Please review.

Project coverage is 67.33%. Comparing base (1f2b4ac) to head (ef5929e).
Report is 35 commits behind head on master.

Files Patch % Lines
datatypes.go 35.00% 13 Missing ⚠️
api/dto/team.go 0.00% 7 Missing ⚠️
senders/slack/slack.go 33.33% 4 Missing ⚠️
api/handler/triggers.go 0.00% 3 Missing ⚠️
database/redis/reply/trigger.go 0.00% 3 Missing ⚠️
api/handler/contact_events.go 33.33% 2 Missing ⚠️
cmd/api/config.go 71.42% 2 Missing ⚠️
cmd/cli/from_2.9_to_2.10.go 0.00% 2 Missing ⚠️
cmd/cli/main.go 0.00% 2 Missing ⚠️
database/redis/last_check.go 0.00% 1 Missing and 1 partial ⚠️
... and 18 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1059      +/-   ##
==========================================
- Coverage   67.92%   67.33%   -0.59%     
==========================================
  Files         212      215       +3     
  Lines       12024    12407     +383     
==========================================
+ Hits         8167     8354     +187     
- Misses       3359     3527     +168     
- Partials      498      526      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -77,7 +77,10 @@ func getAllTriggers(writer http.ResponseWriter, request *http.Request) {
func getUnusedTriggers(writer http.ResponseWriter, request *http.Request) {
triggersList, errorResponse := controller.GetUnusedTriggerIDs(database)
if errorResponse != nil {
render.Render(writer, request, errorResponse) //nolint
err := render.Render(writer, request, errorResponse)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А какой в этом смысл? Может nolint с выключением конкретного линтера с комментом, если ругается на это

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

о, оно пофиксило за меня)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну надо ее залогать по-хорошему будет и убрать нолинт будет

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

как варик

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лайк логанью

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну не в этом

этот итак жиробас, отдельно допинаю)

@@ -426,19 +425,19 @@ func CheckUserPermissionsForTeam(
}

// GetTeamSettings gets team contacts and subscriptions.
func GetTeamSettings(database moira.Database, teamID string) (dto.TeamSettings, *api.ErrorResponse) {
func GetTeamSettings(dataBase moira.Database, teamID string) (dto.TeamSettings, *api.ErrorResponse) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему так?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть пакет database - одинаковый нейминг)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может назовём переменную db или это ещё хуже?

@@ -73,7 +73,7 @@ type UserTeams struct {
}

// Render is a function that implements chi Renderer interface for UserTeams.
func (UserTeams) Render(w http.ResponseWriter, r *http.Request) error {
func (UserTeams) Render(_ http.ResponseWriter, _ *http.Request) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему не

Suggested change
func (UserTeams) Render(_ http.ResponseWriter, _ *http.Request) error {
func (UserTeams) Render(http.ResponseWriter, *http.Request) error {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

без разницы вообще

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему не

А так вообще можно было 0_0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я просто подумал, что может лучше однотипно сделать везде и без лишних символов?

@@ -141,21 +141,21 @@ func (triggerMetrics TriggerMetrics) Populate(lastMetrics map[string]moira.Metri
// {
// "t3": {metrics},
// }
func (triggerMetrics TriggerMetrics) FilterAloneMetrics(declaredAloneMetrics map[string]bool) (TriggerMetrics, AloneMetrics, error) {
func (m TriggerMetrics) FilterAloneMetrics(declaredAloneMetrics map[string]bool) (TriggerMetrics, AloneMetrics, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему m?

@@ -14,7 +14,7 @@ func updateFrom23(logger moira.Logger, dataBase moira.Database) error {
return nil
}

func downgradeTo23(logger moira.Logger, dataBase moira.Database) error {
func downgradeTo23() error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может оставить хотя бы в виде сигнатуры, чтобы у всех методов переезда туда-сюда был одинаковый интерфейс?

Suggested change
func downgradeTo23() error {
func downgradeTo23(moira.Logger, moira.Database) error {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В идеале ещё коммент о том, почему эта функция пустая

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В идеале ещё коммент о том, почему эта функция пустая

какой?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я не знаю, так бы сразу написал 😅

Это какие-то технологии предков, 6 лет назад написан код

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants