Documentation
¶
Index ¶
- Constants
- type ArchitectureType
- type BaseClassInfo
- type ConfidenceCalculator
- func (c *ConfidenceCalculator) Calculate(signalStrength float64, sampleSize int, consistency float64) float64
- func (c *ConfidenceCalculator) CalculateArchitectureConfidence(matchingFiles, totalFiles int, hasDistinctiveMarkers bool, ...) float64
- func (c *ConfidenceCalculator) CalculateFromCounts(matchCount, totalCount int) float64
- func (c *ConfidenceCalculator) CalculatePatternConfidence(occurrences int, sampleSize int, patternVariations int) float64
- func (c *ConfidenceCalculator) CombineConfidences(confidences ...float64) float64
- func (c *ConfidenceCalculator) CompareDetections(first, second float64) int
- func (c *ConfidenceCalculator) FormatPercentage(confidence float64) int
- func (c *ConfidenceCalculator) GetConfidenceLevel(confidence float64) string
- func (c *ConfidenceCalculator) IsHighConfidence(confidence float64) bool
- func (c *ConfidenceCalculator) IsTooLow(confidence float64) bool
- func (c *ConfidenceCalculator) MeetsThreshold(confidence float64) bool
- func (c *ConfidenceCalculator) NeedsUserConfirmation(confidence float64) bool
- func (c *ConfidenceCalculator) WeightedCombine(values []float64, weights []float64) float64
- type DTONamingStyle
- type DatabaseType
- type DetectionResult
- type Detector
- type DetectorOption
- type ExceptionInfo
- type ExceptionProfile
- type FeatureStyle
- type Field
- type JavaFile
- type JavaFileType
- type LombokProfile
- type MapperType
- type ProfileCache
- type ProjectProfile
- func (p *ProjectProfile) GetBaseEntityImport() string
- func (p *ProjectProfile) GetControllerPackage(resourceName string) string
- func (p *ProjectProfile) GetDTOPackage(resourceName string) string
- func (p *ProjectProfile) GetDTORequestSuffix() string
- func (p *ProjectProfile) GetDTOResponseSuffix() string
- func (p *ProjectProfile) GetEntityPackage(resourceName string) string
- func (p *ProjectProfile) GetIDImport() string
- func (p *ProjectProfile) GetMapperPackage(resourceName string) string
- func (p *ProjectProfile) GetRepositoryPackage(resourceName string) string
- func (p *ProjectProfile) GetResponseWrapperImport() string
- func (p *ProjectProfile) GetServicePackage(resourceName string) string
- func (p *ProjectProfile) IsFieldLocked(fieldName string) bool
- func (p *ProjectProfile) IsStale(maxAge time.Duration) bool
- func (p *ProjectProfile) IsValid() bool
- func (p *ProjectProfile) LockField(fieldName string)
- func (p *ProjectProfile) NeedsBaseEntityImport() bool
- func (p *ProjectProfile) NeedsResponseWrapperImport() bool
- func (p *ProjectProfile) UnlockField(fieldName string)
- type ScanResult
- type Scanner
- func (s *Scanner) GetFilesByAnnotation(files []*JavaFile, annotation string) []*JavaFile
- func (s *Scanner) GetFilesByType(files []*JavaFile, fileType JavaFileType) []*JavaFile
- func (s *Scanner) GetFilesExtending(files []*JavaFile, parentClass string) []*JavaFile
- func (s *Scanner) GetUniquePackages(files []*JavaFile) []string
- func (s *Scanner) GroupFilesByPackage(files []*JavaFile) map[string][]*JavaFile
- func (s *Scanner) Scan() (*ScanResult, error)
- type SwaggerStyle
- type TestProfile
- type ValidationStyle
- type WrapperInfo
Constants ¶
View Source
const ( CacheDir = ".haft" ProfileFile = "profile.json" ChecksumFile = "checksum" DefaultMaxAge = 24 * time.Hour )
View Source
const ( ConfidenceHigh = 0.85 ConfidenceThreshold = 0.70 ConfidenceMedium = 0.50 ConfidenceLow = 0.30 )
View Source
const ( WeightSignalStrength = 0.40 WeightSampleSize = 0.30 WeightConsistency = 0.30 )
View Source
const ( MinSampleSize = 3 OptimalSampleSize = 10 MaxSampleMultiplier = 1.0 )
View Source
const (
DefaultCacheMaxAge = 24 * time.Hour
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchitectureType ¶
type ArchitectureType string
const ( ArchLayered ArchitectureType = "layered" ArchFeature ArchitectureType = "feature" ArchHexagonal ArchitectureType = "hexagonal" ArchClean ArchitectureType = "clean" ArchModular ArchitectureType = "modular" ArchFlat ArchitectureType = "flat" ArchUnknown ArchitectureType = "unknown" )
func ParseArchitectureType ¶
func ParseArchitectureType(s string) ArchitectureType
func (ArchitectureType) IsValid ¶
func (dt ArchitectureType) IsValid() bool
func (ArchitectureType) String ¶
func (dt ArchitectureType) String() string
type BaseClassInfo ¶
type ConfidenceCalculator ¶
type ConfidenceCalculator struct{}
func NewConfidenceCalculator ¶
func NewConfidenceCalculator() *ConfidenceCalculator
func (*ConfidenceCalculator) Calculate ¶
func (c *ConfidenceCalculator) Calculate(signalStrength float64, sampleSize int, consistency float64) float64
func (*ConfidenceCalculator) CalculateArchitectureConfidence ¶
func (c *ConfidenceCalculator) CalculateArchitectureConfidence( matchingFiles, totalFiles int, hasDistinctiveMarkers bool, ambiguityScore float64, ) float64
func (*ConfidenceCalculator) CalculateFromCounts ¶
func (c *ConfidenceCalculator) CalculateFromCounts(matchCount, totalCount int) float64
func (*ConfidenceCalculator) CalculatePatternConfidence ¶
func (c *ConfidenceCalculator) CalculatePatternConfidence( occurrences int, sampleSize int, patternVariations int, ) float64
func (*ConfidenceCalculator) CombineConfidences ¶
func (c *ConfidenceCalculator) CombineConfidences(confidences ...float64) float64
func (*ConfidenceCalculator) CompareDetections ¶
func (c *ConfidenceCalculator) CompareDetections(first, second float64) int
func (*ConfidenceCalculator) FormatPercentage ¶
func (c *ConfidenceCalculator) FormatPercentage(confidence float64) int
func (*ConfidenceCalculator) GetConfidenceLevel ¶
func (c *ConfidenceCalculator) GetConfidenceLevel(confidence float64) string
func (*ConfidenceCalculator) IsHighConfidence ¶
func (c *ConfidenceCalculator) IsHighConfidence(confidence float64) bool
func (*ConfidenceCalculator) IsTooLow ¶
func (c *ConfidenceCalculator) IsTooLow(confidence float64) bool
func (*ConfidenceCalculator) MeetsThreshold ¶
func (c *ConfidenceCalculator) MeetsThreshold(confidence float64) bool
func (*ConfidenceCalculator) NeedsUserConfirmation ¶
func (c *ConfidenceCalculator) NeedsUserConfirmation(confidence float64) bool
func (*ConfidenceCalculator) WeightedCombine ¶
func (c *ConfidenceCalculator) WeightedCombine(values []float64, weights []float64) float64
type DTONamingStyle ¶
type DTONamingStyle string
const ( DTONamingRequestResponse DTONamingStyle = "request_response" DTONamingDTOUpper DTONamingStyle = "dto_upper" DTONamingDTOLower DTONamingStyle = "dto_lower" DTONamingUnknown DTONamingStyle = "unknown" )
func ParseDTONamingStyle ¶
func ParseDTONamingStyle(s string) DTONamingStyle
func (DTONamingStyle) String ¶
func (dt DTONamingStyle) String() string
type DatabaseType ¶
type DatabaseType string
const ( DatabaseJPA DatabaseType = "jpa" DatabaseCassandra DatabaseType = "cassandra" DatabaseMongo DatabaseType = "mongo" DatabaseR2DBC DatabaseType = "r2dbc" DatabaseMulti DatabaseType = "multi" DatabaseUnknown DatabaseType = "unknown" )
func ParseDatabaseType ¶
func ParseDatabaseType(s string) DatabaseType
func (DatabaseType) String ¶
func (dt DatabaseType) String() string
type DetectionResult ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
func NewDetector ¶
func NewDetector(projectDir string, opts ...DetectorOption) *Detector
func (*Detector) Detect ¶
func (d *Detector) Detect() (*ProjectProfile, error)
func (*Detector) GetConfidenceCalculator ¶
func (d *Detector) GetConfidenceCalculator() *ConfidenceCalculator
func (*Detector) GetScanner ¶
type DetectorOption ¶
type DetectorOption func(*Detector)
func WithCacheMaxAge ¶
func WithCacheMaxAge(maxAge time.Duration) DetectorOption
func WithFileSystem ¶
func WithFileSystem(fs afero.Fs) DetectorOption
type ExceptionInfo ¶
type ExceptionProfile ¶
type ExceptionProfile struct {
HasGlobalHandler bool `json:"has_global_handler"`
HandlerPackage string `json:"handler_package,omitempty"`
CustomExceptions []ExceptionInfo `json:"custom_exceptions,omitempty"`
}
type FeatureStyle ¶
type FeatureStyle string
const ( FeatureStyleFlat FeatureStyle = "flat" FeatureStyleNested FeatureStyle = "nested" )
type JavaFileType ¶
type JavaFileType string
const ( FileTypeController JavaFileType = "controller" FileTypeService JavaFileType = "service" FileTypeRepository JavaFileType = "repository" FileTypeEntity JavaFileType = "entity" FileTypeDTO JavaFileType = "dto" FileTypeMapper JavaFileType = "mapper" FileTypeException JavaFileType = "exception" FileTypeConfig JavaFileType = "config" FileTypeTest JavaFileType = "test" FileTypeUnknown JavaFileType = "unknown" )
type LombokProfile ¶
type LombokProfile struct {
Detected bool `json:"detected"`
UseData bool `json:"use_data"`
UseBuilder bool `json:"use_builder"`
UseAccessors bool `json:"use_accessors"`
UseSlf4j bool `json:"use_slf4j"`
UseRequiredArgs bool `json:"use_required_args"`
UseAllArgs bool `json:"use_all_args"`
UseNoArgs bool `json:"use_no_args"`
}
type MapperType ¶
type MapperType string
const ( MapperMapStruct MapperType = "mapstruct" MapperModelMapper MapperType = "modelmapper" MapperManual MapperType = "manual" MapperNone MapperType = "none" )
func ParseMapperType ¶
func ParseMapperType(s string) MapperType
func (MapperType) String ¶
func (mt MapperType) String() string
type ProfileCache ¶
type ProfileCache struct {
// contains filtered or unexported fields
}
func NewProfileCache ¶
func NewProfileCache(projectDir string) *ProfileCache
func NewProfileCacheWithFs ¶
func NewProfileCacheWithFs(fs afero.Fs, projectDir string) *ProfileCache
func (*ProfileCache) Clear ¶
func (c *ProfileCache) Clear() error
func (*ProfileCache) Exists ¶
func (c *ProfileCache) Exists() bool
func (*ProfileCache) IsValid ¶
func (c *ProfileCache) IsValid() bool
func (*ProfileCache) Load ¶
func (c *ProfileCache) Load() (*ProjectProfile, error)
func (*ProfileCache) Save ¶
func (c *ProfileCache) Save(profile *ProjectProfile) error
func (*ProfileCache) SetMaxAge ¶
func (c *ProfileCache) SetMaxAge(maxAge time.Duration)
type ProjectProfile ¶
type ProjectProfile struct {
DetectedAt time.Time `json:"detected_at"`
ProjectRoot string `json:"project_root"`
Architecture ArchitectureType `json:"architecture"`
ArchConfidence float64 `json:"arch_confidence"`
ArchLocked bool `json:"arch_locked"`
FeatureStyle FeatureStyle `json:"feature_style"`
BasePackage string `json:"base_package"`
SourceRoot string `json:"source_root"`
TestRoot string `json:"test_root"`
BaseEntity *BaseClassInfo `json:"base_entity,omitempty"`
BaseRepository *BaseClassInfo `json:"base_repository,omitempty"`
BaseService *BaseClassInfo `json:"base_service,omitempty"`
ResponseWrapper *WrapperInfo `json:"response_wrapper,omitempty"`
PageWrapper *WrapperInfo `json:"page_wrapper,omitempty"`
DTONaming DTONamingStyle `json:"dto_naming"`
DTONamingLocked bool `json:"dto_naming_locked"`
ControllerSuffix string `json:"controller_suffix"`
ServiceSuffix string `json:"service_suffix"`
IDType string `json:"id_type"`
IDAnnotation string `json:"id_annotation"`
IDLocked bool `json:"id_locked"`
Mapper MapperType `json:"mapper"`
MapperLocked bool `json:"mapper_locked"`
Exceptions ExceptionProfile `json:"exceptions"`
Lombok LombokProfile `json:"lombok"`
HasSwagger bool `json:"has_swagger"`
SwaggerStyle SwaggerStyle `json:"swagger_style"`
HasValidation bool `json:"has_validation"`
ValidationStyle ValidationStyle `json:"validation_style"`
Testing TestProfile `json:"testing"`
Database DatabaseType `json:"database"`
DatabaseLocked bool `json:"database_locked"`
FeatureModules []string `json:"feature_modules,omitempty"`
LockedFields []string `json:"locked_fields,omitempty"`
}
func NewDefaultProfile ¶
func NewDefaultProfile() *ProjectProfile
func NewEmptyProfile ¶
func NewEmptyProfile() *ProjectProfile
func (*ProjectProfile) GetBaseEntityImport ¶
func (p *ProjectProfile) GetBaseEntityImport() string
func (*ProjectProfile) GetControllerPackage ¶
func (p *ProjectProfile) GetControllerPackage(resourceName string) string
func (*ProjectProfile) GetDTOPackage ¶
func (p *ProjectProfile) GetDTOPackage(resourceName string) string
func (*ProjectProfile) GetDTORequestSuffix ¶
func (p *ProjectProfile) GetDTORequestSuffix() string
func (*ProjectProfile) GetDTOResponseSuffix ¶
func (p *ProjectProfile) GetDTOResponseSuffix() string
func (*ProjectProfile) GetEntityPackage ¶
func (p *ProjectProfile) GetEntityPackage(resourceName string) string
func (*ProjectProfile) GetIDImport ¶
func (p *ProjectProfile) GetIDImport() string
func (*ProjectProfile) GetMapperPackage ¶
func (p *ProjectProfile) GetMapperPackage(resourceName string) string
func (*ProjectProfile) GetRepositoryPackage ¶
func (p *ProjectProfile) GetRepositoryPackage(resourceName string) string
func (*ProjectProfile) GetResponseWrapperImport ¶
func (p *ProjectProfile) GetResponseWrapperImport() string
func (*ProjectProfile) GetServicePackage ¶
func (p *ProjectProfile) GetServicePackage(resourceName string) string
func (*ProjectProfile) IsFieldLocked ¶
func (p *ProjectProfile) IsFieldLocked(fieldName string) bool
func (*ProjectProfile) IsValid ¶
func (p *ProjectProfile) IsValid() bool
func (*ProjectProfile) LockField ¶
func (p *ProjectProfile) LockField(fieldName string)
func (*ProjectProfile) NeedsBaseEntityImport ¶
func (p *ProjectProfile) NeedsBaseEntityImport() bool
func (*ProjectProfile) NeedsResponseWrapperImport ¶
func (p *ProjectProfile) NeedsResponseWrapperImport() bool
func (*ProjectProfile) UnlockField ¶
func (p *ProjectProfile) UnlockField(fieldName string)
type ScanResult ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func (*Scanner) GetFilesByAnnotation ¶
func (*Scanner) GetFilesByType ¶
func (s *Scanner) GetFilesByType(files []*JavaFile, fileType JavaFileType) []*JavaFile
func (*Scanner) GetFilesExtending ¶
func (*Scanner) GetUniquePackages ¶
func (*Scanner) GroupFilesByPackage ¶
func (*Scanner) Scan ¶
func (s *Scanner) Scan() (*ScanResult, error)
type SwaggerStyle ¶
type SwaggerStyle string
const ( SwaggerOpenAPI3 SwaggerStyle = "openapi3" SwaggerV2 SwaggerStyle = "swagger2" SwaggerNone SwaggerStyle = "none" )
type TestProfile ¶
type ValidationStyle ¶
type ValidationStyle string
const ( ValidationJakarta ValidationStyle = "jakarta" ValidationJavax ValidationStyle = "javax" ValidationNone ValidationStyle = "none" )
Click to show internal directories.
Click to hide internal directories.