Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislbr committed Sep 28, 2022
1 parent 1e28e36 commit d87e924
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions ready.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ func main() {
if err != nil {
log.Fatalf("Error installing hook: %v\n", err)
}

fmt.Println("Ready ready ✅")

os.Exit(0)
}

Expand All @@ -57,19 +55,15 @@ func main() {
if err != nil {
log.Fatalf("Error determining folders with changes: %v\n", err)
}

changed, err := exec.Command("git", "diff", "--name-only", "HEAD").CombinedOutput()
if err != nil {
log.Fatalf("Error determining files with changes: %v\n", err)
}

new, err := exec.Command("git", "ls-files", "--others").CombinedOutput()
if err != nil {
log.Fatalf("Error determining new files: %v\n", err)
}

files := append(changed, new...)

if t.Directory == "" {
if len(files) == 0 {
continue
Expand All @@ -86,9 +80,7 @@ func main() {
output, err := runTask(t)
if err != nil {
fmt.Printf("Failure ❌\n\n%v\n", err)

failures++

continue
}

Expand All @@ -112,7 +104,6 @@ func main() {
} else {
fmt.Printf("Got %d failures. Please fix them and try again ⚠️ \n\n", failures)
}

os.Exit(1)
}

Expand All @@ -124,13 +115,10 @@ func installHook() error {
_, err := os.Open(hook)
if err == nil {
fmt.Println("A pre-commit hook already exists ℹ️ Do you want to overwrite it? [yes/no]")

res := ""
fmt.Fscan(os.Stdin, &res)

if res != "yes" {
fmt.Println("Ready stopped 🛑")

os.Exit(0)
}
}
Expand Down Expand Up @@ -207,7 +195,6 @@ func runTask(t task) (string, error) {
if string(output) == "" {
return "", err
}

return "", errors.New(string(output))
}

Expand Down

0 comments on commit d87e924

Please sign in to comment.