Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clairvoyance v2.0.0 - Package, Async, Linting #40

Merged
merged 64 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
9beec3e
fix: field validation
nullswan Jul 19, 2022
20cb84d
chore: add lint
nullswan Jul 19, 2022
530f893
chore: add poetry
nullswan Jul 19, 2022
a6a267b
chore: add gql
nullswan Jul 19, 2022
a7af174
feat: primitives
nullswan Jul 19, 2022
b2fcae0
feat: update oracle
nullswan Jul 19, 2022
f473ead
feat: update gql
nullswan Jul 19, 2022
bbae28b
feat: config
nullswan Jul 19, 2022
f2f3b33
feat: client
nullswan Jul 19, 2022
2a4023d
chore: remove config
nullswan Jul 19, 2022
3423c5d
fix: class & linting
nullswan Jul 19, 2022
5b9ca38
feat: update
nullswan Jul 19, 2022
493ec48
feat: cli
nullswan Jul 19, 2022
794574e
chore: add wordlist
nullswan Jul 19, 2022
97b4705
chore: update wordlist
nullswan Jul 19, 2022
98ed3fa
feat: working
nullswan Jul 19, 2022
b2668ef
chore: logger fix
nullswan Jul 19, 2022
3449dd6
feat: update docker && ci
nullswan Jul 19, 2022
877d6ca
chore: linting
nullswan Jul 19, 2022
7f38f27
chore: lint
nullswan Jul 19, 2022
9c4d108
chore: downgrade mypy
nullswan Jul 26, 2022
14af1fd
fix: update poetry.lock data
nullswan Jul 26, 2022
9502b1a
chore: update workflows
nullswan Jul 26, 2022
745135f
chore: bump pyproject
nullswan Jul 26, 2022
409b0f8
feat: add Swan as author
iCarossio Jul 26, 2022
819d5b3
fix: starting explicit url
nullswan Jul 27, 2022
cb43d0c
chore: typo regexs
nullswan Jul 27, 2022
9d0603a
fix: revert removal of gql
nullswan Jul 27, 2022
27108db
refactor: test return type
nullswan Jul 27, 2022
bbbd6ad
fix: remove totally gql client
nullswan Jul 27, 2022
ef3d477
chore: nomenclature of ignored list
nullswan Jul 27, 2022
57a7989
fix: add default value to ignored list
nullswan Jul 27, 2022
473da23
chore: tests typing
nullswan Jul 27, 2022
fb94ad3
feat: logger env variables
nullswan Jul 27, 2022
474fa0a
chore: update readme with environment variables
nullswan Jul 27, 2022
ca87bad
chore: specify code block language
nullswan Jul 27, 2022
1060aa8
refactor: ctx usage for LLV object
nullswan Jul 27, 2022
193e535
chore: ignore lambda warnings
nullswan Jul 27, 2022
6b6f930
fix: lint confirmity and disable errors
nullswan Jul 27, 2022
edff802
chore: tests quotes conversion
nullswan Jul 27, 2022
2ecccb2
fix: remove master from workflow
nullswan Jul 27, 2022
0707f79
chore: more linting
nullswan Jul 27, 2022
278ac73
feat: add aiounittest
nullswan Jul 27, 2022
ced38c0
tests: greenify
nullswan Jul 27, 2022
1156313
fix: tests workflows dependencies install
nullswan Jul 27, 2022
7c3a1b9
test: check subprocess returned code
nullswan Jul 27, 2022
2acd604
fix: workflows environment
nullswan Jul 27, 2022
7d1a248
fix: workflows and response status
nullswan Jul 27, 2022
c6e5b06
feat: add vscode debugger
nullswan Jul 28, 2022
cbdd10b
fix: args verbosity
nullswan Jul 28, 2022
e02d018
fix: workflow exit
nullswan Jul 28, 2022
9e0a219
refactor: meta enum for graphql types
nullswan Jul 28, 2022
2257877
feat: add --verbose
nullswan Jul 28, 2022
5cb2f00
chore: log consistency
nullswan Jul 28, 2022
0ac76a8
feat: default wordlist
nullswan Jul 28, 2022
d0c1499
fix: safely close client session
nullswan Jul 28, 2022
0734ba2
chore: workflow consistency
nullswan Jul 28, 2022
4c6ee93
chore: remove unecessary statement
nullswan Jul 28, 2022
986687f
chore: linting consistency
nullswan Jul 28, 2022
5e1027b
refactor: GQL kind semenatic
nullswan Jul 28, 2022
2fe2a48
fix: add primitives to ignored list
nullswan Jul 28, 2022
64f65e5
feat: handle more skip messages
nullswan Jul 28, 2022
7d38054
test: remove stderr test
nullswan Jul 28, 2022
41e88e3
chore: update to fit tests
nullswan Aug 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: cd

on:
push:
tags:
- "v*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: softprops/action-gh-release@v1

pypi-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
pip install poetry
- name: Setup poetry
run: |
poetry config virtualenvs.in-project true
poetry install --no-dev
- name: Build package
run: |
source .venv/bin/activate
poetry build
- name: Upload package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

docker-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/clairvoyance:latest

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
37 changes: 0 additions & 37 deletions .github/workflows/cicd-to-dockerhub.yml

This file was deleted.

56 changes: 39 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ on:
- '.gitignore'
branches:
- main
- master
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
branches:
- main
- master
types:
- opened
- reopened

env:
MODULE_NAME: clairvoyance
MIN_TEST_COV: 0
SERVER: http://localhost:4000

jobs:
unit-tests:
Expand All @@ -27,15 +33,27 @@ jobs:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
pip install poetry
- name: Setup poetry
run: |
python -m unittest tests/*_test.py
poetry config virtualenvs.in-project true
poetry install
- name: Run lint
if: always()
run: |
source .venv/bin/activate
isort -m 9 --line-length 160 $MODULE_NAME tests --check-only
pylint --load-plugins pylint_quotes $MODULE_NAME tests
docformatter --wrap-summaries 160 --wrap-descriptions 160 -cr $MODULE_NAME tests
yapf -rd $MODULE_NAME tests
mypy -V
mypy $MODULE_NAME tests
- name: Run tests
run: |
source .venv/bin/activate
pytest --cov=$MODULE_NAME --cov-report=xml --cov-fail-under=$MIN_TEST_COV tests

system-tests:

Expand All @@ -45,32 +63,36 @@ jobs:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install poetry
- name: Setup poetry
run: |
poetry config virtualenvs.in-project true
poetry install
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install deps and run server
run: |
cd tests/apollo-server
npm install
node src/index.js &
- name: Wait for server
run: |
echo "SERVER=http://localhost:4000" > $GITHUB_ENV

for i in {0..9}; do
for i in {0..10}; do
echo "Sleep for 1 second ..."
sleep 1
if curl -s -o /dev/null "$SERVER"; then
echo "$SERVER returned HTTP response!"
break
fi
if [ $i -eq 10 ]; then
echo "Server did not respond after 10 seconds!"
exit 1
fi
done
- name: Test with pytest
run: |
source .venv/bin/activate
python -m unittest tests/system.py
15 changes: 15 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[mypy]
python_version = 3.7
disallow_untyped_defs=True
disallow_untyped_calls=True
disallow_incomplete_defs=True
disallow_untyped_decorators=True
strict_equality=True
show_error_codes=True
warn_unreachable=True
warn_redundant_casts=True
warn_unused_ignores=True
warn_unused_configs=True
pretty=True
exclude=(build|dist|setup.py|.venv)
files=pytemplate,tests
57 changes: 57 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[MASTER]
# init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc())); import pylint_venv; pylint_venv.inithook('./.venv')"
load-plugins=pylint_absolute_imports, pylint_quotes
ignore=.venv,setup.py

[DESIGN]

# Maximum number of characters on a single line.
max-line-length=160
# Good variable names which should always be accepted, separated by a comma
good-names=i,e
# Maximum number of branch for function / method body
max-branches=15
# Maximum number of arguments for function / method
max-args=10
# Variable naming style
variable-rgx=([a-z_][a-z0-9_]{1,31}|[a-zA-Z0-9_]{1})$
# Argument naming style
argument-rgx=([a-z_][a-z0-9_]{1,31}|[a-zA-Z0-9_]{1})$
# Attribute naming style
attr-rgx=([a-z_][a-z0-9_]{1,31}|[a-zA-Z0-9_]{1})$
# Maximum number of public methods per class
max-public-methods=30
# Maximum number of locals for function / method body
max-locals=20
# Make docstring compulsory for all functions
no-docstring-rgx=$^

# MODULE-PARAM: pylint-quotes
string-quote=single
triple-quote=double
docstring-quote=double

[ELIF]

# Maximum number of nested blocks for function/method body
max-nested-blocks=8


[SIMILARITIES]

# Minimum lines number of a similarity.
min-similarity-lines=15
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=yes


[MESSAGES CONTROL]

#TODO: DEV - Fix these one day: broad-except, fixme
disable=logging-format-interpolation, logging-fstring-interpolation, broad-except, fixme, missing-class-docstring, missing-module-docstring, missing-function-docstring
enable=print-statement
extension-pkg-whitelist=lxml
Loading