Skip to content

Commit e1d0ffc

Browse files
author
Peter Bengtsson
authored
Lint check .js and .py (#46)
Fixes #45
1 parent 77f3cdd commit e1d0ffc

File tree

5 files changed

+176
-0
lines changed

5 files changed

+176
-0
lines changed

.circleci/config.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
test:
8+
docker:
9+
- image: circleci/node:10
10+
11+
working_directory: ~/repo
12+
13+
steps:
14+
- checkout
15+
16+
# Download and cache node dependencies
17+
- restore_cache:
18+
keys:
19+
- v2-dependencies-{{ checksum "yarn.lock" }}
20+
# fallback to using the latest cache if no exact match is found
21+
- v2-dependencies-
22+
23+
- run:
24+
name: Install node dependencies
25+
command: yarn install
26+
27+
- save_cache:
28+
paths:
29+
- 'node_modules'
30+
key: v2-dependencies-{{ checksum "yarn.lock" }}
31+
32+
# Run tests!
33+
- run:
34+
name: Test
35+
command: yarn run test:ci
36+
37+
lint:
38+
docker:
39+
# Image with python 3.6 and node 8
40+
- image: circleci/python:3.6-node-browsers
41+
42+
working_directory: ~/repo
43+
44+
steps:
45+
- checkout
46+
47+
# Download and cache python dependencies
48+
- restore_cache:
49+
key: v1-python
50+
51+
- run:
52+
name: Create virtualenv
53+
command: |
54+
python3 -m venv ~/venv
55+
echo "source ~/venv/bin/activate" >> $BASH_ENV
56+
57+
- run:
58+
name: Install therapist
59+
command: pip install -U therapist
60+
61+
- save_cache:
62+
paths:
63+
- '~/venv'
64+
key: v1-python
65+
66+
# Download and cache node dependencies
67+
- restore_cache:
68+
keys:
69+
- v2-dependencies-{{ checksum "yarn.lock" }}
70+
# fallback to using the latest cache if no exact match is found
71+
- v2-dependencies-
72+
73+
- run:
74+
name: Install node dependencies
75+
command: yarn install
76+
77+
- save_cache:
78+
paths:
79+
- 'node_modules'
80+
key: v2-dependencies-{{ checksum "yarn.lock" }}
81+
82+
# Run lint suite using therapist
83+
- run:
84+
name: Lint
85+
command: therapist run --use-tracked-files
86+
87+
build:
88+
# Test that a production-build of the project works
89+
docker:
90+
- image: circleci/node:10
91+
92+
working_directory: ~/repo
93+
94+
steps:
95+
- checkout
96+
97+
# Download and cache node dependencies
98+
- restore_cache:
99+
keys:
100+
# Include package.json in the keys, since moving between
101+
# dependencies and devDependncies doesn't change yarn.lock.
102+
- v2-dependencies-prod-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
103+
# fallback to using the latest cache if no exact match is found
104+
- v2-dependencies-prod-{{ checksum "package.json" }}-
105+
106+
- run:
107+
name: Install node dependencies in production mode
108+
command: yarn install --prod
109+
110+
- save_cache:
111+
paths:
112+
- 'node_modules'
113+
key: v2-dependencies-prod-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
114+
115+
- run:
116+
name: Build
117+
command: yarn run build
118+
119+
workflows:
120+
version: 2
121+
build_and_docs:
122+
jobs:
123+
- lint
124+
- build
125+
- test

.therapist.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
actions:
2+
black:
3+
run: black --check --diff {files}
4+
fix: black {files}
5+
include: "*.py"
6+
7+
flake8:
8+
run: flake8 {files}
9+
include: "*.py"
10+
exclude: "docs/"
11+
12+
prettier:
13+
run: ./node_modules/.bin/prettier -l {files}
14+
include: "*.js"
15+
16+
shortcuts:
17+
lint:
18+
flags:
19+
- include-unstaged
20+
- include-untracked
21+
"lint:all":
22+
extends: lint
23+
flags: use-tracked-files
24+
fix:
25+
extends: lint
26+
flags: fix
27+
"fix:all":
28+
extends: fix
29+
flags: use-tracked-files

requirements-constraints.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,20 @@ asn1crypto==0.24.0 \
8989
--hash=sha256:9d5c20441baf0cb60a4ac34cc447c6c189024b6b4c6cd7877034f4965c464e49
9090
pycparser==2.19 \
9191
--hash=sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3
92+
pathspec==0.5.9 \
93+
--hash=sha256:54a5eab895d89f342b52ba2bffe70930ef9f8d96e398cccf530d21fa0516a873
94+
colorama==0.4.1 \
95+
--hash=sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48 \
96+
--hash=sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d
97+
PyYAML==3.13 \
98+
--hash=sha256:d5eef459e30b09f5a098b9cea68bebfeb268697f78d647bd255a085371ac7f3f \
99+
--hash=sha256:e01d3203230e1786cd91ccfdc8f8454c8069c91bee3962ad93b87a4b2860f537 \
100+
--hash=sha256:558dd60b890ba8fd982e05941927a3911dc409a63dcb8b634feaa0cda69330d3 \
101+
--hash=sha256:d46d7982b62e0729ad0175a9bc7e10a566fc07b224d2c79fafb5e032727eaa04 \
102+
--hash=sha256:a7c28b45d9f99102fa092bb213aa12e0aaf9a6a1f5e395d36166639c1f96c3a1 \
103+
--hash=sha256:bc558586e6045763782014934bfaf39d48b8ae85a2713117d16c39864085c613 \
104+
--hash=sha256:40c71b8e076d0550b2e6380bada1f1cd1017b882f7e16f09a65be98e017f211a \
105+
--hash=sha256:3d7da3009c0f3e783b2c873687652d83b1bbfd5c88e9813fb7e5b03c0dd3108b \
106+
--hash=sha256:e170a9e6fcfd19021dd29845af83bb79236068bf5fd4df3327c1be18182b2531 \
107+
--hash=sha256:aa7dd4a6a427aed7df6fb7f08a580d68d9b118d90310374716ae90b710280af1 \
108+
--hash=sha256:3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ python-decouple==3.1 \
4242
python-dotenv==0.9.1 \
4343
--hash=sha256:122290a38ece9fe4f162dc7c95cae3357b983505830a154d3c98ef7f6c6cea77 \
4444
--hash=sha256:4a205787bc829233de2a823aa328e44fd9996fedb954989a21f1fc67c13d7a77
45+
therapist==1.5.0 \
46+
--hash=sha256:03f120c411f05e0fc6d95a6cbfb876b083a1fd854ddd22bb12eee05ef1670a31 \
47+
--hash=sha256:58eada2a96d68d1df5d4b86450678528727e8e145f7edd2ec123b8618e8c14e4

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 88

0 commit comments

Comments
 (0)