mirror of
https://github.com/nektos/act.git
synced 2024-09-11 12:35:25 +03:00
* feat: bump `golangci-lint`, add `super-linter`, replace outdated linter Bump `golangci-lint` version. Add `super-linter` to lint other languages. Go linter is disabled because it's currently broken: https://github.com/github/super-linter/pull/370 Replacing `scopelint` with `exportloopref`: "[runner] The linter 'scopelint' is deprecated (since v1.39.0) due to: The repository of the linter has been deprecated by the owner. Replaced by exportloopref." Fixed formatting in `.golangci.yml` Add addtional linters: `misspell`: purely style, detects typos in comments `whitespace`: detects leading and trailing whitespace `goimports`: it's gofmt + checks unused imports * fix: lint/fix `go` files * fix: lint with `standardjs` * fix: lint/fix with `markdownlint`, make template more verbose * feat: add lint stuff to makefile * fix: `UseGitIgnore` formatting * fix: lint/fix `README.md` Co-authored-by: Casey Lee <cplee@nektos.com>
39 lines
742 B
Go
39 lines
742 B
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/nektos/act/pkg/common"
|
|
"github.com/nektos/act/pkg/model"
|
|
)
|
|
|
|
func drawGraph(plan *model.Plan) error {
|
|
drawings := make([]*common.Drawing, 0)
|
|
|
|
jobPen := common.NewPen(common.StyleSingleLine, 96)
|
|
arrowPen := common.NewPen(common.StyleNoLine, 97)
|
|
for i, stage := range plan.Stages {
|
|
if i > 0 {
|
|
drawings = append(drawings, arrowPen.DrawArrow())
|
|
}
|
|
|
|
ids := make([]string, 0)
|
|
for _, r := range stage.Runs {
|
|
ids = append(ids, r.String())
|
|
}
|
|
drawings = append(drawings, jobPen.DrawBoxes(ids...))
|
|
}
|
|
|
|
maxWidth := 0
|
|
for _, d := range drawings {
|
|
if d.GetWidth() > maxWidth {
|
|
maxWidth = d.GetWidth()
|
|
}
|
|
}
|
|
|
|
for _, d := range drawings {
|
|
d.Draw(os.Stdout, maxWidth)
|
|
}
|
|
return nil
|
|
}
|