usecase

package
v0.0.0-...-fff90db Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProjectNotFound indicates that the requested project is not accessible.
	ErrProjectNotFound = errors.New("unable to retrieve requested Project")
	// ErrPreviousAnalysisFound indicates there is an existing previous analysis.
	ErrPreviousAnalysisFound = errors.New("existing previous analysis for project")
	// ErrUnableToBuildASTs indicates that an error occurred while trying to read or parse the source code files to
	// build the required Abstract Syntax Trees.
	ErrUnableToBuildASTs = errors.New("unable to create ASTs from input")
	// ErrUnableToMineASTs indicates that an error occurred while trying to create or apply the miners specified
	// during the import process.
	ErrUnableToMineASTs = errors.New("unable to apply one or more miners to the ASTs")
	// ErrUnableToCreateProcessors indicates that an error occurred while trying to create or apply the splitters or
	// expanders during the import process.
	ErrUnableToCreateProcessors = errors.New("unable to create splitting or expansion algorithms")
	// ErrUnableToSaveIdentifiers indicates that an error occurred while trying to save an already processed identifier.
	ErrUnableToSaveIdentifiers = errors.New("unable to save extracted and processed indentifiers")
	// ErrUnableToSaveAnalysis indicates that an error occurred while trying to store the results for an import process.
	ErrUnableToSaveAnalysis = errors.New("unable to save analysis results after completed processing")
	// ErrUnexpected indicates that an unexpected error ocurring while analyzing the project.
	ErrUnexpected = errors.New("unexpected error")
)
View Source
var (
	// ErrUnableToReadProject indicates that an error occurred while trying to read the entity.Project
	// from any repository.
	ErrUnableToReadProject = errors.New("Unable to check against existing projects")
	// ErrUnableToRetrieveMetadata indicates that an error occurred while trying to retrieve Metadata information
	// related to the imported project.
	ErrUnableToRetrieveMetadata = errors.New("Unable to retrieve project metadata")
	// ErrUnableToCloneSourceCode indicates that an error occurred while trying to retrieve or store the source code
	// related to the imported project.
	ErrUnableToCloneSourceCode = errors.New("Unable to access or clone the source code")
	// ErrUnableToSaveProject indicates that an error occurred while trying to save the imported entity.Project.
	ErrUnableToSaveProject = errors.New("Unable to store project changes")
)
View Source
var (
	// ErrPreviousInsightsFound indicates there are existing insights.
	ErrPreviousInsightsFound = errors.New("existing previous insights for the analysis")
	// ErrIdentifiersNotFound indicates that no identifiers were found to process.
	ErrIdentifiersNotFound = errors.New("no identifiers found for the project")
	// ErrUnableToReadIdentifiers indicates that the identifiers couldn't be retrieved.
	ErrUnableToReadIdentifiers = errors.New("unable to retrieve and read identifiers")
	// ErrUnableToGainInsights indicates that an error occurred while trying to store the insights.
	ErrUnableToGainInsights = errors.New("unable to gain insights from identifiers")
)
View Source
var ErrAnalysisNotFound = errors.New("analysis not found")

ErrAnalysisNotFound indicates there is no analysis to be processed on the usecase.

View Source
var (
	// ErrFileNotFound indicates the requested file was not found.
	ErrFileNotFound = errors.New("requested file not found")
)
View Source
var (
	// ErrInsightsNotFound indicates that no Insights were found.
	ErrInsightsNotFound = errors.New("no insights found")
)

Functions

This section is empty.

Types

type AnalyzeProjectUsecase

type AnalyzeProjectUsecase interface {
	// Process performs the splitting and expansion process on the source code belonging to the Project.
	Process(ctx context.Context, projecID uuid.UUID) (entity.AnalysisResults, error)
}

AnalyzeProjectUsecase defines the contract for the use case related to the analysis process of a project.

func NewAnalyzeProjectUsecase

NewAnalyzeProjectUsecase initializes a new AnalyzeProjectUsecase handler.

type CreateProjectUsecase

type CreateProjectUsecase interface {
	// Process retrieves a project from GitHub and imports it.
	Process(ctx context.Context, projectRef string) (entity.Project, error)
}

CreateProjectUsecase handles the creation and import or a Project.

func NewCreateProjectUsecase

NewCreateProjectUsecase initializes a new CreateProjectUsecase instance.

type DeleteAnalysisUsecase

type DeleteAnalysisUsecase interface {
	// Process handles the process to delete an existing Analysis, given its ID.
	Process(ctx context.Context, analysisID uuid.UUID) error
}

DeleteAnalysisUsecase defines the contract for the use case related to delete an existing analysis.

func NewDeleteAnalysisUsecase

NewDeleteAnalysisUsecase create initializes a DeleteAnalysisUsecase instance.

type DeleteInsightsUsecase

type DeleteInsightsUsecase interface {
	// Process handles the process to delete the Insights related to a given Analysis ID.
	Process(ctx context.Context, analsysisID uuid.UUID) error
}

DeleteInsightsUsecase defines the contract for the use case related to delete insights extracted from an existing analysis.

func NewDeleteInsightsUsecase

func NewDeleteInsightsUsecase(ir repository.InsightRepository) DeleteInsightsUsecase

NewDeleteInsightsUsecase create initializes a DeleteInsightsUsecase instance.

type DeleteProjectUsecase

type DeleteProjectUsecase interface {
	Process(ctx context.Context, projectID uuid.UUID) error
}

DeleteProjectUsecase defines the contract for the usecase related to delete a project.

func NewDeleteProjectUsecase

NewDeleteProjectUsecase initializes a new DeleteProjectUsecase instance.

type GainInsightsUsecase

type GainInsightsUsecase interface {
	Process(ctx context.Context, analysisID uuid.UUID) ([]entity.Insight, error)
}

GainInsightsUsecase defines the contract for the usecase to analyze results and gain insights from a previous analysis.

func NewGainInsightsUsecase

NewGainInsightsUsecase initializes a new GainInsightsUsecase instance.

type GetInsightsUsecase

type GetInsightsUsecase interface {
	// Process retrieves insights and their related information.
	Process(ctx context.Context, ID uuid.UUID) ([]entity.Insight, error)
}

GetInsightsUsecase handles the retrieval of Insights by its ID.

func NewGetInsightsUsecase

func NewGetInsightsUsecase(ir repository.InsightRepository) GetInsightsUsecase

NewGetInsightsUsecase initializes a new GetInsightsUsecase instance.

type GetProjectUsecase

type GetProjectUsecase interface {
	// Process retrieves a project and its related information.
	Process(ctx context.Context, ID uuid.UUID) (entity.Project, error)
}

GetProjectUsecase handles the retrieval of a Project by its ID.

func NewGetProjectUsecase

func NewGetProjectUsecase(pr repository.ProjectRepository) GetProjectUsecase

NewGetProjectUsecase initializes a new GetProjectUsecase instance.

type OriginalFileUsecase

type OriginalFileUsecase interface {
	Process(ctx context.Context, projectRef string, filename string) ([]byte, error)
}

OriginalFileUsecase defines the contract to retrieve a file with its original content.

func NewOriginalFileUsecase

NewOriginalFileUsecase initializes a new OriginalFileUsecase instance.

type RewrittenFileUsecase

type RewrittenFileUsecase interface {
	Process(ctx context.Context, projectRef string, filename string) ([]byte, error)
}

RewrittenFileUsecase defines the contract to retrieve a file with the new content, based on the identifiers analysis process.

func NewRewrittenFileUsecase

NewRewrittenFileUsecase initializes a new RewrittenFileUsecase instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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