diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 34c8672..027e96f 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -9,6 +9,18 @@ on: # yamllint disable-line rule:truthy types: ["checks_requested"] jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Install yamllint + run: sudo apt-get install -y yamllint aspell + - name: "Clone Repository" + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + - name: Run linters + run: make lint + build: runs-on: ubuntu-latest uses: ./.github/workflows/testdeps.yaml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..a17883f --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,32 @@ +--- +exclude-dirs: + - vendor + +linters-settings: + govet: + disable: + - shadow # default value recommended by golangci + - composites + gosec: + excludes: + - G101 + +linters: + enable: + - gosec + +run: + build-tags: + - integration + timeout: 5m + +issues: + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + max-issues-per-linter: 0 + + # Maximum count of issues with the same text. Set to 0 to disable. Default + # is 3. + max-same-issues: 0 + exclude-rules: + - path: ^(pkg|internal)/.*_test\.go$ + linters: ["gosec"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3a21019 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + args: + - --markdown-linebreak-ext=md + - id: end-of-file-fixer + - id: check-added-large-files + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + args: [--strict] + - repo: https://github.com/schuellerf/pre-commit-pyspelling + rev: 0.1.0 + hooks: + - id: pyspelling + args: ["--config", ".spellcheck.yml"] + - repo: https://github.com/golangci/golangci-lint + rev: v1.59.1 + hooks: + - id: golangci-lint + - repo: https://github.com/hhatto/autopep8 + rev: v2.3.0 + hooks: + - id: autopep8 + - repo: https://github.com/pycqa/pylint + rev: v3.2.6 + hooks: + - id: pylint + additional_dependencies: ["PyYAML", "types-PyYAML", "pytest"] + files: ^(?!test/|tools/) + - id: pylint + name: pylint test/ directory + additional_dependencies: ["PyYAML", "types-PyYAML", "pytest"] + args: ["--rcfile=test/.pylintrc"] + files: ^test/ + - id: pylint + name: pylint tools/ directory + additional_dependencies: ["PyYAML", "types-PyYAML", "pytest"] + args: ["--rcfile=tools/.pylintrc"] + files: ^tools/ diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..7615b86 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,2 @@ +[FORMAT] +max-line-length=120 diff --git a/.spellcheck-en-custom.txt b/.spellcheck-en-custom.txt new file mode 100644 index 0000000..257abbc --- /dev/null +++ b/.spellcheck-en-custom.txt @@ -0,0 +1,14 @@ +backend +bootc +bootmode +buildable +Changelog +cli +distro +github +globbing +https +json +osbuild +qcow +UEFI diff --git a/.spellcheck.yml b/.spellcheck.yml new file mode 100644 index 0000000..4a94ff4 --- /dev/null +++ b/.spellcheck.yml @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: Apache-2.0 + +matrix: + - name: markdown + aspell: + lang: en + d: en_US + camel-case: true + mode: markdown + sources: + - "**/*.md|!venv/**|!vendor/**" + dictionary: + wordlists: + - .spellcheck-en-custom.txt + pipeline: + - pyspelling.filters.context: + context_visible_first: true + escapes: '\\[\\`~]' + delimiters: + # Ignore multiline content between fences (fences can have 3 or more back ticks) + # ```language + # content + # ``` + - open: '^(?P *`{3,}).*$' + close: '^(?P=open)$' + # Ignore text between inline back ticks + - open: '(?P`+)' + close: '(?P=open)' diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..da1399b --- /dev/null +++ b/.yamllint @@ -0,0 +1,10 @@ +--- +extends: default + +rules: + document-start: disable + line-length: disable + +ignore: + - test/data/error/09-duplicated-key.yaml + - test/data/error/10-duplicated-key-no-otk.yaml diff --git a/Makefile b/Makefile index 86a2c1a..79a5a87 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,7 @@ help: @echo " srpm: Build the source RPM" @echo " scratch: Quick scratch build of RPM" @echo " clean: Remove all built binaries" + @echo " lint: Run all known linters" $(BUILDDIR)/: mkdir -p "$@" @@ -186,3 +187,5 @@ release_artifacts: $(RPM_TARBALL_VERSIONED) # Print the artifact path for Packit echo "release_artifacts/$(shell basename $<)" +lint: + pre-commit run --all diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..68859ad --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[pep8] +max-line-length = 120 diff --git a/test/.pylintrc b/test/.pylintrc new file mode 100644 index 0000000..91f0a25 --- /dev/null +++ b/test/.pylintrc @@ -0,0 +1,5 @@ +[MESSAGES CONTROL] +disable= + missing-module-docstring, + missing-function-docstring, + fixme diff --git a/tools/.pylintrc b/tools/.pylintrc new file mode 100644 index 0000000..c9c2aa9 --- /dev/null +++ b/tools/.pylintrc @@ -0,0 +1,4 @@ +[MESSAGES CONTROL] +disable= + missing-module-docstring, + missing-function-docstring