<commit_before>package catalogue

import (
	"flag"
	"github.com/watermint/toolbox/infra/recpie/rc_group"
	"github.com/watermint/toolbox/infra/recpie/rc_recipe"
	"github.com/watermint/toolbox/infra/recpie/rc_vo_impl"
	"github.com/watermint/toolbox/infra/ui/app_ui"
	"github.com/watermint/toolbox/quality/infra/qt_recipe"
	"testing"
)

func TestCatalogue(t *testing.T) {
	_, _, _, ui := qt_recipe.Resources(t)
	testGroup(Catalogue(), ui)
}

func testGroup(g *rc_group.Group, ui app_ui.UI) {
	g.PrintUsage(ui)
	for _, sg := range g.SubGroups {
		testGroup(sg, ui)
	}
	for _, r := range g.Recipes {
		testRecipe(g, r, ui)
	}
}

func testRecipe(g *rc_group.Group, r rc_recipe.Recipe, ui app_ui.UI) {
	vo := r.Requirement()
	f := flag.NewFlagSet("", flag.ContinueOnError)
	vc := rc_vo_impl.NewValueContainer(vo)
	vc.MakeFlagSet(f, ui)
	g.PrintRecipeUsage(ui, r, f)
}<commit_msg>#215 : apply changes for test<commit_after>package catalogue

import (
	"flag"
	"github.com/watermint/toolbox/infra/recpie/rc_group"
	"github.com/watermint/toolbox/infra/recpie/rc_recipe"
	"github.com/watermint/toolbox/infra/recpie/rc_vo_impl"
	"github.com/watermint/toolbox/infra/ui/app_ui"
	"github.com/watermint/toolbox/quality/infra/qt_recipe"
	"testing"
)

func TestCatalogue(t *testing.T) {
	_, _, _, ui := qt_recipe.Resources(t)
	testGroup(Catalogue(), ui)
}

func testGroup(g *rc_group.Group, ui app_ui.UI) {
	g.PrintUsage(ui)
	for _, sg := range g.SubGroups {
		testGroup(sg, ui)
	}
	for _, r := range g.Recipes {
		testRecipe(g, r, ui)
	}
}

func testRecipe(g *rc_group.Group, r rc_recipe.Recipe, ui app_ui.UI) {
	switch scr := r.(type) {
	case rc_recipe.SideCarRecipe:
		vo := scr.Requirement()
		f := flag.NewFlagSet("", flag.ContinueOnError)
		vc := rc_vo_impl.NewValueContainer(vo)
		vc.MakeFlagSet(f, ui)
		g.PrintRecipeUsage(ui, r, f)
	}
}
{'fraction_non_alphanumeric': 0.15489874110563764, 'fraction_numerical': 0.0016420361247947454, 'mean_word_length': 4.6419753086419755, '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': '7191339', 'n_tokens_mistral': 806, 'n_tokens_neox': 777, 'n_words': 119}