Documentation ¶
Overview ¶
Package v1alpha1 stores definitions and methods to handle code quality definitions, results +kubebuilder:object:generate=true +k8s:deepcopy-gen=package +groupName=codequality.pkg.katanomi.dev
Index ¶
- Constants
- Variables
- func PassedTestsRate(t *TestResult) string
- type AnalisysMetrics
- type AnalysisRating
- type AnalysisResult
- type AutomatedTestResult
- type CodeChangeMetrics
- type CodeChangeRates
- type CodeLintIssues
- type CodeLintResult
- type CodeSize
- type NamedAnalysisResult
- type NamedAnalysisResults
- type NamedAutomatedTestResults
- type NamedCodeLintResult
- type NamedCodeLintResults
- type NamedUnitTestsResult
- type NamedUnitTestsResults
- type ReportFile
- type TestCoverage
- type TestResult
- type UnitTestsResult
Constants ¶
const ( // Reliability metrics is based on the number of bugs // found during code analysis CodeRatingTypeReliability = "Reliability" // Vunerability metrics is based on the number of security issues // found during code analysis CodeRatingTypeVunerability = "Vunerability" // Maintainability metrics is based on the number of code smells // found during code analysis CodeRatingTypeMaintainability = "Maintainability" // SecurityHotspots metrics is based on the number of possible security issues // found during code analysis CodeRatingTypeSecurityHotspots = "SecurityHotspots" // Succeeded alias for metav1alpha1.SucceededReason Succeeded = metav1alpha1.SucceededReason // Failed alias for metav1alpha1.FailedReason Failed = metav1alpha1.FailedReason )
const ( // CodeRatingRateA A rating CodeRatingRateA = "A" // CodeRatingRateB B rating CodeRatingRateB = "B" // CodeRatingRateC C rating CodeRatingRateC = "C" // CodeRatingRateD D rating CodeRatingRateD = "D" // CodeRatingRateE E rating CodeRatingRateE = "E" )
Variables ¶
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "codequality.pkg.katanomi.dev", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
func PassedTestsRate ¶
func PassedTestsRate(t *TestResult) string
PassedTestsRate rate of passed tests calculated using passed / (passed + failed) * 100, i.e 96.54 if input t is nil, will return "0.00"
Types ¶
type AnalisysMetrics ¶
type AnalisysMetrics struct { // Branch store rate metrics for current Branch *CodeChangeMetrics `json:"branch"` // Target stores target branch data // only populated when using a Pull Request // +optional Target *CodeChangeMetrics `json:"target,omitempty"` // Ratings resulted from code scan analysis // stores one rating type as an item // using the key as unique identifier for the rating type Ratings map[string]AnalysisRating `json:"ratings,omitempty"` // Languages detected in code base // +optional Languages []string `json:"languages"` // CodeSize based on scanned code base CodeSize *CodeSize `json:"codeSize"` }
AnalisysMetrics b
func (*AnalisysMetrics) DeepCopy ¶
func (in *AnalisysMetrics) DeepCopy() *AnalisysMetrics
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalisysMetrics.
func (*AnalisysMetrics) DeepCopyInto ¶
func (in *AnalisysMetrics) DeepCopyInto(out *AnalisysMetrics)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (AnalisysMetrics) GetObjectWithValues ¶
func (AnalisysMetrics) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *AnalisysMetrics)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
func (*AnalisysMetrics) IsEmpty ¶
func (a *AnalisysMetrics) IsEmpty() bool
IsEmpty returns true if is nil or is empty
type AnalysisRating ¶
type AnalysisRating struct { // Rate describe the analysis rate, such as: // - A // - B // - C // - D // - E Rate string `json:"rate"` // IssuesCount stores the related issues number // for the analyzed metric IssuesCount int `json:"issues"` }
AnalysisRating ratings by type supports adding customized types Rate describe the analysis rate, such as: - A - B - C - D - E IssuesCount stores the related issues number
func (*AnalysisRating) DeepCopy ¶
func (in *AnalysisRating) DeepCopy() *AnalysisRating
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalysisRating.
func (*AnalysisRating) DeepCopyInto ¶
func (in *AnalysisRating) DeepCopyInto(out *AnalysisRating)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (AnalysisRating) GetObjectWithValues ¶
func (AnalysisRating) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *AnalysisRating)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
type AnalysisResult ¶
type AnalysisResult struct { // Result of the code analysis: // - Succeeded: successful code analysis with passing quality gates // - Failed: failed code analysis // - Canceled: canceled code analysis due to canceled task // +optional Result string `json:"result,omitempty"` // ReportURL for analyzed code revision // +optional ReportURL string `json:"reportURL,omitempty"` // TaskID of the performed analysis // +optional TaskID string `json:"taskID,omitempty"` // ProjectID for code analysis tool // +optional ProjectID string `json:"projectID,omitempty"` // Metrics for code analysis Metrics *AnalisysMetrics `json:"metrics,omitempty"` }
AnalysisResult stores the result of a code analysis performed storing the specific Result, the remote report address, the specific task id used for the project id, with optional metrics
func (*AnalysisResult) DeepCopy ¶
func (in *AnalysisResult) DeepCopy() *AnalysisResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnalysisResult.
func (*AnalysisResult) DeepCopyInto ¶
func (in *AnalysisResult) DeepCopyInto(out *AnalysisResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (AnalysisResult) GetObjectWithValues ¶
func (AnalysisResult) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *AnalysisResult)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
func (AnalysisResult) IsEmpty ¶
func (a AnalysisResult) IsEmpty() bool
IsEmpty returns true if the struct is empty
type AutomatedTestResult ¶
type AutomatedTestResult struct { // Total test cases number Total int `json:"total"` // Passed test cases number // +optional Passed int `json:"passed"` // Failed test cases number // +optional Failed int `json:"failed"` // Error test case number // +optional Error int `json:"error"` // Skipped test cases number // +optional Skipped int `json:"skipped"` // PassedTestsRate rate of passed tests // calculated using passed / (passed + failed + error) * 100 // +optional PassedTestsRate float64 `json:"passedTestsRate,omitempty"` }
AutomatedTestResult automatic test result encapsulation
func (*AutomatedTestResult) DeepCopy ¶
func (in *AutomatedTestResult) DeepCopy() *AutomatedTestResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutomatedTestResult.
func (*AutomatedTestResult) DeepCopyInto ¶
func (in *AutomatedTestResult) DeepCopyInto(out *AutomatedTestResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CodeChangeMetrics ¶
type CodeChangeMetrics struct { // CoverageRate by tests during code analysis // +optional CoverageRate CodeChangeRates `json:"coverage"` // DuplicationRate discovered during code analysis // +optional DuplicationRate CodeChangeRates `json:"duplications"` }
CodeChangeMetrics common metrics for code such as: CoverageRate: test coverage rate based on automated tests DuplicationRate: code duplication rate detected by code analysis tool
func (*CodeChangeMetrics) DeepCopy ¶
func (in *CodeChangeMetrics) DeepCopy() *CodeChangeMetrics
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodeChangeMetrics.
func (*CodeChangeMetrics) DeepCopyInto ¶
func (in *CodeChangeMetrics) DeepCopyInto(out *CodeChangeMetrics)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (CodeChangeMetrics) GetObjectWithValues ¶
func (CodeChangeMetrics) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *CodeChangeMetrics)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
type CodeChangeRates ¶
type CodeChangeRates struct { // New code rate // calculated for new code only // +optional New string `json:"new"` // Total code rate // measured over existing code Total string `json:"total"` }
CodeChangeRates stores changes in a specific rate for new and already existing code used as code duplications, test coverage, etc.
func (*CodeChangeRates) DeepCopy ¶
func (in *CodeChangeRates) DeepCopy() *CodeChangeRates
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodeChangeRates.
func (*CodeChangeRates) DeepCopyInto ¶
func (in *CodeChangeRates) DeepCopyInto(out *CodeChangeRates)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (CodeChangeRates) GetObjectWithValues ¶
func (CodeChangeRates) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *CodeChangeRates)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
type CodeLintIssues ¶
type CodeLintIssues struct { // Count the number of detected issues Count int `json:"count"` }
CodeLintIssues issues found during linting count stores the total number of issues detected
func (*CodeLintIssues) DeepCopy ¶
func (in *CodeLintIssues) DeepCopy() *CodeLintIssues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodeLintIssues.
func (*CodeLintIssues) DeepCopyInto ¶
func (in *CodeLintIssues) DeepCopyInto(out *CodeLintIssues)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (CodeLintIssues) GetObjectWithValues ¶
func (CodeLintIssues) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *CodeLintIssues)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
type CodeLintResult ¶
type CodeLintResult struct { // Result for the linting process // - Succeeded: successful code linting with passing quality gates // - Failed: failed code linting // - Canceled: canceled code linting due to canceled task Result string `json:"result"` // Issues found during linting process // +optional Issues *CodeLintIssues `json:"issues,omitempty"` }
CodeLintResult stores code linting results
func (*CodeLintResult) DeepCopy ¶
func (in *CodeLintResult) DeepCopy() *CodeLintResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodeLintResult.
func (*CodeLintResult) DeepCopyInto ¶
func (in *CodeLintResult) DeepCopyInto(out *CodeLintResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (CodeLintResult) GetObjectWithValues ¶
func (CodeLintResult) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *CodeLintResult)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
func (CodeLintResult) IsEmpty ¶
func (a CodeLintResult) IsEmpty() bool
IsEmpty returns true if the struct is empty
type CodeSize ¶
type CodeSize struct { // LinesOfCode inside the project LinesOfCode int `json:"linesOfCode"` }
CodeSize metrics of code base
func (*CodeSize) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CodeSize.
func (*CodeSize) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NamedAnalysisResult ¶
type NamedAnalysisResult struct { // Name of a specific analsysis result Name string `json:"name,omitempty"` AnalysisResult `json:",inline"` }
NamedAnalysisResult adds name over integrated AnalysisResult
func (*NamedAnalysisResult) DeepCopy ¶
func (in *NamedAnalysisResult) DeepCopy() *NamedAnalysisResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedAnalysisResult.
func (*NamedAnalysisResult) DeepCopyInto ¶
func (in *NamedAnalysisResult) DeepCopyInto(out *NamedAnalysisResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (NamedAnalysisResult) IsSameResult ¶
func (n NamedAnalysisResult) IsSameResult(y NamedAnalysisResult) bool
IsSameResult implements method for generic comparable usage and checking if lists have the same results
type NamedAnalysisResults ¶
type NamedAnalysisResults []NamedAnalysisResult
NamedAnalysisResults list of NamedAnalysisResult
func (NamedAnalysisResults) DeepCopy ¶
func (in NamedAnalysisResults) DeepCopy() NamedAnalysisResults
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedAnalysisResults.
func (NamedAnalysisResults) DeepCopyInto ¶
func (in NamedAnalysisResults) DeepCopyInto(out *NamedAnalysisResults)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NamedAutomatedTestResults ¶
type NamedAutomatedTestResults struct { // Name of a specific unit tests result Name string `json:"name,omitempty"` AutomatedTestResult `json:",inline"` }
NamedAutomatedTestResults adds name over integrated UnitTestsResult
func (*NamedAutomatedTestResults) DeepCopy ¶
func (in *NamedAutomatedTestResults) DeepCopy() *NamedAutomatedTestResults
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedAutomatedTestResults.
func (*NamedAutomatedTestResults) DeepCopyInto ¶
func (in *NamedAutomatedTestResults) DeepCopyInto(out *NamedAutomatedTestResults)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (NamedAutomatedTestResults) IsSameResult ¶
func (n NamedAutomatedTestResults) IsSameResult(y NamedAutomatedTestResults) bool
IsSameResult implements method for generic comparable usage and checking if lists have the same results
type NamedCodeLintResult ¶
type NamedCodeLintResult struct { // Name of a specific lint result Name string `json:"name,omitempty"` CodeLintResult `json:",inline"` }
NamedCodeLintResult adds name over integrated CodeLintResult
func (*NamedCodeLintResult) DeepCopy ¶
func (in *NamedCodeLintResult) DeepCopy() *NamedCodeLintResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedCodeLintResult.
func (*NamedCodeLintResult) DeepCopyInto ¶
func (in *NamedCodeLintResult) DeepCopyInto(out *NamedCodeLintResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (NamedCodeLintResult) IsSameResult ¶
func (n NamedCodeLintResult) IsSameResult(y NamedCodeLintResult) bool
IsSameResult implements method for generic comparable usage and checking if lists have the same results
type NamedCodeLintResults ¶
type NamedCodeLintResults []NamedCodeLintResult
NamedCodeLintResults list of NamedCodeLintResult
func (NamedCodeLintResults) DeepCopy ¶
func (in NamedCodeLintResults) DeepCopy() NamedCodeLintResults
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedCodeLintResults.
func (NamedCodeLintResults) DeepCopyInto ¶
func (in NamedCodeLintResults) DeepCopyInto(out *NamedCodeLintResults)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NamedUnitTestsResult ¶
type NamedUnitTestsResult struct { // Name of a specific unit tests result Name string `json:"name,omitempty"` UnitTestsResult `json:",inline"` }
NamedUnitTestsResult adds name over integrated UnitTestsResult
func (*NamedUnitTestsResult) DeepCopy ¶
func (in *NamedUnitTestsResult) DeepCopy() *NamedUnitTestsResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedUnitTestsResult.
func (*NamedUnitTestsResult) DeepCopyInto ¶
func (in *NamedUnitTestsResult) DeepCopyInto(out *NamedUnitTestsResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (NamedUnitTestsResult) IsSameResult ¶
func (n NamedUnitTestsResult) IsSameResult(y NamedUnitTestsResult) bool
IsSameResult implements method for generic comparable usage and checking if lists have the same results
type NamedUnitTestsResults ¶
type NamedUnitTestsResults []NamedUnitTestsResult
NamedUnitTestsResults list of NamedUnitTestsResult
func (NamedUnitTestsResults) DeepCopy ¶
func (in NamedUnitTestsResults) DeepCopy() NamedUnitTestsResults
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedUnitTestsResults.
func (NamedUnitTestsResults) DeepCopyInto ¶
func (in NamedUnitTestsResults) DeepCopyInto(out *NamedUnitTestsResults)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ReportFile ¶
type ReportFile struct { // ContentType for content type ContentType string `json:"contentType"` // Key for file key returned from katanomi-data server Key string `json:"key"` }
ReportFile refers to a report object, could be a directory or a file depending on contentType
func (*ReportFile) DeepCopy ¶
func (in *ReportFile) DeepCopy() *ReportFile
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReportFile.
func (*ReportFile) DeepCopyInto ¶
func (in *ReportFile) DeepCopyInto(out *ReportFile)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TestCoverage ¶
type TestCoverage struct { // Lines represent unit test coverage on lines Lines string `json:"lines,omitempty"` // Branches stores code branch coverage rate // valid value range is 0 to 100 Branches string `json:"branches,omitempty"` }
TestCoverage stores coverage data for unit tests
func (*TestCoverage) DeepCopy ¶
func (in *TestCoverage) DeepCopy() *TestCoverage
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestCoverage.
func (*TestCoverage) DeepCopyInto ¶
func (in *TestCoverage) DeepCopyInto(out *TestCoverage)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (TestCoverage) GetObjectWithValues ¶
func (TestCoverage) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *TestCoverage)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
func (*TestCoverage) IsEmpty ¶
func (c *TestCoverage) IsEmpty() bool
IsEmpty returns true if the struct is empty
type TestResult ¶
type TestResult struct { // Passed test cases number // +optional Passed int `json:"passed"` // Skipped test cases number // +optional Skipped int `json:"skipped"` // Failed test cases number // adds on any errored test cases // +optional Failed int `json:"failed"` // PassedTestsRate rate of passed tests // calculated using passed / (passed + failed) * 100 // +optional PassedTestsRate string `json:"passedTestsRate"` // ReportFiles are collection of report file object from storage plugin // +optional ReportFiles []ReportFile `json:"reportFiles"` }
TestResult test results aggregation stores the number of passed, skipped and failed test cases also stores a calculated passed tests rate value
func (*TestResult) DeepCopy ¶
func (in *TestResult) DeepCopy() *TestResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestResult.
func (*TestResult) DeepCopyInto ¶
func (in *TestResult) DeepCopyInto(out *TestResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (TestResult) GetObjectWithValues ¶
func (TestResult) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *TestResult)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
func (*TestResult) IsEmpty ¶
func (t *TestResult) IsEmpty() bool
IsEmpty returns true if the struct is empty
type UnitTestsResult ¶
type UnitTestsResult struct { // Type identifies the type of 'unitedTest' related results reusing UnitTestsResult. // +optional Type string `json:"type,omitempty"` // Coverage represent unit test coverage of current build Coverage *TestCoverage `json:"coverage"` // TestResults stores a summary with the number of // test cases that passed, where skipped or failed. // +optional TestResult *TestResult `json:"testResults,omitempty"` }
UnitTestsResult unit tests results encapsulating coverage and number of passed, failed and skipped tests
func (*UnitTestsResult) DeepCopy ¶
func (in *UnitTestsResult) DeepCopy() *UnitTestsResult
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnitTestsResult.
func (*UnitTestsResult) DeepCopyInto ¶
func (in *UnitTestsResult) DeepCopyInto(out *UnitTestsResult)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (UnitTestsResult) GetObjectWithValues ¶
func (UnitTestsResult) GetObjectWithValues(ctx context.Context, path *field.Path, values map[string]string) (result *UnitTestsResult)
GetObjectWithValues inits an object based on a json.path values map returns nil if values is nil
func (UnitTestsResult) IsEmpty ¶
func (u UnitTestsResult) IsEmpty() bool
IsEmpty returns true if the struct is empty