From 9781bfbe18671a3529340150d12c3eb6c5e20c67 Mon Sep 17 00:00:00 2001 From: Alex Savchuk Date: Sat, 17 Sep 2022 19:45:47 +0300 Subject: [PATCH] fix all linter issues --- .mega-linter.yml | 2 +- IMAGES.md | 8 ++++---- README.md | 8 ++++---- pkg/common/git/git.go | 3 ++- pkg/container/docker_cli.go | 2 +- pkg/container/file_collector.go | 2 +- pkg/exprparser/interpreter.go | 2 +- pkg/model/planner.go | 3 ++- pkg/model/workflow.go | 3 ++- pkg/runner/action.go | 3 ++- pkg/runner/runner.go | 1 + 11 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.mega-linter.yml b/.mega-linter.yml index d1d492dd931..39328b923ed 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -12,7 +12,7 @@ DISABLE_LINTERS: - YAML_YAMLLINT - MARKDOWN_MARKDOWN_TABLE_FORMATTER - MARKDOWN_MARKDOWN_LINK_CHECK -FILTER_REGEX_EXCLUDE: (.*testdata/*|install.sh) +FILTER_REGEX_EXCLUDE: (.*testdata/*|install.sh|pkg/container/docker_cli.go) MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdownlint.yml PARALLEL: false PRINT_ALPACA: false diff --git a/IMAGES.md b/IMAGES.md index a6862f0f5a5..7274ce2d737 100644 --- a/IMAGES.md +++ b/IMAGES.md @@ -17,8 +17,8 @@ **Note: `catthehacker/ubuntu` images are based on Ubuntu root filesystem** -| Image | GitHub Repository | -| -------------------------------------------------------------------- | ------------------------------------------------------------- | +| Image | GitHub Repository | +| ------------------------------------------------------------ | ------------------------------------------------------------- | | [`catthehacker/ubuntu:act-latest`][ghcr/catthehacker/ubuntu] | [`catthehacker/docker-images`][gh/catthehacker/docker_images] | | [`catthehacker/ubuntu:act-22.04`][ghcr/catthehacker/ubuntu] | [`catthehacker/docker-images`][gh/catthehacker/docker_images] | | [`catthehacker/ubuntu:act-20.04`][ghcr/catthehacker/ubuntu] | [`catthehacker/docker-images`][gh/catthehacker/docker_images] | @@ -34,8 +34,8 @@ | [`nektos/act-environments-ubuntu:18.04-lite`][hub/nektos/act-environments-ubuntu] | ![`nektos:18.04-lite`][hub/nektos/act-environments-ubuntu/18.04-lite/size] | [`nektos/act-environments`][gh/nektos/act-environments] | | [`nektos/act-environments-ubuntu:18.04-full`][hub/nektos/act-environments-ubuntu] | ![`nektos:18.04-full`][hub/nektos/act-environments-ubuntu/18.04-full/size] | [`nektos/act-environments`][gh/nektos/act-environments] | -| Image | GitHub Repository | -| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| Image | GitHub Repository | +| ------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | [`catthehacker/ubuntu:full-latest`][ghcr/catthehacker/ubuntu] | [`catthehacker/virtual-environments-fork`][gh/catthehacker/virtual-environments-fork] | | [`catthehacker/ubuntu:full-20.04`][ghcr/catthehacker/ubuntu] | [`catthehacker/virtual-environments-fork`][gh/catthehacker/virtual-environments-fork] | | [`catthehacker/ubuntu:full-18.04`][ghcr/catthehacker/ubuntu] | [`catthehacker/virtual-environments-fork`][gh/catthehacker/virtual-environments-fork] | diff --git a/README.md b/README.md index 64487953031..56d7fe6ac22 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ act -s GITHUB_TOKEN=[insert token or leave blank for secure input] ## Services -Services are not currently supported but are being worked on. See: https://github.com/nektos/act/issues/173 +Services are not currently supported but are being worked on. See: [#173](https://github.com/nektos/act/issues/173) ## `MODULE_NOT_FOUND` @@ -252,10 +252,10 @@ export DOCKER_HOST=$(docker context inspect --format '{{.Endpoints.docker.Host}} GitHub Actions offers managed [virtual environments](https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners) for running workflows. In order for `act` to run your workflows locally, it must run a container for the runner defined in your workflow file. Here are the images that `act` uses for each runner type and size: -| GitHub Runner | Micro Docker Image | Medium Docker Image | Large Docker Image | -| --------------- | -------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------- | +| GitHub Runner | Micro Docker Image | Medium Docker Image | Large Docker Image | +| --------------- | -------------------------------- | ------------------------------------------------- | -------------------------------------------------- | | `ubuntu-latest` | [`node:16-buster-slim`][micro] | [`catthehacker/ubuntu:act-latest`][docker_images] | [`catthehacker/ubuntu:full-latest`][docker_images] | -| `ubuntu-22.04` | [`node:16-bullseye-slim`][micro] | [`catthehacker/ubuntu:act-22.04`][docker_images] | `unavailable` | +| `ubuntu-22.04` | [`node:16-bullseye-slim`][micro] | [`catthehacker/ubuntu:act-22.04`][docker_images] | `unavailable` | | `ubuntu-20.04` | [`node:16-buster-slim`][micro] | [`catthehacker/ubuntu:act-20.04`][docker_images] | [`catthehacker/ubuntu:full-20.04`][docker_images] | | `ubuntu-18.04` | [`node:16-buster-slim`][micro] | [`catthehacker/ubuntu:act-18.04`][docker_images] | [`catthehacker/ubuntu:full-18.04`][docker_images] | diff --git a/pkg/common/git/git.go b/pkg/common/git/git.go index 38f8f7145ca..01c4b741e3e 100644 --- a/pkg/common/git/git.go +++ b/pkg/common/git/git.go @@ -318,7 +318,8 @@ func gitOptions(token string) (fetchOptions git.FetchOptions, pullOptions git.Pu } // NewGitCloneExecutor creates an executor to clone git repos -// nolint:gocyclo +// +//nolint:gocyclo func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor { return func(ctx context.Context) error { logger := common.Logger(ctx) diff --git a/pkg/container/docker_cli.go b/pkg/container/docker_cli.go index a1bfb338cbe..ca4edd96a78 100644 --- a/pkg/container/docker_cli.go +++ b/pkg/container/docker_cli.go @@ -1,4 +1,4 @@ -// nolint: unparam +//nolint:unparam,errcheck,depguard,deadcode,unused package container // exact copy of https://github.com/docker/cli/blob/9ac8584acfd501c3f4da0e845e3a40ed15c85041/cli/command/container/opts.go diff --git a/pkg/container/file_collector.go b/pkg/container/file_collector.go index e97cadaedc5..164bfe7ddaf 100644 --- a/pkg/container/file_collector.go +++ b/pkg/container/file_collector.go @@ -101,7 +101,7 @@ func (*defaultFs) Readlink(path string) (string, error) { return os.Readlink(path) } -// nolint: gocyclo +//nolint:gocyclo func (fc *fileCollector) collectFiles(ctx context.Context, submodulePath []string) filepath.WalkFunc { i, _ := fc.Fs.OpenGitIndex(path.Join(fc.SrcPath, path.Join(submodulePath...))) return func(file string, fi os.FileInfo, err error) error { diff --git a/pkg/exprparser/interpreter.go b/pkg/exprparser/interpreter.go index 6388b55cd53..7b76f3bb381 100644 --- a/pkg/exprparser/interpreter.go +++ b/pkg/exprparser/interpreter.go @@ -557,7 +557,7 @@ func (impl *interperterImpl) evaluateLogicalCompare(compareNode *actionlint.Logi return nil, fmt.Errorf("Unable to compare incompatibles types '%s' and '%s'", leftValue.Kind(), rightValue.Kind()) } -// nolint:gocyclo +//nolint:gocyclo func (impl *interperterImpl) evaluateFuncCall(funcCallNode *actionlint.FuncCallNode) (interface{}, error) { args := make([]reflect.Value, 0) diff --git a/pkg/model/planner.go b/pkg/model/planner.go index 16c89286daa..7cbb459bda8 100644 --- a/pkg/model/planner.go +++ b/pkg/model/planner.go @@ -55,7 +55,8 @@ type WorkflowFiles struct { } // NewWorkflowPlanner will load a specific workflow, all workflows from a directory or all workflows from a directory and its subdirectories -// nolint: gocyclo +// +//nolint:gocyclo func NewWorkflowPlanner(path string, noWorkflowRecurse bool) (WorkflowPlanner, error) { path, err := filepath.Abs(path) if err != nil { diff --git a/pkg/model/workflow.go b/pkg/model/workflow.go index 86ec67f6644..e7563e43572 100644 --- a/pkg/model/workflow.go +++ b/pkg/model/workflow.go @@ -215,7 +215,8 @@ func (j *Job) Matrix() map[string][]interface{} { // GetMatrixes returns the matrix cross product // It skips includes and hard fails excludes for non-existing keys -// nolint:gocyclo +// +//nolint:gocyclo func (j *Job) GetMatrixes() []map[string]interface{} { matrixes := make([]map[string]interface{}, 0) if j.Strategy != nil { diff --git a/pkg/runner/action.go b/pkg/runner/action.go index 85e18e0010c..912a9454a60 100644 --- a/pkg/runner/action.go +++ b/pkg/runner/action.go @@ -211,7 +211,8 @@ func removeGitIgnore(ctx context.Context, directory string) error { } // TODO: break out parts of function to reduce complexicity -// nolint:gocyclo +// +//nolint:gocyclo func execAsDocker(ctx context.Context, step actionStep, actionName string, basedir string, localAction bool) error { logger := common.Logger(ctx) rc := step.getRunContext() diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index aa66af7a252..869b59d1d7d 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -121,6 +121,7 @@ func New(runnerConfig *Config) (Runner, error) { } // NewPlanExecutor ... +// //nolint:gocyclo func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor { maxJobNameLen := 0