quality

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

cmd/product/quality/quality.go

Index

Constants

This section is empty.

Variables

View Source
var QualityCmd = &cobra.Command{
	Use:           "quality",
	Example:       `  contextvibes product quality`,
	Args:          cobra.NoArgs,
	SilenceUsage:  true,
	SilenceErrors: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		ctx := cmd.Context()

		presenter.Summary("Running Code Quality Checks")

		cwd, err := os.Getwd()
		if err != nil {
			presenter.Error("Failed to get current working directory: %v", err)

			return err
		}

		projType, err := project.Detect(cwd)
		if err != nil {
			presenter.Error("Failed to detect project type: %v", err)

			return err
		}
		presenter.Info("Detected project type: %s", presenter.Highlight(string(projType)))

		var criticalErrors []string

		switch projType {
		case project.Go:
			failures := executeEnhancedGoQualityChecks(ctx, presenter, globals.ExecClient)
			if len(failures) > 0 {
				criticalErrors = append(criticalErrors, failures...)
			}
		default:
			presenter.Info("No specific quality checks for project type: %s", projType)

			return nil
		}

		presenter.Newline()
		presenter.Header("Quality Checks Summary")
		if len(criticalErrors) > 0 {
			errorMsg := fmt.Sprintf("%d critical quality check(s) failed.", len(criticalErrors))
			presenter.Error(errorMsg)
			for _, failure := range criticalErrors {
				presenter.Detail("- %s", failure)
			}

			return errors.New(errorMsg)
		}
		presenter.Success("All quality checks passed.")

		return nil
	},
}

QualityCmd represents the quality command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL