<commit_before>package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"

	"gopkg.in/yaml.v2"
)

type Task struct {
	Command        string `yaml:"task"`
	Port           int
	File           string
	SuccessCommand string `yaml:"success"`
	Always         bool
	Front          bool
}

func (t *Task) CheckAndRun() error {
	if t.Front {
		// return t.keepRunInFront()
		return fmt.Errorf("Not yet implemented")
	} else {
		toRun, err := t.toRun()
		if err != nil {
			return err
		}
		if toRun {
			return t.run()
		}
		fmt.Printf("Skipping Run: %s\n", t.Command)
		return nil
	}
}

func (t *Task) toRun() (bool, error) {
	switch {
	case t.Port != 0:
		return checkPort(t)
	case t.File != "":
		return checkFile(t)
	default:
		return false, fmt.Errorf("Invalid or unsupported config: %v", t)<commit_msg>Always option<commit_after>package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"

	"gopkg.in/yaml.v2"
)

type Task struct {
	Command        string `yaml:"task"`
	Port           int
	File           string
	SuccessCommand string `yaml:"success"`
	Always         bool
	Front          bool
}

func (t *Task) CheckAndRun() error {
	if t.Front {
		// return t.keepRunInFront()
		return fmt.Errorf("Not yet implemented")
	} else {
		toRun, err := t.toRun()
		if err != nil {
			return err
		}
		if toRun {
			return t.run()
		}
		fmt.Printf("Skipping Run: %s\n", t.Command)
		return nil
	}
}

func (t *Task) toRun() (bool, error) {
	switch {
	case t.Port != 0:
		return checkPort(t)
	case t.File != "":
		return checkFile(t)
	case t.Always:
		return true, nil
	default:
		return false, fmt.Errorf("Invalid or unsupported config: %v", t)
{'fraction_non_alphanumeric': 0.14095583787053842, 'fraction_numerical': 0.0024198427102238356, 'mean_word_length': 2.6674057649667406, 'pattern_counts': {'":': 2, '<': 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': '5635328', 'n_tokens_mistral': 670, 'n_tokens_neox': 629, 'n_words': 171}