File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package parser
2+
3+ // Commit represents a commit that adheres to the conventional commits specification
4+ type Commit struct {
5+ Header Header
6+ Body string
7+ Footer Footer
8+
9+ BreakingChange bool
10+
11+ FullCommit string
12+ }
13+
14+ // Header represents Header in commit message
15+ type Header struct {
16+ Type string
17+ Scope string
18+ Description string
19+ FullHeader string
20+ }
21+
22+ // Footer represents Footer in commit message
23+ type Footer struct {
24+ Notes []FooterNote
25+ FullFooter string
26+ }
27+
28+ // FooterNote represents one footer note in Footer
29+ type FooterNote struct {
30+ Token string
31+ Value string
32+ }
33+
34+ func newFooterNote (token , value string ) FooterNote {
35+ return FooterNote {Token : token , Value : value }
36+ }
Original file line number Diff line number Diff line change 1313 errNoNewLine = errors .New ("commit description not followed by an empty line" )
1414)
1515
16- // Commit represents a commit that adheres to the conventional commits specification
17- type Commit struct {
18- Header Header
19- Body string
20- Footer Footer
21-
22- BreakingChange bool
23-
24- FullCommit string
25- }
26-
27- // Header represents Header in commit message
28- type Header struct {
29- Type string
30- Scope string
31- Description string
32- FullHeader string
33- }
34-
35- // Footer represents Footer in commit message
36- type Footer struct {
37- Notes []FooterNote
38- FullFooter string
39- }
40-
41- // FooterNote represents one footer note in Footer
42- type FooterNote struct {
43- Token string
44- Value string
45- }
46-
47- func newFooterNote (token , value string ) FooterNote {
48- return FooterNote {Token : token , Value : value }
49- }
50-
5116// Parse attempts to parse a commit message to a conventional commit
5217func Parse (message string ) (* Commit , error ) {
5318 message = strings .TrimRight (message , "\n \t " )
You can’t perform that action at this time.
0 commit comments