add lint and template
This commit is contained in:
commit
c65b3755a8
15
.flake8
Normal file
15
.flake8
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[flake8]
|
||||||
|
select = B,C,E,F,P,T4,W,B9
|
||||||
|
max-line-length = 80
|
||||||
|
# C408 ignored because we like the dict keyword argument syntax
|
||||||
|
# E501 is not flexible enough, we're using B950 instead
|
||||||
|
ignore =
|
||||||
|
E203,E305,E402,E501,E721,E741,F403,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303,
|
||||||
|
# shebang has extra meaning in fbcode lints, so I think it's not worth trying
|
||||||
|
# to line this up with executable bit
|
||||||
|
EXE001,
|
||||||
|
# these ignores are from flake8-bugbear; please fix!
|
||||||
|
B007,B008,
|
||||||
|
# these ignores are from flake8-comprehensions; please fix!
|
||||||
|
C400,C401,C402,C403,C404,C405,C407,C411,C413,C414,C415
|
||||||
|
exclude =
|
||||||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. iOS]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone6]
|
||||||
|
- OS: [e.g. iOS8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
36
.github/workflows/doc.yml
vendored
Normal file
36
.github/workflows/doc.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: "Check and Publish Docs"
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
# install sphinx related package and build sphinx files
|
||||||
|
- uses: ammaraskar/sphinx-action@master
|
||||||
|
with:
|
||||||
|
docs-folder: "docs/"
|
||||||
|
pre-build-command: "pip install sphinx-markdown-tables nbsphinx recommonmark sphinx_rtd_theme"
|
||||||
|
|
||||||
|
|
||||||
|
# add .nojekyll to notice Pages use the _* dirs
|
||||||
|
- name: copy the generated site
|
||||||
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||||
|
run: |
|
||||||
|
mkdir public
|
||||||
|
touch public/.nojekyll
|
||||||
|
cp -r docs/_build/html/* public/
|
||||||
|
|
||||||
|
# push to gh-pages branch
|
||||||
|
- name: github pages deploy
|
||||||
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||||
|
uses: peaceiris/actions-gh-pages@v2.3.1
|
||||||
|
env:
|
||||||
|
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PUBLISH_BRANCH: gh-pages
|
||||||
|
PUBLISH_DIR: public
|
||||||
95
.github/workflows/lint.yml
vendored
Normal file
95
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
quick-checks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Fetch Wenet
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
- name: Checkout PR tip
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
|
# We are on a PR, so actions/checkout leaves us on a merge commit.
|
||||||
|
# Check out the actual tip of the branch.
|
||||||
|
git checkout ${{ github.event.pull_request.head.sha }}
|
||||||
|
fi
|
||||||
|
echo ::set-output name=commit_sha::$(git rev-parse HEAD)
|
||||||
|
id: get_pr_tip
|
||||||
|
- name: Ensure no tabs
|
||||||
|
run: |
|
||||||
|
(! git grep -I -l $'\t' -- . ':(exclude)*.svg' ':(exclude)**Makefile' ':(exclude)**/contrib/**' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have tabs; please convert them to spaces"; false))
|
||||||
|
- name: Ensure no trailing whitespace
|
||||||
|
run: |
|
||||||
|
(! git grep -I -n $' $' -- . ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have trailing whitespace; please remove them"; false))
|
||||||
|
|
||||||
|
flake8-py3:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
architecture: x64
|
||||||
|
- name: Fetch Wenet
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
- name: Checkout PR tip
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
|
# We are on a PR, so actions/checkout leaves us on a merge commit.
|
||||||
|
# Check out the actual tip of the branch.
|
||||||
|
git checkout ${{ github.event.pull_request.head.sha }}
|
||||||
|
fi
|
||||||
|
echo ::set-output name=commit_sha::$(git rev-parse HEAD)
|
||||||
|
id: get_pr_tip
|
||||||
|
- name: Run flake8
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
pip install flake8==3.8.2 flake8-bugbear flake8-comprehensions flake8-executable flake8-pyi==20.5.0 mccabe pycodestyle==2.6.0 pyflakes==2.2.0
|
||||||
|
flake8 --version
|
||||||
|
flake8 | tee ${GITHUB_WORKSPACE}/flake8-output.txt
|
||||||
|
- name: Add annotations
|
||||||
|
uses: pytorch/add-annotations-github-action@master
|
||||||
|
with:
|
||||||
|
check_name: 'flake8-py3'
|
||||||
|
linter_output_path: 'flake8-output.txt'
|
||||||
|
commit_sha: ${{ steps.get_pr_tip.outputs.commit_sha }}
|
||||||
|
regex: '^(?<filename>.*?):(?<lineNumber>\d+):(?<columnNumber>\d+): (?<errorCode>\w\d+) (?<errorDesc>.*)'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
cpplint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
architecture: x64
|
||||||
|
- name: Fetch Wenet
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
- name: Checkout PR tip
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
|
# We are on a PR, so actions/checkout leaves us on a merge commit.
|
||||||
|
# Check out the actual tip of the branch.
|
||||||
|
git checkout ${{ github.event.pull_request.head.sha }}
|
||||||
|
fi
|
||||||
|
echo ::set-output name=commit_sha::$(git rev-parse HEAD)
|
||||||
|
id: get_pr_tip
|
||||||
|
- name: Run cpplint
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
pip install cpplint
|
||||||
|
cpplint --version
|
||||||
|
cpplint --recursive .
|
||||||
|
if [ $? != 0 ]; then exit 1; fi
|
||||||
|
|
||||||
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# Visual Studio Code files
|
||||||
|
.vscode
|
||||||
|
.vs
|
||||||
|
|
||||||
|
# PyCharm files
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Eclipse Project settings
|
||||||
|
*.*project
|
||||||
|
.settings
|
||||||
|
|
||||||
|
# Sublime Text settings
|
||||||
|
*.sublime-workspace
|
||||||
|
*.sublime-project
|
||||||
|
|
||||||
|
# Editor temporaries
|
||||||
|
*.swn
|
||||||
|
*.swo
|
||||||
|
*.swp
|
||||||
|
*.swm
|
||||||
|
*~
|
||||||
|
|
||||||
|
# IPython notebook checkpoints
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# macOS dir files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
exp
|
||||||
|
data
|
||||||
|
raw_wav
|
||||||
|
tensorboard
|
||||||
|
**/*build*
|
||||||
Loading…
x
Reference in New Issue
Block a user