Skip to content

Commit

Permalink
Added prettier code styler usage with tox and circleci.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerFi committed Jun 12, 2019
1 parent 00883dd commit 0256c44
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 86 deletions.
40 changes: 36 additions & 4 deletions .circleci/config.yml
Expand Up @@ -10,12 +10,11 @@ executors:
working_directory: ~/workspace
environment:
TZ: "Asia/Jerusalem"

node-docker:
docker:
- image: "circleci/node:lts"
working_directory: ~/workspace


commands:
install-dockerlint:
Expand All @@ -33,6 +32,21 @@ commands:
paths:
- dockerlint-0.3.11

install-prettier:
description: Install prettier with npm
steps:
- restore_cache:
keys:
- v1-switcher-webapi-node-{{ .Branch }}-{{ checksum "prettierrc.yml" }}-{{ checksum "prettierignore" }}
- run:
name: Install prettier
command: |
npm install --save-dev --save-exact prettier
- save_cache:
key: v1-switcher-webapi-node-{{ .Branch }}-{{ checksum "prettierrc.yml" }}-{{ checksum "prettierignore" }}
paths:
- ./node_modules

prepare-venv:
description: Prepare the virtual environment
steps:
Expand All @@ -59,6 +73,14 @@ commands:
command: |
node dockerlint-0.3.11/bin/dockerlint.js -dpf Dockerfile
run-prettier:
description: Run prettier linter
steps:
- run:
name: Prettier
command: |
prettier --config .prettierrc.yml --ignore-path .prettierignore --check *.* **/*.*
check-security:
description: Run bandit tests
steps:
Expand Down Expand Up @@ -115,12 +137,20 @@ jobs:
- install-dockerlint
- run-dockerlint

prettier-job:
executor:
name: node-docker
steps:
- checkout
- install-prettier
- run-prettier

docker-check-and-build-job:
executor:
name: docker-publish/docker
steps:
- checkout
- setup_remote_docker
- setup_remote_docker
- docker-publish/build:
dockerfile: Dockerfile
path: .
Expand Down Expand Up @@ -188,9 +218,11 @@ workflows:
jobs:
- dockerlint-job

- prettier-job

- docker-check-and-build-job:
requires:
- dockerlint-job
- dockerlint-job

- security-job:
requires:
Expand Down
1 change: 0 additions & 1 deletion .codecov.yml
Expand Up @@ -8,7 +8,6 @@ coverage:
round: down
range: "30...100"


status:
patch: yes
changes: no
Expand Down
2 changes: 2 additions & 0 deletions .dockerignore
Expand Up @@ -9,6 +9,8 @@ shellscripts
.coveragerc
.dockerignore
.gitignore
.prettierignore
.prettierrc.yml
bandit.yml
Dockerfile
Makefile
Expand Down
24 changes: 24 additions & 0 deletions .prettierignore
@@ -0,0 +1,24 @@
.git
.tox*
.coverage
.coveragerc
.dockerignore
.env_vars
.gitignore
.prettierignore
Dockerfile
Makefile
pylintrc
VERSION
*.txt
*.ini
*.py
*.sh
*cache
*pycache*
src
include
bin
lib
log
share
7 changes: 7 additions & 0 deletions .prettierrc.yml
@@ -0,0 +1,7 @@
endOfLine: "lf"
overrides:
- files: "*.md"
parser: "markdown"
- files: "*.yml"
parser: "yaml"
single-quote: false

0 comments on commit 0256c44

Please sign in to comment.