GitHub Action to lint Python code (#151)
* GitHub Action to lint Python code * Fix typopull/160/head
parent
c08e033754
commit
0459f08eeb
|
@ -0,0 +1,20 @@
|
||||||
|
name: lint_python
|
||||||
|
on: [pull_request, push]
|
||||||
|
jobs:
|
||||||
|
lint_python:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
- run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety
|
||||||
|
- run: bandit --recursive --skip B101 . # B101 is assert statements
|
||||||
|
- run: black --check . || true
|
||||||
|
- run: codespell --ignore-words-list="ans,nnumber" --quiet-level=2 # --skip=""
|
||||||
|
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
|
- run: isort --check-only --profile black .
|
||||||
|
- run: pip install -r requirements.txt || true
|
||||||
|
- run: mypy --ignore-missing-imports .
|
||||||
|
- run: pytest . || true
|
||||||
|
- run: pytest --doctest-modules .
|
||||||
|
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py
|
||||||
|
- run: safety check
|
|
@ -34,7 +34,7 @@ void insertBeg(int data){
|
||||||
link->data = data ;
|
link->data = data ;
|
||||||
//Point the link's pointer to the current head
|
//Point the link's pointer to the current head
|
||||||
link->next = head ;
|
link->next = head ;
|
||||||
//Update the Head to the node we want to insert at the begining
|
//Update the Head to the node we want to insert at the beginning
|
||||||
head = link ;
|
head = link ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
def bubbleSort(arr):
|
arr = [23, 34, 25, 12, 54, 11, 90]
|
||||||
n = len(arr)
|
|
||||||
|
|
||||||
|
|
||||||
|
def bubbleSort(arr):
|
||||||
|
"""
|
||||||
|
>>> bubbleSort(arr)
|
||||||
|
[11, 12, 23, 25, 34, 54, 90]
|
||||||
|
"""
|
||||||
|
n = len(arr)
|
||||||
for i in range(n-1):
|
for i in range(n-1):
|
||||||
for j in range(0, n-i-1):
|
for j in range(0, n-i-1):
|
||||||
if arr[j] > arr[j+1]:
|
if arr[j] > arr[j+1]:
|
||||||
arr[j], arr[j+1] = arr[j+1], arr[j]
|
arr[j], arr[j+1] = arr[j+1], arr[j]
|
||||||
|
return arr
|
||||||
|
|
||||||
arr = [23, 34, 25, 12, 54, 11, 90]
|
|
||||||
|
|
||||||
bubbleSort(arr)
|
bubbleSort(arr)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue