Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
quant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
quant
Commits
de0a56a4
Commit
de0a56a4
authored
1 year ago
by
Neil-Jocelyn Schark
Browse files
Options
Downloads
Patches
Plain Diff
add linting
parent
2ef269ff
No related branches found
No related tags found
3 merge requests
!11
Big boom integration
,
!10
Add linting
,
!6
Draft: Akms ckms api implementation
Pipeline
#180705
failed
1 year ago
Stage: build
Stage: code-quality
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+18
-6
18 additions, 6 deletions
.gitlab-ci.yml
.golangci.yml
+76
-0
76 additions, 0 deletions
.golangci.yml
Makefile
+19
-2
19 additions, 2 deletions
Makefile
with
113 additions
and
8 deletions
.gitlab-ci.yml
+
18
−
6
View file @
de0a56a4
stages
:
-
build
-
code-quality
variables
:
IMAGE_PATH
:
"
${CI_REGISTRY_IMAGE}"
...
...
@@ -21,14 +22,25 @@ variables:
build-ekms
:
script
:
-
IMAGE_NAME="$IMAGE_PATH/ekms"
-
TAG=$CI_COMMIT_REF_SLUG
-
docker buildx build --push -t "$IMAGE_NAME:$TAG" -f ekms/Dockerfile --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} .
-
IMAGE_NAME="$IMAGE_PATH/ekms"
-
TAG=$CI_COMMIT_REF_SLUG
-
docker buildx build --push -t "$IMAGE_NAME:$TAG" -f ekms/Dockerfile --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} .
<<
:
*build
build-quantumlayer
:
script
:
-
IMAGE_NAME="$IMAGE_PATH/quantumlayer"
-
TAG=$CI_COMMIT_REF_SLUG
-
docker buildx build --push -t "$IMAGE_NAME:$TAG" -f quantumlayer/Dockerfile --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} .
-
IMAGE_NAME="$IMAGE_PATH/quantumlayer"
-
TAG=$CI_COMMIT_REF_SLUG
-
docker buildx build --push -t "$IMAGE_NAME:$TAG" -f quantumlayer/Dockerfile --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} .
<<
:
*build
lint
:
stage
:
code-quality
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golangci/golangci-lint:v1.55.2-alpine
script
:
# writes golangci-lint output to gl-code-quality-report.json
-
apk add --update make jq
-
make ci-lint
needs
:
[]
This diff is collapsed.
Click to expand it.
.golangci.yml
0 → 100644
+
76
−
0
View file @
de0a56a4
variables
:
GOLANG_VERSION
:
"
1.21"
run
:
go
:
$GOLANG_VERSION
concurrency
:
8
timeout
:
20m
issues-exit-code
:
1
# directories to be ignored by linters
skip-dirs
:
-
.git/
-
ekms/model
-
ekms/models
-
artifacts/
skip-dirs-default
:
true
#skip-files:
# - http.go
modules-download-mode
:
readonly
# output settings -> code-climate for GitLab
output
:
format
:
code-climate
print-issued-lines
:
true
print-linter-name
:
true
uniq-by-line
:
true
path-prefix
:
"
"
issues
:
exclude-use-default
:
false
max-issues-per-linter
:
0
max-same-issues
:
0
linters
:
# enable the specific needed linters
# see here for full list: https://golangci-lint.run/usage/linters/
# linters to consider: gosimple, containedctx, contextcheck, depguard, errchkjson, exhaustive, exhaustruct, forbidigo,
# gochecknoinits, gocognit, goconst, gocritic, gofumpt, gomnd, gosec, importas, lll, nestif, nilerr, nlreturn, noctx, nolintlint,
# nosnakecase, paralleltest, prealloc, structcheck, testpackage, tparallel, unparam, wastedassign, wrapcheck, wsl
disable-all
:
true
enable
:
-
gofmt
-
goimports
-
gocyclo
-
govet
-
unused
-
staticcheck
-
typecheck
-
revive
-
whitespace
-
errcheck
-
ineffassign
-
bidichk
-
durationcheck
-
errorlint
-
exportloopref
-
grouper
-
makezero
-
misspell
-
nilnil
-
predeclared
-
godot
-
errname
# custom settings for linters
linters-settings
:
gocyclo
:
min-complexity
:
15
golint
:
min-confidence
:
0.8
errcheck
:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
# Such cases aren't reported by default.
# Default: false
check-type-assertions
:
true
revive
:
severity
:
warning
confidence
:
0.8
This diff is collapsed.
Click to expand it.
Makefile
+
19
−
2
View file @
de0a56a4
...
...
@@ -7,7 +7,9 @@ TOOLS_DIR:= build-tools
GOSDN_PRG
:=
$(
MAKEFILE_DIR
)$(
TOOLS_DIR
)
GOPATH
:=
$(
~/go
)
GOBIN
:=
$(
GOSDN_PRG
)
GOLANG_VERSION
:=
1.21
GOLANGCI_LINT_VERSION
=
v1.55.0
GOCMD
=
go
GOBUILD
=
$(
GOCMD
)
build
...
...
@@ -24,10 +26,18 @@ pre:
install-tools
:
@
echo
Install development tooling
mkdir
-p
$(
GOSDN_PRG
)
export
GOBIN
=
$(
GOSDN_PRG
)
&&
go
install
github.com/openconfig/ygot/generator@v0.28.3
&&
\
go
install
github.com/andresterba/go-ygot-generator-generator@v0.0.4
export
GOBIN
=
$(
GOSDN_PRG
)
&&
\
go
install
github.com/openconfig/ygot/generator@v0.28.3
&&
\
go
install
github.com/andresterba/go-ygot-generator-generator@v0.0.4
&&
\
go
install
github.com/golangci/golangci-lint/cmd/golangci-lint@
$(
GOLANGCI_LINT_VERSION
)
@
echo
Finished installing development tooling
lint
:
install-tools
./
$(
TOOLS_DIR
)
/golangci-lint run
--config
.golangci.yml | jq
lint-fix
:
install-tools
./
$(
TOOLS_DIR
)
/golangci-lint run
--config
.golangci.yml
--fix
| jq
build-ekms
:
pre
CGO_ENABLED
=
0
$(
GOBUILD
)
-o
$(
BUILD_ARTIFACTS_PATH
)
/ekms ./ekms/main.go
...
...
@@ -88,3 +98,10 @@ clean:
rm
-rf
$(
TOOLS_DIR
)
$(
GOCLEAN
)
docker system prune
-af
ci-install-tools
:
go
install
gotest.tools/gotestsum@
$(
GOTESTSUM_VERSION
)
ci-lint
:
ci-install-tools
golangci-lint run
--config
.golangci.yml
--out-format
code-climate
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment