<commit_before>#
# Variables
#
TROUSSEAU_VERSION = `awk '/TROUSSEAU_VERSION/ { gsub("\"", ""); print $$NF }' $(CURDIR)/constants.go`

#
# Golang packages definition
#
PROJECT_PACKAGE   = github.com/oleiade/trousseau
TROUSSEAU_PACKAGE = $(PROJECT_PACKAGE)/trousseau

#
# Directories
#
GOPATH_DIR = $(CURDIR)/.gopath
SRC_DIR    = $(GOPATH_DIR)/src
BIN_DIR    = $(CURDIR)/bin
DIST_DIR   = $(CURDIR)/dist

PROJECT_DIR   = $(SRC_DIR)/$(PROJECT_PACKAGE)
TROUSSEAU_DIR = $(SRC_DIR)/$(TROUSSEAU_PACKAGE)

#
# Executables definition
#
TROUSSEAU_BIN_NAME = trousseau
TROUSSEAU_BIN = $(BIN_DIR)/$(TROUSSEAU_BIN_NAME)

#
# GOPATH definition
#
GOPATH     ?= $(GOPATH_DIR)
export GOPATH
OLD_GOPATH  = $(GOPATH)

#
# Compilations options
#
GO_OPTIONS = -a

#
# Packaging options
#
XC_ARCH ?= "386 amd64 arm"
XC_OS   ?= "linux darwin windows freebsd openbsd"

#
# Compilation rules
#
all: $(TROUSSEAU_BIN)

$(TROUSSEAU_BIN): $(TROUSSEAU_DIR)
				@mkdir -p $(dir $@)
				@export GOPATH=$(GOPATH_DIR); \
				 cd $<; go build -o $@; \
				 export GOPATH=$(OLD_GOPATH);

$(PROJECT_DIR):
				@mkdir -p $(GOPATH_DIR)

$(TROUSSEAU_DIR): $(PROJECT_DIR)
				@export GOPATH=$(GOPATH_DIR); \
				 cd $(CURDIR)/trousseau/; go get -d; \
				 export GOPATH=$(OLD_GOPATH);

clean:
				@rm -rf $(dir $(TROUSSEAU_BIN))
ifeq ($(GOPATH), $(BUILD_DIR))
				@rm -rf $(BUILD_DIR)
else ifneq ($(PROJECT_DIR), $(realpath $(PROJECT_DIR)))
				@rm -f $(PROJECT_DIR)
endif

package:
				@(echo $(TROUSSEAU_VERSION))
				@(go get github.com/laher/goxc)
				@(cd $(TROUSSEAU_DIR); goxc -arch=$(XC_ARCH) -os=$(XC_OS) -pv=$(TROUSSEAU_VERSION) -d=$(DIST_DIR) -tasks-="go-test")

.PHONY: all clean $(TROUSSEAU_BIN) $(TROUSSEAU_DIR) $(PROJECT_DIR)<commit_msg>Add test rule to Makefile<commit_after>#
# Variables
#
TROUSSEAU_VERSION = `awk '/TROUSSEAU_VERSION/ { gsub("\"", ""); print $$NF }' $(CURDIR)/constants.go`

#
# Golang packages definition
#
PROJECT_PACKAGE   = github.com/oleiade/trousseau
TROUSSEAU_PACKAGE = $(PROJECT_PACKAGE)/trousseau
DSN_PACKAGE 	  = $(PROJECT_PACKAGE)/dsn

#
# Directories
#
GOPATH_DIR = $(CURDIR)/.gopath
SRC_DIR    = $(GOPATH_DIR)/src
BIN_DIR    = $(CURDIR)/bin
DIST_DIR   = $(CURDIR)/dist

PROJECT_DIR   = $(SRC_DIR)/$(PROJECT_PACKAGE)
TROUSSEAU_DIR = $(SRC_DIR)/$(TROUSSEAU_PACKAGE)
DSN_DIR 	  = $(SRC_DIR)/$(DSN_PACKAGE)

#
# Executables definition
#
TROUSSEAU_BIN_NAME = trousseau
TROUSSEAU_BIN = $(BIN_DIR)/$(TROUSSEAU_BIN_NAME)

#
# GOPATH definition
#
GOPATH     ?= $(GOPATH_DIR)
export GOPATH
OLD_GOPATH  = $(GOPATH)

#
# Compilations options
#
GO_OPTIONS = -a

#
# Packaging options
#
XC_ARCH ?= "386 amd64 arm"
XC_OS   ?= "linux darwin windows freebsd openbsd"

#
# Compilation rules
#
all: $(TROUSSEAU_BIN)

$(TROUSSEAU_BIN): $(TROUSSEAU_DIR)
				@mkdir -p $(dir $@)
				@export GOPATH=$(GOPATH_DIR); \
				 cd $<; go build -o $@; \
				 export GOPATH=$(OLD_GOPATH);

$(PROJECT_DIR):
				@mkdir -p $(GOPATH_DIR)

$(TROUSSEAU_DIR): $(PROJECT_DIR)
				@export GOPATH=$(GOPATH_DIR); \
				 cd $(CURDIR)/trousseau/; go get -d; \
				 export GOPATH=$(OLD_GOPATH);

clean:
				@rm -rf $(dir $(TROUSSEAU_BIN))
ifeq ($(GOPATH), $(BUILD_DIR))
				@rm -rf $(BUILD_DIR)
else ifneq ($(PROJECT_DIR), $(realpath $(PROJECT_DIR)))
				@rm -f $(PROJECT_DIR)
endif

test:
				@(export GOPATH=$(GOPATH_DIR))
				@(go test -i)
				@(echo "--- Testing trousseau package ---")
				-@(go test -v)
				@(for package in $(DSN_DIR) $(TROUSSEAU_DIR); do\
				  echo "--- Testing $$package ---";\
				  cd $$package && go test -v;\
				  echo "\n";\
				  done)

package:
				@(echo $(TROUSSEAU_VERSION))
				@(go get github.com/laher/goxc)
				@(cd $(TROUSSEAU_DIR); goxc -arch=$(XC_ARCH) -os=$(XC_OS) -pv=$(TROUSSEAU_VERSION) -d=$(DIST_DIR) -tasks-="go-test")

.PHONY: all clean $(TROUSSEAU_BIN) $(TROUSSEAU_DIR) $(PROJECT_DIR)
{'fraction_non_alphanumeric': 0.17755532139093783, 'fraction_numerical': 0.0026343519494204425, 'mean_word_length': 4.07620320855615, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6655115', 'n_tokens_mistral': 1786, 'n_tokens_neox': 1570, 'n_words': 299}