Skip to content

Commit 10206ae

Browse files
committed
Fix megalinter lint errors
Signed-off-by: Andres Tobon <andrest2455@gmail.com>
1 parent d02b859 commit 10206ae

File tree

24 files changed

+198
-41
lines changed

24 files changed

+198
-41
lines changed

.github/workflows/project-api-build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
---
44
name: "Project API Build"
55

6-
on:
7-
- pull_request
6+
"on": [pull_request]
87

98
permissions:
109
contents: read

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
bin/
44
gen/
55
.env*
6+
7+
# Linter generated files
8+
megalinter-reports/
9+
revive.log

.gitleaks.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
title = "gitleaks config"
3+
4+
[extend]
5+
# useDefault will extend the base configuration with the default gitleaks config:
6+
# https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml
7+
useDefault = true
8+
9+
[allowlist]
10+
description = "Allowlisted files"
11+
paths = [
12+
'''.automation/test''',
13+
'''megalinter-reports''',
14+
'''.github/linters''',
15+
'''node_modules''',
16+
'''.mypy_cache''',
17+
'''./cmd/project-api/service_handler_test.go''',
18+
'''./cmd/project-api/service_endpoint_test.go''',
19+
'''(.*?)gitleaks\.toml$''',
20+
'''(?i)(.*?)(png|jpeg|jpg|gif|doc|docx|pdf|bin|xls|xlsx|pyc|zip)$''',
21+
'''(go.mod|go.sum)$''',
22+
'''(.*?)(swagger\.yml|swagger\.yaml)$''',
23+
'''(.*?)(serverless\.yml|serverless\.yaml)$''',
24+
]
25+
regexTarget = "match"
26+
regexes = [
27+
'''eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.iOeNU4dAFFeBwNj6qdhdvm-IvDQrTa6R22lQVJVuWJxorJfeQww5Nwsra0PjaOYhAMj9jNMO5YLmud8U7iQ5gJK2zYyepeSuXhfSi8yjFZfRiSkelqSkU19I-Ja8aQBDbqXf2SAWA8mHF8VS3F08rgEaLCyv98fLLH4vSvsJGf6ueZSLKDVXz24rZRXGWtYYk_OYYTVgR1cg0BLCsuCvqZvHleImJKiWmtS0-CymMO4MMjCy_FIl6I56NqLE9C87tUVpo1mT-kbg5cHDD8I7MjCW5Iii5dethB4Vid3mZ6emKjVYgXrtkOQ-JyGMh6fnQxEFN1ft33GX2eRHluK9eg''',
28+
]

.gitleaksignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
46d11606320853a027a623c203238656cda3d36e:service_test.go:jwt:571
2+
874abaf0c197e135ec27253c169f6b2deead5806:service_test.go:jwt:571

.mega-linter.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
---
4+
GITHUB_COMMENT_REPORTER: false
5+
DISABLE_LINTERS:
6+
# We are setting KUBERNETES_DIRECTORY to the helm chart so the
7+
# KUBERNETES_HELM linter can find the chart, but then this linter expects to
8+
# find raw Kubernetes manifests in this directory, which isn't the case.
9+
# If we added a PRE_ command with a `helm template` step, and further
10+
# restricted the included files for this linter, it *might* work.
11+
- KUBERNETES_KUBECONFORM
12+
# TBD how to use this from Megalinter with our setup.
13+
- KUBERNETES_KUBESCAPE
14+
# Repository-wide link checking returns mostly false positives (like internal
15+
# service URLs in templates).
16+
- SPELL_LYCHEE
17+
- SPELL_CSPELL
18+
# yamllint is sufficient for us.
19+
- YAML_PRETTIER
20+
DISABLE_ERRORS_LINTERS:
21+
# Include grammar checks only as warnings.
22+
- SPELL_PROSELINT
23+
- SPELL_VALE
24+
# This may be informative but doesn't need to break the build.
25+
- COPYPASTE_JSCPD
26+
# TBD! Need to work through these.
27+
- REPOSITORY_TRIVY
28+
- REPOSITORY_CHECKOV
29+
- REPOSITORY_DEVSKIM
30+
REPOSITORY_KICS_ARGUMENTS: >-
31+
scan --no-progress --exclude-severities "medium,low,info,trace"
32+
SPELL_CSPELL_ANALYZE_FILE_NAMES: false
33+
# Make sure Vale is setup to run with the styles it needs.
34+
SPELL_VALE_PRE_COMMANDS:
35+
- command: mkdir -p styles
36+
cwd: "workspace"
37+
- command: vale sync
38+
cwd: "workspace"
39+
40+
# Ignore YAML files with templating macros; these typically fail linting and/or
41+
# schema checking.
42+
FILTER_REGEX_EXCLUDE: '(templates/.*\.yml|templates/.*\.yaml)'
43+
KUBERNETES_DIRECTORY: charts/lfx-v2-project-service
44+
KUBERNETES_HELM_ARGUMENTS: charts/lfx-v2-project-service

.yamllint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ignore: |
66
.git
77
megalinter-reports
88
styles
9+
gen/
910
rules:
1011
line-length:
1112
max: 120

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# checkov:skip=CKV_DOCKER_7:No free access to Chainguard versioned labels.
55
# hadolint global ignore=DL3007
66

7-
FROM --platform=$BUILDPLATFORM cgr.dev/chainguard/go:latest AS builder
7+
FROM cgr.dev/chainguard/go:latest AS builder
88

99
# Expose port 8080 for the project service API.
1010
EXPOSE 8080

charts/lfx-v2-project-service/templates/deployment.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ spec:
1919
containers:
2020
- name: app
2121
image: linuxfoundation/lfx-v2-project-service:0.1.0
22-
imagePullPolicy: Never # todo: fix this
22+
securityContext:
23+
allowPrivilegeEscalation: false
24+
imagePullPolicy: Never # todo: fix this
2325
env:
2426
- name: NATS_URL
25-
value: "nats://nats.lfx.svc.cluster.local:4222"
27+
value: {{.Values.nats.url}}
2628
ports:
2729
- containerPort: 8080
2830
name: web
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Copyright The Linux Foundation and each contributor to LFX.
22
# SPDX-License-Identifier: MIT
33
---
4+
# nats is the configuration for the NATS server
45
nats:
6+
# url is the URL of the NATS server
57
url: nats://nats.lfx.svc.cluster.local:4222

cmd/project-api/design/project.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
// Copyright The Linux Foundation and each contributor to LFX.
22
// SPDX-License-Identifier: MIT
3+
4+
// Package design contains the DSL for the project service Goa API generation.
35
package design
46

57
import (
8+
//nolint:staticcheck // ST1001: the recommended way of using the goa GSL package is with the . import
69
. "goa.design/goa/v3/dsl"
710
)
811

12+
// JWTAuth is the DSL JWT security type for authentication.
913
var JWTAuth = JWTSecurity("jwt", func() {
1014
Description("Heimdall authorization")
1115
})

0 commit comments

Comments
 (0)