Skip to content

Commit

Permalink
Add initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlind committed Oct 25, 2022
1 parent 2e25878 commit a7d6c43
Show file tree
Hide file tree
Showing 37 changed files with 1,450 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skips:
- B101 # assert_used
201 changes: 201 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
version: 2.1

orbs:
codecov: codecov/[email protected]
gh: circleci/[email protected]

workflows:
workflow:
jobs:
- checkout:
name: Checkout
context: Default
filters:
tags:
only: /^v\d+\.\d+\.\d+$/
- lint:
name: Lint and check spelling
context: Default
requires:
- Checkout
filters:
tags:
only: /^v\d+\.\d+\.\d+$/
- test:
name: Run tests
context: Default
requires:
- Checkout
filters:
tags:
only: /^v\d+\.\d+\.\d+$/
- build:
name: Build
context: Default
requires:
- Checkout
filters:
tags:
only: /^v\d+\.\d+\.\d+$/
- upload:
name: Upload
context: Default
requires:
- Lint and check spelling
- Run tests
- Build
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/

jobs:
checkout:
docker:
- image: cimg/python:3.10
steps:
- checkout
- persist_to_workspace:
root: .
paths:
- .

lint:
docker:
- image: cimg/python:3.10-node
steps:
- attach_workspace:
at: .
- run:
name: Install pdftotext and enchant
command: |
sudo apt update
sudo apt install build-essential libpoppler-cpp-dev pkg-config enchant-2
- run:
name: Install cSpell
command: sudo npm install cspell --global
- run:
name: Install markdownlint
command: sudo npm install markdownlint-cli2 --global
- run:
name: Install pyright
command: sudo npm install pyright --global
- run:
name: Upgrade pip
command: pip3 install --upgrade pip
- run:
name: Install package and dev extras
command: pip3 install ."[dev]"
- run:
name: Install Voight-Kampff
command: pip3 install voight-kampff
- run:
name: Markdownlint
command: vk markdownlint
- run:
name: Pyright
command: vk pyright
- run:
name: Pylint
command: vk pylint
- run:
name: Black
command: vk black
- run:
name: Pydocstyle
command: vk pydocstyle
- run:
name: Flake8
command: vk flake8
- run:
name: Bandit
command: vk bandit
- run:
name: isort
command: vk isort
- run:
name: cSpell
command: vk cspell
- run:
name: Pylint spelling
command: vk pylint-spelling

test:
docker:
- image: cimg/python:3.10
steps:
- attach_workspace:
at: .
- run:
name: Install pdftotext and enchant
command: |
sudo apt update
sudo apt install build-essential libpoppler-cpp-dev pkg-config enchant-2
- run:
name: Upgrade pip
command: pip3 install --upgrade pip
- run:
name: Install tox and coverage
command: pip3 install tox coverage
- run:
name: Test
command: tox
- store_test_results:
path: test-results
- store_artifacts:
path: test-results/html
- codecov/upload:
file: test-results/cov.xml

build:
docker:
- image: cimg/python:3.10
steps:
- attach_workspace:
at: .
- run:
name: Upgrade pip
command: pip3 install --upgrade pip
- run:
name: Install build
command: pip install build
- run:
name: Substitute version
command: |
PACKAGE_VERSION=$(sed 's/^v//' \<<< ${CIRCLE_TAG:-0.0.0})
sed -i "s/0.0.0/$PACKAGE_VERSION/" ./flake8_plus/version.py
- run:
name: Check version number
command: python setup.py verify
- run:
name: Build
command: |
python3 -m build
- persist_to_workspace:
root: .
paths:
- .

upload:
docker:
- image: cimg/python:3.10
steps:
- gh/setup
- attach_workspace:
at: .
- run:
name: Upgrade pip
command: pip3 install --upgrade pip
- run:
name: Install twine
command: pip install twine
- run:
name: Upload
command: |
twine upload dist/*
- run:
name: Create release
command: |
echo Creating release
gh release create ${CIRCLE_TAG} ./dist/*.gz --title ${CIRCLE_TAG} --notes "$(git log `git tag --sort=-committerdate | head -1`...`git tag --sort=-committerdate | head -2 | tail -1` --pretty=format:"%h - **%s**%n%n%b")"
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
branch = False

[report]
omit = flake8_plus/version.py
21 changes: 21 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[flake8]
max-line-length=88
ignore=
E203, # whitespace before ‘:’
W503, # line break before binary operator
ANN101, # missing type annotation for self in method
ANN102, # missing type annotation for cls in classmethod
E741, # allow variable names I, O and l (but I and O still prevented by pylint)
ANN401, # allow using the Any type hint
E501, # Similar to Pylint line-too-long but Pylint can ignore string literals
exclude=
.git,
__pycache__,
.tox,
.vscode,
.eggs,
build,
dist,
tests/case_files/**/*.py
# Allow methods without return to not specify return type
suppress-none-returning=True
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile = black
skip_gitignore = True
13 changes: 13 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"default": true,
"MD003": {
"style": "atx"
},
"no-hard-tabs": true,
"ol-prefix": {
"style": "ordered"
},
"MD013": {
"line_length": 88
}
}
11 changes: 11 additions & 0 deletions .pydocstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[pydocstyle]
convention=google
add-select=
D204, # 1 blank line required after class docstring
D213, # Multi-line docstring summary should start at the second line
D401 # First line should be in imperative mood
add-ignore=
D212, # Multi-line docstring summary should start at the first line
D301 # Use r""" if any backslashes in a docstring

match = .*\.py
Loading

0 comments on commit a7d6c43

Please sign in to comment.