Skip to content

Commit b8a5dbe

Browse files
Merge/tvsw (#33)
* Edit docs coverage badge * Add tests with branch coverage * Update readme * Add lint with flake8 * Fix bug where the exception sent as a message was not the one originally thrown * Add support for Imgur gallery images * Add mypy type checking * Add DbC * Add dev dependencies * Add github pages workflow * Add git-crypt to lint * Add pyreverse * Update failing test due to API error * Add icontract linting
1 parent 6db36b2 commit b8a5dbe

Some content is hidden

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

59 files changed

+1081
-1343
lines changed

.codeclimate.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ version: "2"
22
checks:
33
argument-count:
44
config:
5-
threshold: 5
5+
threshold: 7
66
method-complexity:
77
config:
8-
threshold: 7
8+
threshold: 15
99
plugins:
1010
duplication:
1111
enabled: true
@@ -20,17 +20,5 @@ plugins:
2020
config:
2121
threshold: "C"
2222
exclude_patterns:
23-
- "config/"
24-
- "db/"
25-
- "dist/"
26-
- "features/"
27-
- "**/node_modules/"
28-
- "script/"
29-
- "**/spec/"
30-
- "**/test/"
3123
- "**/tests/"
32-
- "Tests/"
33-
- "**/vendor/"
34-
- "**/*_test.go"
35-
- "**/*.d.ts"
3624
- "**/secret_*.py"

.github/workflows/docs.yml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,15 @@ jobs:
2626
uses: actions/cache@v1
2727
with:
2828
path: ~/.cache/pip # This path is specific to Ubuntu
29-
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements.txt') }}
30-
restore-keys: |
31-
${{ runner.os }}-pip-
32-
33-
- name: Cache CI dependencies
34-
uses: actions/cache@v1
35-
with:
36-
path: ~/.cache/pip # This path is specific to Ubuntu
37-
key: ${{ runner.os }}-pip-${{ hashFiles('./.github/workflows/requirements/docs.txt') }}
29+
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements/requirements.txt') }}-${{ hashFiles('**/docs.txt') }}-${{ hashFiles('**/test.txt') }}
3830
restore-keys: |
3931
${{ runner.os }}-pip-
4032
4133
- name: Install dependencies
4234
run: |
43-
pip install -r requirements.txt
44-
pip install -r ./.github/workflows/requirements/docs.txt
35+
pip install -r ./requirements/requirements.txt
36+
pip install -r ./requirements/docs.txt
37+
pip install -r ./requirements/test.txt
4538
4639
- name: Unlock git-crypt files
4740
uses: zemuldo/[email protected]
@@ -50,35 +43,37 @@ jobs:
5043
GPG_KEY_GRIP: ${{ secrets.GPG_KEY_GRIP }}
5144
GPG_KEY_PASS: ${{ secrets.GPG_KEY_PASS }}
5245

46+
- name: Generate project dependency graphs
47+
run: |
48+
pyreverse --ignore="tests" -o png -p telereddit telereddit
49+
mv classes_telereddit.png docs/images/classes_telereddit.png
50+
mv packages_telereddit.png docs/images/packages_telereddit.png
51+
5352
- name: Generate documentation
5453
run: |
5554
rm -rf docs/telereddit
5655
pdoc --html --output-dir="docs/" --template-dir="docs/templates" --config show_source_code=False --force .
5756
env:
5857
TELEREDDIT_MACHINE: GITHUB
5958

60-
- name: Run documentation coverage
59+
- name: Run docstr coverage
6160
run: |
6261
mkdir documentation-reports
63-
docstr-coverage telereddit --percentage-only --exclude=tests --skipinit 2>&1 | tee ./documentation-reports/docstr-coverage.txt
62+
docstr-coverage telereddit --verbose=3 --exclude=tests --skipinit 2>&1 | tee ./documentation-reports/docstr-coverage.txt
63+
64+
- name: Run pydocstyle
65+
run: |
6466
(pydocstyle telereddit 2>&1 | tee ./documentation-reports/pydocstyle-coverage.txt; exit ${PIPESTATUS[0]})
6567
6668
- name: Upload documentation reports as artifact
6769
uses: actions/upload-artifact@v2
6870
with:
6971
name: documentation-reports
70-
path: ./documentation-reports/
72+
path: ./documentation-reports/docstr-coverage.txt
7173

7274
- name: Commit changes
7375
uses: EndBug/add-and-commit@v4
7476
with:
7577
message: "Commit from Github Actions: docs workflow changes"
7678
env:
77-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
79-
- name: Deploy docs to Gtihub Pages
80-
uses: JamesIves/github-pages-deploy-action@releases/v3
81-
with:
82-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
83-
BRANCH: gh-pages
84-
FOLDER: docs/telereddit
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/github-pages.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: github-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@master
13+
14+
- name: Set up Python 3.8
15+
uses: actions/setup-python@v1
16+
with:
17+
python-version: 3.8
18+
19+
- name: Cache dependencies
20+
uses: actions/cache@v1
21+
with:
22+
path: ~/.cache/pip # This path is specific to Ubuntu
23+
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements/requirements.txt') }}-${{ hashFiles('**/docs.txt') }}-${{ hashFiles('**/test.txt') }}
24+
restore-keys: |
25+
${{ runner.os }}-pip-
26+
27+
- name: Install dependencies
28+
run: |
29+
pip install -r ./requirements/requirements.txt
30+
pip install -r ./requirements/docs.txt
31+
pip install -r ./requirements/test.txt
32+
33+
- name: Unlock git-crypt files
34+
uses: zemuldo/[email protected]
35+
env:
36+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
37+
GPG_KEY_GRIP: ${{ secrets.GPG_KEY_GRIP }}
38+
GPG_KEY_PASS: ${{ secrets.GPG_KEY_PASS }}
39+
40+
- name: Generate documentation
41+
run: |
42+
rm -rf docs/telereddit
43+
pdoc --html --output-dir="docs/" --template-dir="docs/templates" --config show_source_code=False --force .
44+
env:
45+
TELEREDDIT_MACHINE: GITHUB
46+
47+
- name: Deploy docs to Github Pages
48+
uses: JamesIves/github-pages-deploy-action@releases/v3
49+
with:
50+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
51+
BRANCH: gh-pages
52+
FOLDER: docs/telereddit

.github/workflows/lint.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,33 @@ jobs:
1818
with:
1919
python-version: 3.8
2020

21-
- name: Cache CI dependencies
21+
- name: Cache dependencies
2222
uses: actions/cache@v1
2323
with:
2424
path: ~/.cache/pip # This path is specific to Ubuntu
25-
key: ${{ runner.os }}-pip-${{ hashFiles('./.github/workflows/requirements/lint.txt') }}
25+
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements/lint.txt') }}
2626
restore-keys: |
2727
${{ runner.os }}-pip-
2828
2929
- name: Install dependencies
3030
run: |
31-
pip install -r ./.github/workflows/requirements/lint.txt
31+
pip install -r ./requirements/lint.txt
32+
33+
- name: Unlock git-crypt files
34+
uses: zemuldo/[email protected]
35+
env:
36+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
37+
GPG_KEY_GRIP: ${{ secrets.GPG_KEY_GRIP }}
38+
GPG_KEY_PASS: ${{ secrets.GPG_KEY_PASS }}
3239

3340
- name: Check black code formatting
3441
run: python -m black telereddit --check
3542

3643
- name: Check flake8 linting
37-
run: python -m flake8 --config setup.cfg telereddit
44+
run: python -m flake8 --config setup.cfg telereddit
45+
46+
- name: Check mypy linting
47+
run: mypy telereddit
48+
49+
- name: Check icontract linting
50+
run: pyicontract-lint --format verbose telereddit

.github/workflows/requirements/docs.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/requirements/lint.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/requirements/test.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,14 @@ jobs:
3333
uses: actions/cache@v1
3434
with:
3535
path: ~/.cache/pip # This path is specific to Ubuntu
36-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
37-
restore-keys: |
38-
${{ runner.os }}-pip-
39-
40-
- name: Cache CI dependencies
41-
uses: actions/cache@v1
42-
with:
43-
path: ~/.cache/pip # This path is specific to Ubuntu
44-
key: ${{ runner.os }}-pip-${{ hashFiles('./.github/workflows/requirements/test.txt') }}
36+
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements/requirements.txt') }}-${{ hashFiles('**/test.txt') }}
4537
restore-keys: |
4638
${{ runner.os }}-pip-
4739
4840
- name: Install dependencies
4941
run: |
50-
pip install -r requirements.txt
51-
pip install -r ./.github/workflows/requirements/test.txt
42+
pip install -r ./requirements/requirements.txt
43+
pip install -r ./requirements/test.txt
5244
5345
- name: Run tests and generate report
5446
run: |

.gitignore

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6-
# C extensions
7-
*.so
8-
96
# Distribution / packaging
107
.Python
118
build/
@@ -25,16 +22,6 @@ wheels/
2522
*.egg
2623
MANIFEST
2724

28-
# PyInstaller
29-
# Usually these files are written by a python script from a template
30-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31-
*.manifest
32-
*.spec
33-
34-
# Installer logs
35-
pip-log.txt
36-
pip-delete-this-directory.txt
37-
3825
# Unit test / coverage reports
3926
htmlcov/
4027
.tox/
@@ -47,40 +34,6 @@ coverage.xml
4734
.hypothesis/
4835
.pytest_cache/
4936

50-
# Translations
51-
*.mo
52-
*.pot
53-
54-
# Django stuff:
55-
*.log
56-
local_settings.py
57-
db.sqlite3
58-
59-
# Flask stuff:
60-
instance/
61-
.webassets-cache
62-
63-
# Scrapy stuff:
64-
.scrapy
65-
66-
# Sphinx documentation
67-
docs/_build/
68-
69-
# PyBuilder
70-
target/
71-
72-
# Jupyter Notebook
73-
.ipynb_checkpoints
74-
75-
# pyenv
76-
.python-version
77-
78-
# celery beat schedule file
79-
celerybeat-schedule
80-
81-
# SageMath parsed files
82-
*.sage.py
83-
8437
# Environments
8538
.env
8639
.venv
@@ -103,10 +56,17 @@ venv.bak/
10356

10457
# mypy
10558
.mypy_cache/
59+
.mypy
10660

61+
# IDE
10762
.vscode
10863
.idea
10964

65+
# Python
11066
__pycache__
11167

112-
documentation-reports
68+
documentation-reports
69+
70+
html
71+
.mutmut-cache
72+
.metadata

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ Get it on [telegram.me](https://telegram.me/tele_reddit_bot)!
6060

6161
## Bugs and feature requests
6262
If you want to report a bug or would like a feature to be added, feel free to open an issue.
63+
64+
65+
## Versioning
66+
We follow Semantic Versioning. The version X.Y.Z indicates:
67+
68+
* X is the major version (backward-incompatible),
69+
* Y is the minor version (backward-compatible), and
70+
* Z is the patch version (backward-compatible bug fix).
6371

6472
## License
6573
**[GPL v3](https://www.gnu.org/licenses/gpl-3.0)** - Copyright 2020 © <a href="http://fabio.sangregorio.dev"

0 commit comments

Comments
 (0)