Skip to content

Commit f7337ed

Browse files
authored
Merge pull request #427 from netbox-community/AddEditorconfig
Introduce Linting-Step in Build
2 parents f33c647 + 4c8435e commit f7337ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1111
-1006
lines changed

.ecrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"Verbose": false,
3+
"Debug": false,
4+
"IgnoreDefaults": false,
5+
"SpacesAftertabs": false,
6+
"NoColor": false,
7+
"Exclude": [
8+
"LICENSE",
9+
"\\.initializers",
10+
"\\.vscode"
11+
],
12+
"AllowedContentTypes": [],
13+
"PassedFiles": [],
14+
"Disable": {
15+
// set these options to true to disable specific checks
16+
"EndOfLine": false,
17+
"Indentation": false,
18+
"InsertFinalNewline": false,
19+
"TrimTrailingWhitespace": false,
20+
"IndentSize": true,
21+
"MaxLineLength": false
22+
}
23+
}

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+
10+
[*.py]
11+
indent_size = 4

.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
max-line-length = 100
3+
extend-ignore = E203, W503
4+
per-file-ignores =
5+
configuration/*:E131,E251,E266,E302,E305,E501,E722
6+
startup_scripts/startup_script_utils/__init__.py:F401
7+
docker/*:E266,E722

.github/workflows/push.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@ on:
99
- release
1010

1111
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
name: Checks syntax of our code
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-python@v2
18+
- name: Lint Code Base
19+
uses: github/super-linter@v3
20+
env:
21+
DEFAULT_BRANCH: develop
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
SUPPRESS_POSSUM: true
24+
LINTER_RULES_PATH: /
25+
VALIDATE_ALL_CODEBASE: false
26+
VALIDATE_DOCKERFILE: false
27+
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
28+
29+
EDITORCONFIG_FILE_NAME: .ecrc
30+
DOCKERFILE_HADOLINT_FILE_NAME: .hadolint.yaml
31+
MARKDOWN_CONFIG_FILE: .markdown-lint.yml
32+
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
33+
PYTHON_FLAKE8_CONFIG_FILE: .flake8
34+
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
1235
build:
1336
continue-on-error: ${{ matrix.docker_from == 'alpine:edge' }}
1437
strategy:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ configuration/*
99
configuration/ldap/*
1010
!configuration/ldap/ldap_config.py
1111
prometheus.yml
12+
super-linter.log

.hadolint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ignored:
2+
- DL3006
3+
- DL3018

.markdown-lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MD013: false
2+
MD041: false

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ RUN apk add --no-cache \
1818
postgresql-dev \
1919
py3-pip \
2020
python3-dev \
21-
&& python3 -m venv /opt/netbox/venv \
22-
&& /opt/netbox/venv/bin/python3 -m pip install --upgrade \
21+
&& python3 -m venv /opt/netbox/venv \
22+
&& /opt/netbox/venv/bin/python3 -m pip install --upgrade \
2323
pip \
2424
setuptools \
2525
wheel

build-functions/docker-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ push_image_to_registry() {
55
echo "⏫ Pushing '${target_tag}'"
66
$DRY docker push "${target_tag}"
77
echo "✅ Finished pushing the Docker image '${target_tag}'."
8-
}
8+
}

build-functions/get-public-image-config.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ _get_image_configuration() {
4545
--silent \
4646
--location \
4747
--header "Authorization: Bearer $token" \
48-
"https://registry-1.docker.io/v2/$image/blobs/$digest" \
49-
| jq -r ".config.Labels.\"$label\""
48+
"https://registry-1.docker.io/v2/$image/blobs/$digest" |
49+
jq -r ".config.Labels.\"$label\""
5050
}
5151

5252
_get_token() {
5353
local image=$1
5454
curl \
5555
--silent \
56-
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" \
57-
| jq -r '.token'
56+
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" |
57+
jq -r '.token'
5858
}
5959

6060
_get_digest() {
@@ -65,8 +65,8 @@ _get_digest() {
6565
--silent \
6666
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
6767
--header "Authorization: Bearer $token" \
68-
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
69-
| jq -r '.config.digest'
68+
"https://registry-1.docker.io/v2/$image/manifests/$tag" |
69+
jq -r '.config.digest'
7070
}
7171

7272
_get_layers() {
@@ -77,6 +77,6 @@ _get_layers() {
7777
--silent \
7878
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
7979
--header "Authorization: Bearer $token" \
80-
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
81-
| jq -r '.layers[].digest'
80+
"https://registry-1.docker.io/v2/$image/manifests/$tag" |
81+
jq -r '.layers[].digest'
8282
}

0 commit comments

Comments
 (0)