Add GitHub action for pre-commit (#2515)

* Add GitHub action file for pre-commit

* Fix errors exposed by pre-commit hook:

- Remove executable bit from files without shebang. I checked those
  file and it was not needed.
- Fix with black

* Apply suggestions from code review

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
Dhruv 2020-09-30 18:53:34 +05:30 committed by GitHub
parent ae65f55de3
commit acaeb22bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 1 deletions

15
.github/workflows/pre-commit.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: pre-commit
on: [push, pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pre-commit
- run: pre-commit run --verbose --all-files --show-diff-on-failure

0
machine_learning/scoring_functions.py Executable file → Normal file
View File

0
maths/sum_of_arithmetic_series.py Executable file → Normal file
View File

0
scheduling/round_robin.py Executable file → Normal file
View File

View File

@ -15,7 +15,7 @@ def extract_user_profile(script) -> dict:
May raise json.decoder.JSONDecodeError
"""
data = script.contents[0]
info = json.loads(data[data.find('{"config"'): -1])
info = json.loads(data[data.find('{"config"') : -1])
return info["entry_data"]["ProfilePage"][0]["graphql"]["user"]