mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-23 02:15:12 +00:00
chore(ci): add golangci-lint action and apply linting changes (#120)
BREAKING CHANGE: `JiraIssueId` has been renamed to `JiraIssueID`. This impacts the value for `pattern_maps` in `config.yml`. * chore(ci): add golangci-lint action * chore(lint): address errcheck lint failures * chore(lint): address misspell lint failures * chore(lint): address gocritic lint failures * chore(lint): address golint lint failures * chore(lint): address structcheck lint failures * chore(lint): address gosimple lint failures * chore(lint): address gofmt lint failures * chore(ci): port to official golangci-lint github action * Update golangci configuration for better coverage Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * fix: file is not goimports-ed Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * fix: golint and exported functions comments Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * chore(lint): address gosec G304 warning * chore(lint): address uparam warnings * chore(lint): address scopelint lint failures * fix: cyclomatic complexity Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com> * chore(lint): address prealloc warning, noting that we are warning for now * chore(lint): address govet and errorlint failures * chore: clean up defer logic when checking errors Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
This commit is contained in:
parent
2c3d3f400e
commit
ae3382b7c8
37 changed files with 391 additions and 177 deletions
|
|
@ -80,7 +80,7 @@ func newCommitParser(logger *Logger, client gitcmd.Client, jiraClient JiraClient
|
|||
reRef: regexp.MustCompile("(?i)(" + joinedRefActions + ")\\s?([\\w/\\.\\-]+)?(?:" + joinedIssuePrefix + ")(\\d+)"),
|
||||
reIssue: regexp.MustCompile("(?:" + joinedIssuePrefix + ")(\\d+)"),
|
||||
reNotes: regexp.MustCompile("^(?i)\\s*(" + joinedNoteKeywords + ")[:\\s]+(.*)"),
|
||||
reMention: regexp.MustCompile("@([\\w-]+)"),
|
||||
reMention: regexp.MustCompile(`@([\w-]+)`),
|
||||
reJiraIssueDescription: regexp.MustCompile(opts.JiraIssueDescriptionPattern),
|
||||
}
|
||||
}
|
||||
|
|
@ -223,8 +223,8 @@ func (p *commitParser) processHeader(commit *Commit, input string) {
|
|||
commit.Mentions = p.parseMentions(input)
|
||||
|
||||
// Jira
|
||||
if commit.JiraIssueId != "" {
|
||||
p.processJiraIssue(commit, commit.JiraIssueId)
|
||||
if commit.JiraIssueID != "" {
|
||||
p.processJiraIssue(commit, commit.JiraIssueID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -364,10 +364,10 @@ func (p *commitParser) uniqMentions(mentions []string) []string {
|
|||
return arr
|
||||
}
|
||||
|
||||
func (p *commitParser) processJiraIssue(commit *Commit, issueId string) {
|
||||
issue, err := p.jiraClient.GetJiraIssue(commit.JiraIssueId)
|
||||
func (p *commitParser) processJiraIssue(commit *Commit, issueID string) {
|
||||
issue, err := p.jiraClient.GetJiraIssue(commit.JiraIssueID)
|
||||
if err != nil {
|
||||
p.logger.Error(fmt.Sprintf("Failed to parse Jira story %s: %s\n", issueId, err))
|
||||
p.logger.Error(fmt.Sprintf("Failed to parse Jira story %s: %s\n", issueID, err))
|
||||
return
|
||||
}
|
||||
commit.Type = p.config.Options.JiraTypeMaps[issue.Fields.Type.Name]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue