-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code style and error check. (#3)
### This PR add the code syntax and error check for the whole repo by following the same principle of [opentelemetry-python-contrib](https://github.com/open-telemetry/opentelemetry-python-contrib) and use the following tools: **codespell**: Find and fix common spelling mistakes. **flake8** and **black**: Code style check and code formatting. **Isort**: Adjust the import statements. **pylint**: Configures pylint's style check rules, ignores specific warnings and statements, defines naming conventions, format logging style and spelling, etc,.
- Loading branch information
Showing
13 changed files
with
1,382 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[codespell] | ||
# skipping auto generated folders | ||
skip = ./.tox,./.mypy_cache,./target,*/LICENSE,./venv | ||
ignore-words-list = ot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[flake8] | ||
ignore = | ||
# line too long, defer to black | ||
E501 | ||
|
||
# allow line breaks before binary ops | ||
W503 | ||
|
||
# allow line breaks after binary ops | ||
W504 | ||
|
||
# allow whitespace before ':' (https://github.com/psf/black#slices) | ||
E203 | ||
|
||
exclude = | ||
.bzr | ||
.git | ||
.hg | ||
.svn | ||
.tox | ||
CVS | ||
.venv*/ | ||
venv*/ | ||
target | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow check the code style for the repo | ||
# TODO: add unit test check after adding AWS Distro project | ||
name: AWS Distro Tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
misc: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tox-environment: ["spellcheck", "lint"] | ||
name: ${{ matrix.tox-environment }} | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }} | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- name: Install tox | ||
run: pip install tox==3.27.1 | ||
- name: Install libsnappy-dev | ||
if: ${{ matrix.tox-environment == 'lint' }} | ||
run: sudo apt-get install -y libsnappy-dev | ||
- name: Cache tox environment | ||
# Preserves .tox directory between runs for faster installs | ||
uses: actions/cache@v1 | ||
with: | ||
path: | | ||
.tox | ||
~/.cache/pip | ||
key: v7-misc-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', | ||
'dev-requirements.txt') }} | ||
- name: run tox | ||
run: tox -e ${{ matrix.tox-environment }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
*.py[cod] | ||
*.sw[op] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
dist-info | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
pyvenv.cfg | ||
lib | ||
lib64 | ||
__pycache__ | ||
venv*/ | ||
.venv*/ | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
coverage.xml | ||
.coverage | ||
.nox | ||
.tox | ||
.cache | ||
htmlcov | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# JetBrains | ||
.idea | ||
|
||
# VSCode | ||
.vscode | ||
|
||
# Sphinx | ||
_build/ | ||
|
||
# mypy | ||
.mypy_cache/ | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[settings] | ||
include_trailing_comma=True | ||
force_grid_wrap=0 | ||
use_parentheses=True | ||
line_length=79 | ||
profile=black | ||
|
||
; 3 stands for Vertical Hanging Indent, e.g. | ||
; from third_party import ( | ||
; lib1, | ||
; lib2, | ||
; lib3, | ||
; ) | ||
; docs: https://github.com/timothycrosley/isort#multi-line-output-modes | ||
multi_line_output=3 | ||
skip=target | ||
skip_glob=**/gen/*,.venv*/*,venv*/*,.tox/* | ||
known_first_party=opentelemetry | ||
known_third_party=psutil,pytest |
Oops, something went wrong.