1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-06 17:40:58 +00:00

Add super-linter + fix lint issues (#650)

* 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>
This commit is contained in:
Ryan (hackercat) 2021-05-03 18:52:03 +02:00 committed by GitHub
parent eab73d227f
commit 69b692b962
19 changed files with 66 additions and 49 deletions

View file

@ -23,7 +23,6 @@ type Workflow struct {
// On events for the workflow
func (w *Workflow) On() []string {
switch w.RawOn.Kind {
case yaml.ScalarNode:
var val string
@ -109,7 +108,6 @@ func (j *Job) Container() *ContainerSpec {
// Needs list for Job
func (j *Job) Needs() []string {
switch j.RawNeeds.Kind {
case yaml.ScalarNode:
var val string
@ -131,7 +129,6 @@ func (j *Job) Needs() []string {
// RunsOn list for Job
func (j *Job) RunsOn() []string {
switch j.RawRunsOn.Kind {
case yaml.ScalarNode:
var val string
@ -183,7 +180,6 @@ func (j *Job) GetMatrixes() []map[string]interface{} {
log.Debugf("Adding include '%v'", include)
matrixes = append(matrixes, include)
}
} else {
matrixes = append(matrixes, make(map[string]interface{}))
}
@ -313,12 +309,12 @@ func (s *Step) Type() StepType {
}
func (s *Step) Validate() error {
if s.Type() != StepTypeRun {
return fmt.Errorf("(StepID: %s): Unexpected value 'uses'", s.String())
} else if s.Shell == "" {
return fmt.Errorf("(StepID: %s): Required property is missing: 'shell'", s.String())
}
return nil
if s.Type() != StepTypeRun {
return fmt.Errorf("(StepID: %s): Unexpected value 'uses'", s.String())
} else if s.Shell == "" {
return fmt.Errorf("(StepID: %s): Required property is missing: 'shell'", s.String())
}
return nil
}
// ReadWorkflow returns a list of jobs for a given workflow file reader