Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
#########################
#########################
## Golang Linter rules ##
#########################
#########################

# configure golangci-lint
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
run:
skip-files:
- zz_generated*
- suite_test.go
timeout: 3m

issues:
exclude-rules:
- path: _test\.go
linters:
- dupl
- gosec
- goconst

linters:
disable:
- typecheck
enable:
- nilerr
- whitespace
- gofmt
- misspell

linters-settings:
errcheck:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
govet:
# report about shadowed variables
check-shadowing: false
gosimple:
checks: [ "-S1019" ]
14 changes: 14 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends: default

rules:
line-length: disable
truthy: disable
brackets: disable
trailing-spaces: disable
document-start: disable
indentation: disable
comments: disable
comments-indentation: disable
colons: disable
empty-lines: disable
new-line-at-end-of-file: disable
82 changes: 82 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
#################################
#################################
## Super Linter GitHub Actions ##
#################################
#################################
name: Lint Full Codebase

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on: [ push, pull_request ]

###############
# Set the Job #
###############
jobs:
golangci:
name: Go Linter
runs-on: ubuntu-18.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- name: Deps
run: |
sudo apt update
sudo apt install -y build-essential
sudo apt install -y libdevmapper-dev

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- uses: actions/checkout@v2

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.1
args: -c=".github/linters/.golangci.yml"
build:
# Name the Job
name: Super Linter (non-Go)
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

################################
# Run Linter against code base #
################################
- name: super-linter
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: true
VALIDATE_SHELL_SHFMT: true
VALIDATE_YAML: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion controllers/node_label_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ func SetupNodeLabelSyncTest(ctx context.Context, isStorageOS bool, createLabels

// getCSIAnnotation is a helper to return a valid StorageOS CSI Driver annotation.
func getCSIAnnotation() (string, string) {
driverMap, _ := json.Marshal(map[string]string{
driverMap, err := json.Marshal(map[string]string{
provisioner.DriverName: uuid.New().String(),
})
if err != nil {
println(err)
}
return provisioner.NodeDriverAnnotationKey, string(driverMap)
}

Expand Down
1 change: 1 addition & 0 deletions internal/controllers/sharedvolume/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
if err != nil {
// Non StorageOS shared volume, nothing to do.
r.log.Info("non StorageOS shared volume", "name", vol.Name)
//lint:ignore nilerr if non StorageOS nothing to do
return ctrl.Result{}, nil
}

Expand Down