Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
whonion committed Jun 21, 2023
1 parent 924364a commit 37347a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
name: Lint

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
lint:
lint-main:
strategy:
matrix:
platform: [ "ubuntu-latest" ]
platform: ["ubuntu-latest"]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Lint
run: make lint-go
- name: Checkout code
uses: actions/checkout@v2
- name: Lint main.go
run: make lint-go-main

lint-goroutine:
strategy:
matrix:
platform: ["ubuntu-latest"]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Lint go-routine.go
run: make lint-go-routine
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,28 @@ coverage-go-routine: ## Run coverage for go-routine.go
$(GOCMD) tool cover -func profile-go-routine.cov

## Lint:
lint: lint-go lint-dockerfile lint-yaml ## Run all available linters
Lint: lint-go lint-dockerfile lint-yaml ## Run all available lint

lint-dockerfile: ## Lint your Dockerfile
# If dockerfile is present we lint it.
# If the Dockerfile is present, we lint it.
ifeq ($(shell test -e ./Dockerfile && echo -n yes),yes)
$(eval CONFIG_OPTION = $(shell [ -e $(shell pwd)/.hadolint.yaml ] && echo "-v $(shell pwd)/.hadolint.yaml:/root/.config/hadolint.yaml" || echo "" ))
$(eval OUTPUT_OPTIONS = $(shell [ "${EXPORT_RESULT}" == "true" ] && echo "--format checkstyle" || echo "" ))
$(eval OUTPUT_FILE = $(shell [ "${EXPORT_RESULT}" == "true" ] && echo "| tee /dev/tty > checkstyle-report.xml" || echo "" ))
docker run --rm -i $(CONFIG_OPTION) hadolint/hadolint hadolint $(OUTPUT_OPTIONS) - < ./Dockerfile $(OUTPUT_FILE)
endif

lint-go: ## Use golintci-lint on your project
lint-go: ## Use golangci-lint in your project
$(eval OUTPUT_OPTIONS = $(shell [ "${EXPORT_RESULT}" == "true" ] && echo "--out-format checkstyle ./... | tee /dev/tty > checkstyle-report.xml" || echo "" ))
docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:latest-alpine golangci-lint run --deadline=65s $(OUTPUT_OPTIONS)

lint-yaml: ## Use yamllint on the yaml file of your projects
lint-yaml: ## Use yamllint in the yaml files of your projects
ifeq ($(EXPORT_RESULT), true)
GO111MODULE=off go get -u github.com/thomaspoignant/yamllint-checkstyle
$(eval OUTPUT_OPTIONS = | tee /dev/tty | yamllint-checkstyle > yamllint-checkstyle.xml)
endif
docker run --rm -it -v $(shell pwd):/data cytopia/yamllint -f parsable $(shell git ls-files '*.yml' '*.yaml') $(OUTPUT_OPTIONS)
docker run --rm -v $(shell pwd):/data cytopia/yamllint -f parsable $(shell git ls-files '*.yml' '*.yaml') $(OUTPUT_OPTIONS)


## Docker:
docker-build: ## Use the dockerfile to build the container
Expand Down

0 comments on commit 37347a7

Please sign in to comment.