qualityprofiles

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package qualityprofiles manages named, per-language quality profiles: built-in defaults generated from the rule catalog plus tenant-scoped custom copies, and their per-project assignment. It is the application layer over domain/qualityprofile — it never touches HTTP, the DB, or an LLM directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service coordinates quality-profile reads, mutations, and project assignment.

func NewService

func NewService(store ports.QualityProfileStore, catalog ports.RuleCatalog, projects ports.ProjectRepository, audit ports.AuditLogger, clock ports.Clock) *Service

NewService wires the profile service. store persists custom profiles; catalog supplies built-ins and per-language rule sets; projects records the per-language assignment.

func (*Service) ActivateRule

func (s *Service) ActivateRule(ctx context.Context, actor string, tenantID shared.ID, key, ruleKey string, severity shared.Severity) (qualityprofile.Profile, error)

ActivateRule enables a rule in a custom profile (with an optional severity override).

func (*Service) Assign

func (s *Service) Assign(ctx context.Context, actor string, tenantID shared.ID, projectKey, language, profileKey string) error

Assign sets (or clears, with an empty profileKey) the profile assigned to a language for a project. The profile must exist and match the language.

func (*Service) Copy

func (s *Service) Copy(ctx context.Context, actor string, tenantID shared.ID, sourceKey, newKey, newName string) (qualityprofile.Profile, error)

Copy creates a custom profile from a built-in or another custom profile.

func (*Service) DeactivateRule

func (s *Service) DeactivateRule(ctx context.Context, actor string, tenantID shared.ID, key, ruleKey string) (qualityprofile.Profile, error)

DeactivateRule disables a rule in a custom profile.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, actor string, tenantID shared.ID, key string) error

Delete removes a custom profile. Built-in profiles cannot be deleted.

func (*Service) Get

func (s *Service) Get(ctx context.Context, tenantID shared.ID, key string) (qualityprofile.Profile, error)

Get resolves a profile by key: a built-in (from the catalog) or a tenant custom profile.

func (*Service) List

func (s *Service) List(ctx context.Context, tenantID shared.ID, language string) ([]qualityprofile.Profile, error)

List returns the built-in and custom profiles, optionally filtered to a single language.

func (*Service) OverlayForProject

func (s *Service) OverlayForProject(ctx context.Context, tenantID shared.ID, assigned map[string]string) (qualitygate.Profile, error)

OverlayForProject builds the combined .synapse-rules.yaml-equivalent overlay a project's assigned profiles impose on findings: each assigned language profile deactivates its non-active rules and applies severity overrides. Languages with no assignment (or an assignment to their built-in default) contribute nothing, so findings pass through unchanged. Rule keys are language-disjoint, so the per-language overlays union cleanly. A missing/mismatched assignment is skipped (best-effort: analysis is never failed by a stale assignment).

func (*Service) SetSeverity

func (s *Service) SetSeverity(ctx context.Context, actor string, tenantID shared.ID, key, ruleKey string, severity shared.Severity) (qualityprofile.Profile, error)

SetSeverity overrides the severity of an active rule in a custom profile.

Jump to

Keyboard shortcuts

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