From 59d1db00253b0d158e5ce95e263faddd5a4b0364 Mon Sep 17 00:00:00 2001 From: Oliver Braun Date: Tue, 5 Nov 2024 15:30:13 +0100 Subject: [PATCH] refactor: rm unused parameters --- gitlab/protect.go | 10 +++++----- gitlab/setaccess.go | 10 +++++----- gitlab/update.go | 12 +++++------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gitlab/protect.go b/gitlab/protect.go index 8052fe1..9022b6b 100644 --- a/gitlab/protect.go +++ b/gitlab/protect.go @@ -13,7 +13,7 @@ import ( ) func (c *Client) ProtectToBranch(assignmentCfg *config.AssignmentConfig) { - assignmentGitLabGroupID, err := c.getGroupID(assignmentCfg) + _, err := c.getGroupID(assignmentCfg) if err != nil { fmt.Printf("error: GitLab group for assignment does not exist, please create the group %s\n", assignmentCfg.URL) os.Exit(1) @@ -21,9 +21,9 @@ func (c *Client) ProtectToBranch(assignmentCfg *config.AssignmentConfig) { switch per := assignmentCfg.Per; per { case config.PerGroup: - c.protectToBranchPerGroup(assignmentCfg, assignmentGitLabGroupID) + c.protectToBranchPerGroup(assignmentCfg) case config.PerStudent: - c.protectToBranchPerStudent(assignmentCfg, assignmentGitLabGroupID) + c.protectToBranchPerStudent(assignmentCfg) default: fmt.Printf("it is only possible to protect the branch for students oder groups, not for %v", per) os.Exit(1) @@ -111,7 +111,7 @@ func (c *Client) protectBranch(assignmentCfg *config.AssignmentConfig, project * return nil } -func (c *Client) protectToBranchPerStudent(assignmentCfg *config.AssignmentConfig, assignmentGroupID int) { +func (c *Client) protectToBranchPerStudent(assignmentCfg *config.AssignmentConfig) { if len(assignmentCfg.Students) == 0 { fmt.Println("no students in config for assignment found") return @@ -134,7 +134,7 @@ func (c *Client) protectToBranchPerStudent(assignmentCfg *config.AssignmentConfi } } -func (c *Client) protectToBranchPerGroup(assignmentCfg *config.AssignmentConfig, assignmentGroupID int) { +func (c *Client) protectToBranchPerGroup(assignmentCfg *config.AssignmentConfig) { if len(assignmentCfg.Groups) == 0 { log.Info().Str("group", assignmentCfg.Course).Msg("no groups found") return diff --git a/gitlab/setaccess.go b/gitlab/setaccess.go index adc5ed6..9d23334 100644 --- a/gitlab/setaccess.go +++ b/gitlab/setaccess.go @@ -13,7 +13,7 @@ import ( ) func (c *Client) Setaccess(assignmentCfg *config.AssignmentConfig) { - assignmentGitLabGroupID, err := c.getGroupID(assignmentCfg) + _, err := c.getGroupID(assignmentCfg) if err != nil { fmt.Printf("error: GitLab group for assignment does not exist, please create the group %s\n", assignmentCfg.URL) os.Exit(1) @@ -21,9 +21,9 @@ func (c *Client) Setaccess(assignmentCfg *config.AssignmentConfig) { switch per := assignmentCfg.Per; per { case config.PerGroup: - c.setaccessPerGroup(assignmentCfg, assignmentGitLabGroupID) + c.setaccessPerGroup(assignmentCfg) case config.PerStudent: - c.setaccessPerStudent(assignmentCfg, assignmentGitLabGroupID) + c.setaccessPerStudent(assignmentCfg) default: fmt.Printf("it is only possible to set access levels for students oder groups, not for %v", per) os.Exit(1) @@ -153,7 +153,7 @@ func (c *Client) inviteByEmail(cfg *config.AssignmentConfig, projectID int, emai return fmt.Sprintf("successfully invited user %s", email), nil } -func (c *Client) setaccessPerStudent(assignmentCfg *config.AssignmentConfig, assignmentGroupID int) { +func (c *Client) setaccessPerStudent(assignmentCfg *config.AssignmentConfig) { if len(assignmentCfg.Students) == 0 { fmt.Println("no students in config for assignment found") return @@ -174,7 +174,7 @@ func (c *Client) setaccessPerStudent(assignmentCfg *config.AssignmentConfig, ass } } -func (c *Client) setaccessPerGroup(assignmentCfg *config.AssignmentConfig, assignmentGroupID int) { +func (c *Client) setaccessPerGroup(assignmentCfg *config.AssignmentConfig) { if len(assignmentCfg.Groups) == 0 { log.Info().Str("group", assignmentCfg.Course).Msg("no groups found") return diff --git a/gitlab/update.go b/gitlab/update.go index 682786d..cd35702 100644 --- a/gitlab/update.go +++ b/gitlab/update.go @@ -14,7 +14,7 @@ import ( ) func (c *Client) Update(assignmentCfg *config.AssignmentConfig) { - assignmentGitLabGroupID, err := c.getGroupID(assignmentCfg) + _, err := c.getGroupID(assignmentCfg) if err != nil { fmt.Printf("error: GitLab group for assignment does not exist, please create the group %s\n", assignmentCfg.URL) os.Exit(1) @@ -33,9 +33,9 @@ func (c *Client) Update(assignmentCfg *config.AssignmentConfig) { switch per := assignmentCfg.Per; per { case config.PerGroup: - c.updatePerGroup(assignmentCfg, assignmentGitLabGroupID, starterrepo) + c.updatePerGroup(assignmentCfg, starterrepo) case config.PerStudent: - c.updatePerStudent(assignmentCfg, assignmentGitLabGroupID, starterrepo) + c.updatePerStudent(assignmentCfg, starterrepo) default: fmt.Printf("it is only possible to update for students oder groups, not for %v", per) os.Exit(1) @@ -89,8 +89,7 @@ func (c *Client) update(assignmentCfg *config.AssignmentConfig, project *gitlab. } } -func (c *Client) updatePerStudent(assignmentCfg *config.AssignmentConfig, assignmentGroupID int, - starterrepo *git.Starterrepo) { +func (c *Client) updatePerStudent(assignmentCfg *config.AssignmentConfig, starterrepo *git.Starterrepo) { if len(assignmentCfg.Students) == 0 { log.Info().Str("group", assignmentCfg.Course).Msg("no students found") return @@ -111,8 +110,7 @@ func (c *Client) updatePerStudent(assignmentCfg *config.AssignmentConfig, assign } } -func (c *Client) updatePerGroup(assignmentCfg *config.AssignmentConfig, assignmentGroupID int, - starterrepo *git.Starterrepo) { +func (c *Client) updatePerGroup(assignmentCfg *config.AssignmentConfig, starterrepo *git.Starterrepo) { if len(assignmentCfg.Groups) == 0 { log.Info().Str("group", assignmentCfg.Course).Msg("no groups found") return