Skip to content

Commit

Permalink
Switch from super-linter to MegaLinter
Browse files Browse the repository at this point in the history
Also remove lockfile.

Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
  • Loading branch information
emsearcy committed May 4, 2024
1 parent 89d1729 commit 111e5c9
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT
[flake8]
max-line-length = 180
extend-ignore = E203
2 changes: 1 addition & 1 deletion .github/workflows/license-header-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: License Header Check

'on': [pull_request]
"on": [pull_request]

permissions:
contents: read
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT

name: MegaLinter

"on":
pull_request: null

permissions:
contents: read

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest

permissions:
contents: read
statuses: write

steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

# MegaLinter
- name: MegaLinter
id: ml
# Use the Python flavor.
uses: oxsecurity/megalinter/python@v7
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 0 additions & 38 deletions .github/workflows/super-linter.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT

megalinter-reports
.ruff_cache/
__pycache__/

# Normally, committing lockfiles is a best practice. But 1) this is a local
# shell utility, run sporadically and 2) committing a lockfile means keeping it
# up to date every time there is a security issue. In this case, we're going to
Expand Down
2 changes: 2 additions & 0 deletions .license-header
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT
22 changes: 22 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT
---
DISABLE_LINTERS:
# A self-contained maintaince page is not expected to conform to best
# practices for web site.
- HTML_DJLINT
# Pylint doesn't handle our Pipenv dependencies, and is redundant with ruff.
- PYTHON_PYLINT
# Pyright doesn't handle our pipenv dependencies, plus we aren't using
# static typing.
- PYTHON_PYRIGHT
# Disable dependency security scanning.
- REPOSITORY_GRYPE
- REPOSITORY_TRIVY
- REPOSITORY_TRIVY_SBOM
# cspell is laughably bad at code/comments/etc.
- SPELL_CSPELL
# Link checking more likely to cause false positives than be useful for us.
- SPELL_LYCHEE
GITHUB_COMMENT_REPORTER: false
GITHUB_STATUS_REPORTER: true
9 changes: 9 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT

line-length = 180
target-version = "py310"

[lint]
select = ["E", "F", "W"]

13 changes: 13 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT
---
extends: default
ignore: |
.git
megalinter-reports
__pycache__
.ruff_cache
rules:
line-length:
max: 120
level: warning
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT

.PHONY: all clean test

all: requirements.txt

clean:
rm -Rf __pycache__ .ruff_cache megalinter-reports

lint:
#docker run --rm --platform linux/amd64 -v '$(CURDIR):/tmp/lint:rw' oxsecurity/megalinter-python:v7
docker run --rm --platform linux/amd64 -v '$(CURDIR):/tmp/lint:rw' oxsecurity/megalinter:v7

test:
@echo "No tests to run ... would you like to 'make lint'?"

requirements.txt: Pipfile.lock .license-header
cat .license-header > requirements.txt
# Because we are avoiding pinning dep versions, we also prune them from the
# generated requirements.txt file.
pipenv requirements --exclude-markers | sed 's/=.*$$//' >> requirements.txt

Pipfile.lock: Pipfile
pipenv lock
11 changes: 11 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT
-i https://pypi.org/simple
boto3
botocore
jmespath
python-dateutil
s3transfer
six
trieregex
urllib3

0 comments on commit 111e5c9

Please sign in to comment.