Skip to content

Commit 7a0f9ff

Browse files
Remove pycodestyle, add black, add numerous pre-commit checks.
1 parent 31c1f07 commit 7a0f9ff

30 files changed

+283
-4970
lines changed

.codacy.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
---
12
engines:
2-
coverage:
3-
enabled: true
4-
excluded_paths:
5-
- test/**
3+
coverage:
4+
enabled: true
5+
excluded_paths:
6+
- test/**

.github/workflows/codeql-analysis.yml

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
name: "CodeQL"
1+
---
2+
name: CodeQL
23

34
on:
45
push:
5-
branches: [master, ]
6+
branches: [master]
67
pull_request:
78
# The branches below must be a subset of the branches above
89
branches: [master]
910
schedule:
10-
- cron: '0 18 * * 3'
11+
- cron: 0 18 * * 3
1112

1213
jobs:
1314
analyse:
1415
name: Analyse
1516
runs-on: ubuntu-latest
1617

1718
steps:
18-
- name: Checkout repository
19-
uses: actions/checkout@v2
20-
with:
19+
- name: Checkout repository
20+
uses: actions/checkout@v2
21+
with:
2122
# We must fetch at least the immediate parents so that if this is
2223
# a pull request then we can checkout the head.
23-
fetch-depth: 2
24+
fetch-depth: 2
2425

2526
# If this run was triggered by a pull request event, then checkout
2627
# the head of the pull request instead of the merge commit.
27-
- run: git checkout HEAD^2
28-
if: ${{ github.event_name == 'pull_request' }}
28+
- run: git checkout HEAD^2
29+
if: ${{ github.event_name == 'pull_request' }}
2930

3031
# Initializes the CodeQL tools for scanning.
31-
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v1
32+
- name: Initialize CodeQL
33+
uses: github/codeql-action/init@v1
3334
# Override language selection by uncommenting this and choosing your languages
3435
# with:
3536
# languages: go, javascript, csharp, python, cpp, java
3637

3738
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
3839
# If this step fails, then you should remove it and run the build manually (see below)
39-
- name: Autobuild
40-
uses: github/codeql-action/autobuild@v1
40+
- name: Autobuild
41+
uses: github/codeql-action/autobuild@v1
4142

4243
# ℹ️ Command-line programs to run using the OS shell.
4344
# 📚 https://git.io/JvXDl
@@ -50,5 +51,5 @@ jobs:
5051
# make bootstrap
5152
# make release
5253

53-
- name: Perform CodeQL Analysis
54-
uses: github/codeql-action/analyze@v1
54+
- name: Perform CodeQL Analysis
55+
uses: github/codeql-action/analyze@v1

.github/workflows/pr_check.yml

-27
This file was deleted.

.github/workflows/publish.yml

+30-29
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
1+
---
12
name: Publish
23
on:
3-
release:
4-
types: [released]
4+
release:
5+
types: [released]
56

67
jobs:
7-
build-publish:
8-
name: Build and publish Python distributions
9-
runs-on: ubuntu-22.04
10-
steps:
11-
- uses: actions/checkout@master
12-
- name: Set up Python
13-
uses: actions/setup-python@v2
14-
with:
15-
python-version: 3.7
16-
- name: Install dependencies
17-
run: python -m pip install --upgrade pip build
18-
- name: Generate Lark Parser
19-
run: |
20-
pip install -r requirements.txt -e .
21-
python hcl2/parser.py
22-
- name: Build tarball
23-
run: python3 -m build
24-
- name: Publish to Test PyPI
25-
uses: pypa/gh-action-pypi-publish@master
26-
with:
27-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
28-
repository_url: https://test.pypi.org/legacy/
29-
skip_existing: true
30-
- name: Publish to PyPI
31-
uses: pypa/gh-action-pypi-publish@master
32-
with:
33-
password: ${{ secrets.PYPI_API_TOKEN }}
8+
build-publish:
9+
name: Build and publish Python distributions
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: Set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.7
17+
- name: Install dependencies
18+
run: python -m pip install --upgrade pip build
19+
- name: Generate Lark Parser
20+
run: |
21+
pip install -r requirements.txt -e .
22+
python hcl2/parser.py
23+
- name: Build tarball
24+
run: python3 -m build
25+
- name: Publish to Test PyPI
26+
uses: pypa/gh-action-pypi-publish@master
27+
with:
28+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
29+
repository_url: https://test.pypi.org/legacy/
30+
skip_existing: true
31+
- name: Publish to PyPI
32+
uses: pypa/gh-action-pypi-publish@master
33+
with:
34+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Test
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
10+
jobs:
11+
test:
12+
name: Check code against linter/unit tests
13+
runs-on: ubuntu-22.04
14+
strategy:
15+
matrix:
16+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
17+
steps:
18+
- uses: actions/checkout@master
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: python -m pip install --upgrade "tox>=4.0.9,<5" build
25+
- name: Build to generate the version file
26+
run: python3 -m build
27+
- name: Test with Tox
28+
run: tox

.pre-commit-config.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# See https://pre-commit.com for more information
3+
# See https://pre-commit.com/hooks.html for more hooks
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.3.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
- id: check-added-large-files
11+
- id: no-commit-to-branch # Prevent commits directly to master
12+
- repo: https://github.com/adrienverge/yamllint.git
13+
rev: v1.28.0
14+
hooks:
15+
- id: yamllint
16+
name: Lint YAML
17+
args: [--format, parsable, --strict]
18+
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
19+
rev: 0.2.2 # or specific tag
20+
hooks:
21+
- id: yamlfmt
22+
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '120']
23+
- repo: https://github.com/executablebooks/mdformat.git
24+
rev: 0.7.16
25+
hooks:
26+
- id: mdformat
27+
name: Format markdown
28+
- repo: https://github.com/psf/black
29+
rev: 22.8.0
30+
hooks:
31+
- id: black
32+
language_version: python3.8
33+
- repo: https://github.com/pre-commit/mirrors-mypy
34+
rev: v0.991 # Use the sha / tag you want to point at
35+
hooks:
36+
- id: mypy
37+
- repo: local
38+
hooks:
39+
- id: pylint
40+
name: pylint (Python Linting)
41+
entry: pylint
42+
language: system
43+
types: [python]
44+
files: ^({{ cookiecutter.pkg_name }}|test)/
45+
args: [--rcfile=pylintrc, --output-format=colorized, --score=no]

.remarkrc

-12
This file was deleted.

.yamllint.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# https://yamllint.readthedocs.io/en/stable/configuration.html#extending-the-default-configuration
3+
4+
extends: relaxed
5+
rules:
6+
line-length:
7+
max: 120
8+
hyphens: disable

0 commit comments

Comments
 (0)