github.com/blaisereilly/goreporter@v0.0.0-20240129165232-a6e9a46234bd/engine/strategy_dependgraph.go (about)

     1  package engine
     2  
     3  import (
     4  	"github.com/360EntSecGroup-Skylar/goreporter/linters/depend"
     5  )
     6  
     7  type StrategyDependGraph struct {
     8  	Sync *Synchronizer `inject:""`
     9  }
    10  
    11  func (s *StrategyDependGraph) GetName() string {
    12  	return "DependGraph"
    13  }
    14  
    15  func (s *StrategyDependGraph) GetDescription() string {
    16  	return "The dependency graph for all packages in the project helps you optimize the project architecture."
    17  }
    18  
    19  func (s *StrategyDependGraph) GetWeight() float64 {
    20  	return 0.
    21  }
    22  
    23  // linterDependGraph is a function that builds the dependency graph of all packages in the
    24  // project helps you optimize the project architecture.It will extract from the linter need
    25  // to convert the data.The result will be saved in the r's attributes.
    26  func (s *StrategyDependGraph) Compute(parameters StrategyParameter) (summaries *Summaries) {
    27  	summaries = NewSummaries()
    28  
    29  	graph := depend.Depend(parameters.ProjectPath, parameters.ExceptPackages)
    30  	summaries.Summaries["graph"] = Summary{
    31  		Name:        s.GetName(),
    32  		Description: graph,
    33  	}
    34  
    35  	return
    36  }
    37  
    38  func (s *StrategyDependGraph) Percentage(summaries *Summaries) float64 {
    39  	return 0.
    40  }