Skip to content

Commit

Permalink
fix: Add dots to godocs (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetrergeru authored Mar 12, 2024
1 parent 5b4ff82 commit 19d0a7b
Show file tree
Hide file tree
Showing 193 changed files with 892 additions and 892 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ linters:
- unparam
- unused
- whitespace
- godot

issues:
exclude-rules:
Expand Down
4 changes: 2 additions & 2 deletions api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type FeatureFlags struct {
IsReadonlyEnabled bool `json:"isReadonlyEnabled" example:"false"`
}

// Sentry - config for sentry settings
// Sentry - config for sentry settings.
type Sentry struct {
DSN string `json:"dsn,omitempty" example:"https://[email protected]"`
Platform string `json:"platform,omitempty" example:"dev"`
Expand All @@ -48,7 +48,7 @@ type WebConfig struct {
Sentry Sentry `json:"sentry"`
}

// MetricSourceCluster contains data about supported metric source cluster
// MetricSourceCluster contains data about supported metric source cluster.
type MetricSourceCluster struct {
TriggerSource moira.TriggerSource `json:"trigger_source" example:"graphite_remote"`
ClusterId moira.ClusterId `json:"cluster_id" example:"default"`
Expand Down
14 changes: 7 additions & 7 deletions api/controller/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/moira-alert/moira/database"
)

// GetAllContacts gets all moira contacts
// GetAllContacts gets all moira contacts.
func GetAllContacts(database moira.Database) (*dto.ContactList, *api.ErrorResponse) {
contacts, err := database.GetAllContacts()
if err != nil {
Expand All @@ -27,7 +27,7 @@ func GetAllContacts(database moira.Database) (*dto.ContactList, *api.ErrorRespon
return &contactsList, nil
}

// GetContactById gets notification contact by its id string
// GetContactById gets notification contact by its id string.
func GetContactById(database moira.Database, contactID string) (*dto.Contact, *api.ErrorResponse) {
contact, err := database.GetContact(contactID)
if err != nil {
Expand All @@ -45,7 +45,7 @@ func GetContactById(database moira.Database, contactID string) (*dto.Contact, *a
return contactToReturn, nil
}

// CreateContact creates new notification contact for current user
// CreateContact creates new notification contact for current user.
func CreateContact(dataBase moira.Database, contact *dto.Contact, userLogin, teamID string) *api.ErrorResponse {
if userLogin != "" && teamID != "" {
return api.ErrorInternalServer(fmt.Errorf("CreateContact: cannot create contact when both userLogin and teamID specified"))
Expand Down Expand Up @@ -82,7 +82,7 @@ func CreateContact(dataBase moira.Database, contact *dto.Contact, userLogin, tea
return nil
}

// UpdateContact updates notification contact for current user
// UpdateContact updates notification contact for current user.
func UpdateContact(dataBase moira.Database, contactDTO dto.Contact, contactData moira.ContactData) (dto.Contact, *api.ErrorResponse) {
contactData.Type = contactDTO.Type
contactData.Value = contactDTO.Value
Expand All @@ -95,7 +95,7 @@ func UpdateContact(dataBase moira.Database, contactDTO dto.Contact, contactData
return contactDTO, nil
}

// RemoveContact deletes notification contact for current user and remove contactID from all subscriptions
// RemoveContact deletes notification contact for current user and remove contactID from all subscriptions.
func RemoveContact(database moira.Database, contactID string, userLogin string, teamID string) *api.ErrorResponse { //nolint:gocyclo
subscriptionIDs := make([]string, 0)
if userLogin != "" {
Expand Down Expand Up @@ -160,7 +160,7 @@ func RemoveContact(database moira.Database, contactID string, userLogin string,
return nil
}

// SendTestContactNotification push test notification to verify the correct contact settings
// SendTestContactNotification push test notification to verify the correct contact settings.
func SendTestContactNotification(dataBase moira.Database, contactID string) *api.ErrorResponse {
eventData := &moira.NotificationEvent{
ContactID: contactID,
Expand All @@ -176,7 +176,7 @@ func SendTestContactNotification(dataBase moira.Database, contactID string) *api
return nil
}

// CheckUserPermissionsForContact checks contact for existence and permissions for given user
// CheckUserPermissionsForContact checks contact for existence and permissions for given user.
func CheckUserPermissionsForContact(dataBase moira.Database, contactID string, userLogin string) (moira.ContactData, *api.ErrorResponse) {
contactData, err := dataBase.GetContact(contactID)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions api/controller/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/moira-alert/moira/api/dto"
)

// GetTriggerEvents gets trigger event from current page and all trigger event count
// GetTriggerEvents gets trigger event from current page and all trigger event count.
func GetTriggerEvents(database moira.Database, triggerID string, page int64, size int64) (*dto.EventsList, *api.ErrorResponse) {
events, err := database.GetNotificationEvents(triggerID, page*size, size-1)
if err != nil {
Expand All @@ -28,7 +28,7 @@ func GetTriggerEvents(database moira.Database, triggerID string, page int64, siz
return eventsList, nil
}

// DeleteAllEvents deletes all notification events
// DeleteAllEvents deletes all notification events.
func DeleteAllEvents(database moira.Database) *api.ErrorResponse {
if err := database.RemoveAllNotificationEvents(); err != nil {
return api.ErrorInternalServer(err)
Expand Down
4 changes: 2 additions & 2 deletions api/controller/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/moira-alert/moira/api/dto"
)

// GetNotifierState return current notifier state
// GetNotifierState return current notifier state.
func GetNotifierState(database moira.Database) (*dto.NotifierState, *api.ErrorResponse) {
state, err := database.GetNotifierState()
if err != nil {
Expand All @@ -21,7 +21,7 @@ func GetNotifierState(database moira.Database) (*dto.NotifierState, *api.ErrorRe
return &notifierState, nil
}

// UpdateNotifierState update current notifier state
// UpdateNotifierState update current notifier state.
func UpdateNotifierState(database moira.Database, state *dto.NotifierState) *api.ErrorResponse {
err := database.SetNotifierState(state.State)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions api/controller/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/moira-alert/moira/api/dto"
)

// GetNotifications gets all notifications from current page, if end==-1 && start==0 gets all notifications
// GetNotifications gets all notifications from current page, if end==-1 && start==0 gets all notifications.
func GetNotifications(database moira.Database, start int64, end int64) (*dto.NotificationsList, *api.ErrorResponse) {
notifications, total, err := database.GetNotifications(start, end)
if err != nil {
Expand All @@ -19,7 +19,7 @@ func GetNotifications(database moira.Database, start int64, end int64) (*dto.Not
return &notificationsList, nil
}

// DeleteNotification removes all notifications by notification key
// DeleteNotification removes all notifications by notification key.
func DeleteNotification(database moira.Database, notificationKey string) (*dto.NotificationDeleteResponse, *api.ErrorResponse) {
result, err := database.RemoveNotification(notificationKey)
if err != nil {
Expand All @@ -28,7 +28,7 @@ func DeleteNotification(database moira.Database, notificationKey string) (*dto.N
return &dto.NotificationDeleteResponse{Result: result}, nil
}

// DeleteAllNotifications removes all notifications
// DeleteAllNotifications removes all notifications.
func DeleteAllNotifications(database moira.Database) *api.ErrorResponse {
if err := database.RemoveAllNotifications(); err != nil {
return api.ErrorInternalServer(err)
Expand Down
4 changes: 2 additions & 2 deletions api/controller/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/moira-alert/moira/api/dto"
)

// GetAllPatterns get all patterns and triggers and metrics info corresponding to this pattern
// GetAllPatterns get all patterns and triggers and metrics info corresponding to this pattern.
func GetAllPatterns(database moira.Database, logger moira.Logger) (*dto.PatternList, *api.ErrorResponse) {
patterns, err := database.GetPatterns()
if err != nil {
Expand Down Expand Up @@ -64,7 +64,7 @@ func GetAllPatterns(database moira.Database, logger moira.Logger) (*dto.PatternL
return &pattersList, nil
}

// DeletePattern deletes trigger pattern
// DeletePattern deletes trigger pattern.
func DeletePattern(database moira.Database, pattern string) *api.ErrorResponse {
if err := database.RemovePattern(pattern); err != nil {
return api.ErrorInternalServer(err)
Expand Down
12 changes: 6 additions & 6 deletions api/controller/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/moira-alert/moira/database"
)

// GetUserSubscriptions get all user subscriptions
// GetUserSubscriptions get all user subscriptions.
func GetUserSubscriptions(database moira.Database, userLogin string) (*dto.SubscriptionList, *api.ErrorResponse) {
subscriptionIDs, err := database.GetUserSubscriptionIDs(userLogin)
if err != nil {
Expand All @@ -35,7 +35,7 @@ func GetUserSubscriptions(database moira.Database, userLogin string) (*dto.Subsc
return subscriptionsList, nil
}

// CreateSubscription create or update subscription
// CreateSubscription create or update subscription.
func CreateSubscription(dataBase moira.Database, userLogin, teamID string, subscription *dto.Subscription) *api.ErrorResponse {
if userLogin != "" && teamID != "" {
return api.ErrorInternalServer(fmt.Errorf("CreateSubscription: cannot create subscription when both userLogin and teamID specified"))
Expand Down Expand Up @@ -65,7 +65,7 @@ func CreateSubscription(dataBase moira.Database, userLogin, teamID string, subsc
return nil
}

// UpdateSubscription updates existing subscription
// UpdateSubscription updates existing subscription.
func UpdateSubscription(dataBase moira.Database, subscriptionID string, userLogin string, subscription *dto.Subscription) *api.ErrorResponse {
subscription.ID = subscriptionID
if subscription.TeamID == "" {
Expand All @@ -78,15 +78,15 @@ func UpdateSubscription(dataBase moira.Database, subscriptionID string, userLogi
return nil
}

// RemoveSubscription deletes subscription
// RemoveSubscription deletes subscription.
func RemoveSubscription(database moira.Database, subscriptionID string) *api.ErrorResponse {
if err := database.RemoveSubscription(subscriptionID); err != nil {
return api.ErrorInternalServer(err)
}
return nil
}

// SendTestNotification push test notification to verify the correct notification settings
// SendTestNotification push test notification to verify the correct notification settings.
func SendTestNotification(database moira.Database, subscriptionID string) *api.ErrorResponse {
eventData := &moira.NotificationEvent{
SubscriptionID: &subscriptionID,
Expand All @@ -104,7 +104,7 @@ func SendTestNotification(database moira.Database, subscriptionID string) *api.E
return nil
}

// CheckUserPermissionsForSubscription checks subscription for existence and permissions for given user
// CheckUserPermissionsForSubscription checks subscription for existence and permissions for given user.
func CheckUserPermissionsForSubscription(dataBase moira.Database, subscriptionID string, userLogin string) (moira.SubscriptionData, *api.ErrorResponse) {
subscription, err := dataBase.GetSubscription(subscriptionID)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions api/controller/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/moira-alert/moira/api/dto"
)

// GetAllTagsAndSubscriptions get tags subscriptions and triggerIDs
// GetAllTagsAndSubscriptions get tags subscriptions and triggerIDs.
func GetAllTagsAndSubscriptions(database moira.Database, logger moira.Logger) (*dto.TagsStatistics, *api.ErrorResponse) {
tagsNames, err := database.GetTagNames()
if err != nil {
Expand Down Expand Up @@ -59,7 +59,7 @@ func GetAllTagsAndSubscriptions(database moira.Database, logger moira.Logger) (*
return &tagsStatistics, nil
}

// GetAllTags gets all tag names
// GetAllTags gets all tag names.
func GetAllTags(database moira.Database) (*dto.TagsData, *api.ErrorResponse) {
tagsNames, err := getTagNamesSorted(database)
if err != nil {
Expand All @@ -82,7 +82,7 @@ func getTagNamesSorted(database moira.Database) ([]string, error) {
return tagsNames, nil
}

// CreateTags create tags with tag names
// CreateTags create tags with tag names.
func CreateTags(database moira.Database, tags *dto.TagsData) *api.ErrorResponse {
if err := database.CreateTags(tags.TagNames); err != nil {
return api.ErrorInternalServer(err)
Expand All @@ -91,7 +91,7 @@ func CreateTags(database moira.Database, tags *dto.TagsData) *api.ErrorResponse
return nil
}

// RemoveTag deletes tag by name
// RemoveTag deletes tag by name.
func RemoveTag(database moira.Database, tagName string) (*dto.MessageResponse, *api.ErrorResponse) {
triggerIDs, err := database.GetTagTriggerIDs(tagName)
if err != nil {
Expand Down
20 changes: 10 additions & 10 deletions api/controller/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

const teamIDCreateRetries = 3

// CreateTeam is a controller function that creates a new team in Moira
// CreateTeam is a controller function that creates a new team in Moira.
func CreateTeam(dataBase moira.Database, team dto.TeamModel, userID string) (dto.SaveTeamResponse, *api.ErrorResponse) {
var teamID string
if team.ID != "" { // if teamID is specified in request data then check that team with this id is not exist
Expand Down Expand Up @@ -67,7 +67,7 @@ func CreateTeam(dataBase moira.Database, team dto.TeamModel, userID string) (dto
return dto.SaveTeamResponse{ID: teamID}, nil
}

// GetTeam is a controller function that returns a team by it's ID
// GetTeam is a controller function that returns a team by it's ID.
func GetTeam(dataBase moira.Database, teamID string) (dto.TeamModel, *api.ErrorResponse) {
team, err := dataBase.GetTeam(teamID)

Expand All @@ -82,7 +82,7 @@ func GetTeam(dataBase moira.Database, teamID string) (dto.TeamModel, *api.ErrorR
return teamModel, nil
}

// GetUserTeams is a controller function that returns a teams in which user is a member bu user ID
// GetUserTeams is a controller function that returns a teams in which user is a member bu user ID.
func GetUserTeams(dataBase moira.Database, userID string) (dto.UserTeams, *api.ErrorResponse) {
teams, err := dataBase.GetUserTeams(userID)

Expand All @@ -103,7 +103,7 @@ func GetUserTeams(dataBase moira.Database, userID string) (dto.UserTeams, *api.E
return dto.UserTeams{Teams: result}, nil
}

// GetTeamUsers is a controller function that returns a users of team by team ID
// GetTeamUsers is a controller function that returns a users of team by team ID.
func GetTeamUsers(dataBase moira.Database, teamID string) (dto.TeamMembers, *api.ErrorResponse) {
users, err := dataBase.GetTeamUsers(teamID)

Expand Down Expand Up @@ -162,7 +162,7 @@ func addTeamsForNewUsers(dataBase moira.Database, teamID string, newUsers map[st
return teamsMap, nil
}

// SetTeamUsers is a controller function that sets all users for team
// SetTeamUsers is a controller function that sets all users for team.
func SetTeamUsers(dataBase moira.Database, teamID string, allUsers []string) (dto.TeamMembers, *api.ErrorResponse) {
existingUsers, err := dataBase.GetTeamUsers(teamID)
if err != nil {
Expand Down Expand Up @@ -238,7 +238,7 @@ func addUserTeam(teamID string, teams []string) ([]string, error) {
return teams, nil
}

// AddTeamUsers is a controller function that adds a users to certain team
// AddTeamUsers is a controller function that adds a users to certain team.
func AddTeamUsers(dataBase moira.Database, teamID string, newUsers []string) (dto.TeamMembers, *api.ErrorResponse) {
existingUsers, err := dataBase.GetTeamUsers(teamID)
if err != nil {
Expand Down Expand Up @@ -293,7 +293,7 @@ func AddTeamUsers(dataBase moira.Database, teamID string, newUsers []string) (dt
return result, nil
}

// UpdateTeam is a controller function that updates an existing team in Moira
// UpdateTeam is a controller function that updates an existing team in Moira.
func UpdateTeam(dataBase moira.Database, teamID string, team dto.TeamModel) (dto.SaveTeamResponse, *api.ErrorResponse) {
err := dataBase.SaveTeam(teamID, team.ToMoiraTeam())
if err != nil {
Expand All @@ -302,7 +302,7 @@ func UpdateTeam(dataBase moira.Database, teamID string, team dto.TeamModel) (dto
return dto.SaveTeamResponse{ID: teamID}, nil
}

// DeleteTeam is a controller function that removes an existing team in Moira
// DeleteTeam is a controller function that removes an existing team in Moira.
func DeleteTeam(dataBase moira.Database, teamID, userLogin string) (dto.SaveTeamResponse, *api.ErrorResponse) {
teamUsers, err := dataBase.GetTeamUsers(teamID)
if err != nil {
Expand Down Expand Up @@ -332,7 +332,7 @@ func DeleteTeam(dataBase moira.Database, teamID, userLogin string) (dto.SaveTeam
return dto.SaveTeamResponse{ID: teamID}, nil
}

// DeleteTeamUser is a controller function that removes a user from certain team
// DeleteTeamUser is a controller function that removes a user from certain team.
func DeleteTeamUser(dataBase moira.Database, teamID string, removeUserID string) (dto.TeamMembers, *api.ErrorResponse) {
existingUsers, err := dataBase.GetTeamUsers(teamID)
if err != nil {
Expand Down Expand Up @@ -419,7 +419,7 @@ func CheckUserPermissionsForTeam(dataBase moira.Database, teamID, userID string)
return nil
}

// GetTeamSettings gets team contacts and subscriptions
// GetTeamSettings gets team contacts and subscriptions.
func GetTeamSettings(database moira.Database, teamID string) (dto.TeamSettings, *api.ErrorResponse) {
teamSettings := dto.TeamSettings{
TeamID: teamID,
Expand Down
Loading

0 comments on commit 19d0a7b

Please sign in to comment.