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 ;
|
||||
//Point the link's pointer to the current 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 ;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
def bubbleSort(arr):
|
||||
n = len(arr)
|
||||
arr = [23, 34, 25, 12, 54, 11, 90]
|
||||
|
||||
for i in range(n-1):
|
||||
for j in range(0, n-i-1):
|
||||
if arr[j] > arr[j+1] :
|
||||
arr[j], arr[j+1] = arr[j+1], arr[j]
|
||||
|
||||
arr = [23, 34, 25, 12, 54, 11, 90]
|
||||
def bubbleSort(arr):
|
||||
"""
|
||||
>>> bubbleSort(arr)
|
||||
[11, 12, 23, 25, 34, 54, 90]
|
||||
"""
|
||||
n = len(arr)
|
||||
for i in range(n-1):
|
||||
for j in range(0, n-i-1):
|
||||
if arr[j] > arr[j+1]:
|
||||
arr[j], arr[j+1] = arr[j+1], arr[j]
|
||||
return arr
|
||||
|
||||
bubbleSort(arr)
|
||||
|
||||
print ("Sorted array is:")
|
||||
for i in range(len(arr)):
|
||||
print (arr[i])
|
||||
bubbleSort(arr)
|
||||
|
||||
print("Sorted array is:")
|
||||
for i in range(len(arr)):
|
||||
print(arr[i])
|
||||
|
|
Loading…
Reference in New Issue