<commit_before>package helpers

import (
	"fmt"
	"os"
	"path/filepath"

	ginkgoconfig "github.com/onsi/ginkgo/config"
	"github.com/onsi/ginkgo/reporters"
)

func EnableCFTrace(config Config, componentName string) {
	os.Setenv("CF_TRACE", traceLogFilePath(config, componentName))
}

func traceLogFilePath(config Config, componentName string) string {
	return filepath.Join(config.ArtifactsDirectory, fmt.Sprintf("CATS-TRACE-%s-%d.txt", componentName, ginkgoNode()))
}

func NewJUnitReporter(config Config, componentName string) *reporters.JUnitReporter {
	return reporters.NewJUnitReporter(jUnitReportFilePath(config, componentName))
}

func jUnitReportFilePath(config Config, componentName string) string {
	return filepath.Join(config.ArtifactsDirectory, fmt.Sprintf("junit-%s-%d.xml", componentName, ginkgoNode()))
}

func ginkgoNode() int {
	return ginkgoconfig.GinkgoConfig.ParallelNode
}<commit_msg>Sanitize component name to fix bad CF_TRACE<commit_after>package helpers

import (
	"fmt"
	"os"
	"path/filepath"
	"strings"

	ginkgoconfig "github.com/onsi/ginkgo/config"
	"github.com/onsi/ginkgo/reporters"
)

func EnableCFTrace(config Config, componentName string) {
	os.Setenv("CF_TRACE", traceLogFilePath(config, componentName))
}

func traceLogFilePath(config Config, componentName string) string {
	return filepath.Join(config.ArtifactsDirectory, fmt.Sprintf("CATS-TRACE-%s-%d.txt", sanitizeComponentName(componentName), ginkgoNode()))
}

func NewJUnitReporter(config Config, componentName string) *reporters.JUnitReporter {
	return reporters.NewJUnitReporter(jUnitReportFilePath(config, componentName))
}

func jUnitReportFilePath(config Config, componentName string) string {
	return filepath.Join(config.ArtifactsDirectory, fmt.Sprintf("junit-%s-%d.xml", sanitizeComponentName(componentName), ginkgoNode()))
}

func ginkgoNode() int {
	return ginkgoconfig.GinkgoConfig.ParallelNode
}

func sanitizeComponentName(componentName string) string {
	return strings.Replace(componentName, " ", "_", -1)
}
{'fraction_non_alphanumeric': 0.11597809855649577, 'fraction_numerical': 0.0004977600796416127, 'mean_word_length': 7.340248962655601, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1507777', 'n_tokens_mistral': 654, 'n_tokens_neox': 647, 'n_words': 120}