walmartdigital / commit-message-formatter Goto Github PK
View Code? Open in Web Editor NEWCMF is a simple-2-use utility to standardize commit messages on projects
License: MIT License
CMF is a simple-2-use utility to standardize commit messages on projects
License: MIT License
Hey, first of kudos for the nice work. I really like the functionality that you have put together with this branch.
I would like to know if you would be open to receive a PR with some added behavior for the JIRA template.
Let me know what you think of the suggestion and the approach and if you prefer I can open a PR with a draft and we discuss there.
Internally we use a specific naming convention for branches. Would you consider to expand the current functionality to extract the JIRA_TASK
based on a regex?
E.g., a branch with name feature/PRJ-0001
would become PRJ-0001
if I would pass the regex that would group the ID that I want.
With my approach I expect a valid regex to be defined in the config yaml (if the regex is not valid it will fail running CMF) and I also expect a group named JIRA_TASK
to be available inside the regex (if not provided it returns the original branch name).
Rough sample (The Go Playground):
package main
import (
"fmt"
"regexp"
)
func findKey(names []string) int {
key := "JIRA_TASK"
for i, v := range names {
if v == key {
return i
}
}
return 0
}
func getGitBranchName() string {
// Current behaviour to fetch the branch name
return "feature/PRJ-0001"
}
func getBranchName(regex string) (string, error) {
branchName := getGitBranchName()
r, err := regexp.Compile(regex)
if err == nil {
// Position of the group we expect (defaults to 0 to be the entire branch name)
pos := findKey(r.SubexpNames())
// Extracts the branch name
branchName = r.FindStringSubmatch(branchName)[pos]
}
return branchName, err
}
func main() {
jiraTaskRegex := "feature/(?P<JIRA_TASK>PRJ-[0-9]+)(-.*)?"
branchName, err := getBranchName(jiraTaskRegex)
if err == nil {
fmt.Println("Branch name: ", branchName)
} else {
fmt.Println("Error: ", err)
}
}
i love if you give more feedback in the terminal, because when i finish the cmf wizard, i dont now somethings important things like:
When prompt task ID show "Jira task from branch", short branch name (cut in second dash), "NO-STORY" or custom with default branch name text
Check current branch name with pattern to set default Jira Id
Having project with lint/test errors and add husky (npm run lint && npm run test)
Usin git
git commit -m "message"
The command execute my hooks and prevent commit/push when execution result has errors.
When use cmf, no execute commit but say is OK.
It would be good to add default message for las commit when amend
Option for amend showing last commit message
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.