refactor(php): rename analyse to stan
- Rename "analyse" check to "stan" (PHPStan is commonly called "stan") - Command: `core php stan` (with "analyse" alias for compatibility) - Update QA pipeline to use "stan" for check name - Update dependency chain: fmt → stan → psalm → test Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8c32539958
commit
9aaaa0ad26
6 changed files with 24 additions and 23 deletions
|
|
@ -15,7 +15,7 @@
|
|||
// Code Quality:
|
||||
// - test: Run PHPUnit/Pest tests
|
||||
// - fmt: Format code with Laravel Pint
|
||||
// - analyse: Run PHPStan/Larastan static analysis
|
||||
// - stan: Run PHPStan/Larastan static analysis
|
||||
// - psalm: Run Psalm static analysis
|
||||
// - audit: Security audit for dependencies
|
||||
// - security: Security vulnerability scanning
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ func AddPHPCommands(root *cobra.Command) {
|
|||
// Quality (existing)
|
||||
addPHPTestCommand(phpCmd)
|
||||
addPHPFmtCommand(phpCmd)
|
||||
addPHPAnalyseCommand(phpCmd)
|
||||
addPHPStanCommand(phpCmd)
|
||||
|
||||
// Quality (new)
|
||||
addPHPPsalmCommand(phpCmd)
|
||||
|
|
|
|||
|
|
@ -138,15 +138,16 @@ func addPHPFmtCommand(parent *cobra.Command) {
|
|||
}
|
||||
|
||||
var (
|
||||
analyseLevel int
|
||||
analyseMemory string
|
||||
stanLevel int
|
||||
stanMemory string
|
||||
)
|
||||
|
||||
func addPHPAnalyseCommand(parent *cobra.Command) {
|
||||
analyseCmd := &cobra.Command{
|
||||
Use: "analyse [paths...]",
|
||||
Short: i18n.T("cmd.php.analyse.short"),
|
||||
Long: i18n.T("cmd.php.analyse.long"),
|
||||
func addPHPStanCommand(parent *cobra.Command) {
|
||||
stanCmd := &cobra.Command{
|
||||
Use: "stan [paths...]",
|
||||
Aliases: []string{"analyse"},
|
||||
Short: i18n.T("cmd.php.analyse.short"),
|
||||
Long: i18n.T("cmd.php.analyse.long"),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
|
|
@ -169,8 +170,8 @@ func addPHPAnalyseCommand(parent *cobra.Command) {
|
|||
|
||||
opts := phppkg.AnalyseOptions{
|
||||
Dir: cwd,
|
||||
Level: analyseLevel,
|
||||
Memory: analyseMemory,
|
||||
Level: stanLevel,
|
||||
Memory: stanMemory,
|
||||
Output: os.Stdout,
|
||||
}
|
||||
|
||||
|
|
@ -188,10 +189,10 @@ func addPHPAnalyseCommand(parent *cobra.Command) {
|
|||
},
|
||||
}
|
||||
|
||||
analyseCmd.Flags().IntVar(&analyseLevel, "level", 0, i18n.T("cmd.php.analyse.flag.level"))
|
||||
analyseCmd.Flags().StringVar(&analyseMemory, "memory", "", i18n.T("cmd.php.analyse.flag.memory"))
|
||||
stanCmd.Flags().IntVar(&stanLevel, "level", 0, i18n.T("cmd.php.analyse.flag.level"))
|
||||
stanCmd.Flags().StringVar(&stanMemory, "memory", "", i18n.T("cmd.php.analyse.flag.memory"))
|
||||
|
||||
parent.AddCommand(analyseCmd)
|
||||
parent.AddCommand(stanCmd)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -588,7 +589,7 @@ func getQAFixCommand(checkName string, fixEnabled bool) string {
|
|||
return ""
|
||||
}
|
||||
return "core php fmt --fix"
|
||||
case "analyse":
|
||||
case "stan":
|
||||
return i18n.T("cmd.php.qa.fix_phpstan")
|
||||
case "psalm":
|
||||
return i18n.T("cmd.php.qa.fix_psalm")
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec {
|
|||
}
|
||||
return nil
|
||||
|
||||
case "analyse":
|
||||
case "stan":
|
||||
_, found := phppkg.DetectAnalyser(r.dir)
|
||||
if !found {
|
||||
return nil
|
||||
|
|
@ -113,7 +113,7 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec {
|
|||
cmd = vendorBin
|
||||
}
|
||||
return &process.RunSpec{
|
||||
Name: "analyse",
|
||||
Name: "stan",
|
||||
Command: cmd,
|
||||
Args: []string{"analyse", "--no-progress"},
|
||||
Dir: r.dir,
|
||||
|
|
@ -139,7 +139,7 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec {
|
|||
Command: cmd,
|
||||
Args: args,
|
||||
Dir: r.dir,
|
||||
After: []string{"analyse"},
|
||||
After: []string{"stan"},
|
||||
}
|
||||
|
||||
case "test":
|
||||
|
|
@ -156,8 +156,8 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Tests depend on analyse (or psalm if available)
|
||||
after := []string{"analyse"}
|
||||
// Tests depend on stan (or psalm if available)
|
||||
after := []string{"stan"}
|
||||
if _, found := phppkg.DetectPsalm(r.dir); found {
|
||||
after = []string{"psalm"}
|
||||
}
|
||||
|
|
@ -323,7 +323,7 @@ func (r QACheckRunResult) GetIssueMessage() string {
|
|||
return i18n.T("cmd.php.qa.issue_audit")
|
||||
case "fmt":
|
||||
return i18n.T("cmd.php.qa.issue_style")
|
||||
case "analyse":
|
||||
case "stan":
|
||||
return i18n.T("cmd.php.qa.issue_analysis")
|
||||
case "psalm":
|
||||
return i18n.T("cmd.php.qa.issue_types")
|
||||
|
|
|
|||
|
|
@ -705,7 +705,7 @@ func GetQAStages(opts QAOptions) []QAStage {
|
|||
func GetQAChecks(dir string, stage QAStage) []string {
|
||||
switch stage {
|
||||
case QAStageQuick:
|
||||
checks := []string{"audit", "fmt", "analyse"}
|
||||
checks := []string{"audit", "fmt", "stan"}
|
||||
return checks
|
||||
case QAStageStandard:
|
||||
checks := []string{}
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ func TestGetQAChecks_Good(t *testing.T) {
|
|||
checks := GetQAChecks(dir, QAStageQuick)
|
||||
assert.Contains(t, checks, "audit")
|
||||
assert.Contains(t, checks, "fmt")
|
||||
assert.Contains(t, checks, "analyse")
|
||||
assert.Contains(t, checks, "stan")
|
||||
})
|
||||
|
||||
t.Run("standard stage includes test", func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue