Skip to content

Commit 9894973

Browse files
Basic lint definition and configuration.
1 parent cac9a35 commit 9894973

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

.github/workflows/lint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: lint
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
lint-c:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- uses: actions/checkout@v1
13+
- uses: actions/setup-python@v1
14+
- name: install clang-format
15+
run: |
16+
sudo apt-get remove -y clang-6.0 libclang-common-6.0-dev libclang1-6.0 libllvm6.0
17+
sudo apt-get autoremove
18+
sudo apt-get install clang-format clang-format-6.0
19+
- name: install run-clang-format
20+
run: wget https://raw.githubusercontent.com/Sarcasm/run-clang-format/de6e8ca07d171a7f378d379ff252a00f2905e81d/run-clang-format.py
21+
- name: clang-format
22+
run: python run-clang-format.py --clang-format-executable=clang-format -r c/tskit c/tests
23+
pre-commit:
24+
runs-on: ubuntu-18.04
25+
steps:
26+
- uses: actions/checkout@v1
27+
- uses: actions/setup-python@v1
28+
- name: set PY
29+
run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
30+
- uses: actions/cache@v1
31+
with:
32+
path: ~/.cache/pre-commit
33+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
34+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.5.0
4+
hooks:
5+
- id: check-merge-conflict
6+
- id: debug-statements
7+
- id: mixed-line-ending
8+
- id: check-case-conflict
9+
- id: check-yaml
10+
- repo: https://github.com/psf/black
11+
rev: 19.10b0
12+
hooks:
13+
- id: black
14+
language_version: python3.6
15+
- repo: https://gitlab.com/pycqa/flake8
16+
rev: 3.7.9
17+
hooks:
18+
- id: flake8

0 commit comments

Comments
 (0)