<commit_before>package checklist

import (
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"regexp"
	"strings"

	"github.com/karolgorecki/goprove/util"
)

func projectBuilds() bool {
	_, err := exec.Command("go", "build", sourcePath).Output()
	return err == nil
}

func isFormatted() bool {
	output, _ := exec.Command("gofmt", "-l -s", sourcePath).Output()
	return len(output) == 0
}

func testPassing() bool {
	output, _ := exec.Command("go", "test", sourcePath+"/...").Output()
	return strings.Index(string(output), `--- FAIL`) == -1
}

func hasLicense() bool {
	return util.FilesExistAny(sourcePath, "license", "licensing", "copying")
}

func hasReadme() bool {
	return util.FilesExistAny(sourcePath, "readme")
}<commit_msg>:memo: use go-license to hasLicense function - closes #4<commit_after>package checklist

import (
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"regexp"
	"strings"

	"github.com/ryanuber/go-license"

	"github.com/karolgorecki/goprove/util"
)

func projectBuilds() bool {
	_, err := exec.Command("go", "build", sourcePath).Output()
	return err == nil
}

func isFormatted() bool {
	output, _ := exec.Command("gofmt", "-l -s", sourcePath).Output()
	return len(output) == 0
}

func testPassing() bool {
	output, _ := exec.Command("go", "test", sourcePath+"/...").Output()
	return strings.Index(string(output), `--- FAIL`) == -1
}

func hasLicense() bool {
	if _, err := license.NewFromDir(sourcePath); err != nil {
		return false
	}
	return true
}

func hasReadme() bool {
	return util.FilesExistAny(sourcePath, "readme")
}
{'fraction_non_alphanumeric': 0.1847545219638243, 'fraction_numerical': 0.003229974160206718, 'mean_word_length': 4.512455516014235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1268614', 'n_tokens_mistral': 589, 'n_tokens_neox': 571, 'n_words': 124}