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
|
|
@ -33,7 +33,7 @@ func TestCommitParserParse(t *testing.T) {
|
|||
mock, nil, &Config{
|
||||
Options: &Options{
|
||||
CommitFilters: map[string][]string{
|
||||
"Type": []string{
|
||||
"Type": {
|
||||
"feat",
|
||||
"fix",
|
||||
"perf",
|
||||
|
|
@ -79,7 +79,7 @@ func TestCommitParserParse(t *testing.T) {
|
|||
commits, err := parser.Parse("HEAD")
|
||||
assert.Nil(err)
|
||||
assert.Equal([]*Commit{
|
||||
&Commit{
|
||||
{
|
||||
Hash: &Hash{
|
||||
Long: "65cf1add9735dcc4810dda3312b0792236c97c4e",
|
||||
Short: "65cf1add",
|
||||
|
|
@ -97,7 +97,7 @@ func TestCommitParserParse(t *testing.T) {
|
|||
Merge: nil,
|
||||
Revert: nil,
|
||||
Refs: []*Ref{
|
||||
&Ref{
|
||||
{
|
||||
Action: "",
|
||||
Ref: "123",
|
||||
Source: "",
|
||||
|
|
@ -111,7 +111,7 @@ func TestCommitParserParse(t *testing.T) {
|
|||
Subject: "Add new feature #123",
|
||||
Body: "",
|
||||
},
|
||||
&Commit{
|
||||
{
|
||||
Hash: &Hash{
|
||||
Long: "14ef0b6d386c5432af9292eab3c8314fa3001bc7",
|
||||
Short: "14ef0b6d",
|
||||
|
|
@ -132,24 +132,24 @@ func TestCommitParserParse(t *testing.T) {
|
|||
},
|
||||
Revert: nil,
|
||||
Refs: []*Ref{
|
||||
&Ref{
|
||||
{
|
||||
Action: "",
|
||||
Ref: "3",
|
||||
Source: "",
|
||||
},
|
||||
&Ref{
|
||||
{
|
||||
Action: "Fixes",
|
||||
Ref: "3",
|
||||
Source: "",
|
||||
},
|
||||
&Ref{
|
||||
{
|
||||
Action: "Closes",
|
||||
Ref: "1",
|
||||
Source: "",
|
||||
},
|
||||
},
|
||||
Notes: []*Note{
|
||||
&Note{
|
||||
{
|
||||
Title: "BREAKING CHANGE",
|
||||
Body: "This is breaking point message.",
|
||||
},
|
||||
|
|
@ -167,7 +167,7 @@ Closes #1
|
|||
|
||||
BREAKING CHANGE: This is breaking point message.`,
|
||||
},
|
||||
&Commit{
|
||||
{
|
||||
Hash: &Hash{
|
||||
Long: "809a8280ffd0dadb0f4e7ba9fc835e63c37d6af6",
|
||||
Short: "809a8280",
|
||||
|
|
@ -201,7 +201,7 @@ BREAKING CHANGE: This is breaking point message.`,
|
|||
@hogefuga
|
||||
@FooBarBaz`,
|
||||
},
|
||||
&Commit{
|
||||
{
|
||||
Hash: &Hash{
|
||||
Long: "74824d6bd1470b901ec7123d13a76a1b8938d8d0",
|
||||
Short: "74824d6b",
|
||||
|
|
@ -219,19 +219,19 @@ BREAKING CHANGE: This is breaking point message.`,
|
|||
Merge: nil,
|
||||
Revert: nil,
|
||||
Refs: []*Ref{
|
||||
&Ref{
|
||||
{
|
||||
Action: "Fixes",
|
||||
Ref: "123",
|
||||
Source: "",
|
||||
},
|
||||
&Ref{
|
||||
{
|
||||
Action: "Closes",
|
||||
Ref: "456",
|
||||
Source: "username/repository",
|
||||
},
|
||||
},
|
||||
Notes: []*Note{
|
||||
&Note{
|
||||
{
|
||||
Title: "BREAKING CHANGE",
|
||||
Body: fmt.Sprintf(`This is multiline breaking change note.
|
||||
It is treated as the body of the Note until a mention or reference appears.
|
||||
|
|
@ -281,7 +281,7 @@ class MyController extends Controller {
|
|||
Fixes #123
|
||||
Closes username/repository#456`, "```", "```"),
|
||||
},
|
||||
&Commit{
|
||||
{
|
||||
Hash: &Hash{
|
||||
Long: "123456789735dcc4810dda3312b0792236c97c4e",
|
||||
Short: "12345678",
|
||||
|
|
@ -381,7 +381,7 @@ func TestCommitParserParseWithJira(t *testing.T) {
|
|||
mock, mockJiraClient{}, &Config{
|
||||
Options: &Options{
|
||||
CommitFilters: map[string][]string{
|
||||
"Type": []string{
|
||||
"Type": {
|
||||
"feat",
|
||||
"fix",
|
||||
"perf",
|
||||
|
|
@ -391,7 +391,7 @@ func TestCommitParserParseWithJira(t *testing.T) {
|
|||
HeaderPattern: "^(?:(\\w*)|(?:\\[(.*)\\])?)\\:\\s(.*)$",
|
||||
HeaderPatternMaps: []string{
|
||||
"Type",
|
||||
"JiraIssueId",
|
||||
"JiraIssueID",
|
||||
"Subject",
|
||||
},
|
||||
JiraTypeMaps: map[string]string{
|
||||
|
|
@ -403,7 +403,7 @@ func TestCommitParserParseWithJira(t *testing.T) {
|
|||
commits, err := parser.Parse("HEAD")
|
||||
assert.Nil(err)
|
||||
commit := commits[0]
|
||||
assert.Equal(commit.JiraIssueId, "JIRA-1111")
|
||||
assert.Equal(commit.JiraIssueID, "JIRA-1111")
|
||||
assert.Equal(commit.JiraIssue.Type, "Story")
|
||||
assert.Equal(commit.JiraIssue.Summary, "summary of JIRA-1111")
|
||||
assert.Equal(commit.JiraIssue.Description, "description of JIRA-1111")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue