Skip to content

Commit

Permalink
Added pre-commit to avoid problematic commits (#5)
Browse files Browse the repository at this point in the history
Co-authored-by: emielvdveen <emiel@applike.nl>
  • Loading branch information
vloothuis and mellelieuwes committed Oct 17, 2020
1 parent 202eded commit ca6fbfb
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 19 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"extensions": [
"stkb.rewrap",
"jakebecker.elixir-ls",
"ms-azuretools.vscode-docker"
"ms-azuretools.vscode-docker",
"redhat.vscode-yaml"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
Expand All @@ -33,4 +34,4 @@
"postCreateCommand": "mix setup",
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
}
19 changes: 9 additions & 10 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
link-app:
# If you want add a non-root user to your Dockerfile, you can use the "remoteUser"
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
# debugging) to execute as the user. Uncomment the next line if you want the entire
# container to run as this user instead. Note that, on Linux, you may need to
# ensure the UID and GID of the container user you create matches your local user.
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
# debugging) to execute as the user. Uncomment the next line if you want the entire
# container to run as this user instead. Note that, on Linux, you may need to
# ensure the UID and GID of the container user you create matches your local user.
# See https://aka.ms/vscode-remote/containers/non-root for details.
#
# user: vscode

# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
- .:/workspace:delegated
- .:/workspace:delegated

# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
# - /var/run/docker.sock:/var/run/docker.sock
# - /var/run/docker.sock:/var/run/docker.sock

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
Expand All @@ -35,4 +35,3 @@ services:

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"

41 changes: 41 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: no-commit-to-branch
args: [-b, main]
- repo: local
hooks:
- id: mix-test
name: "elixir: mix test"
entry: mix test
language: system
pass_filenames: false
files: \.exs*$

- id: mix-format
name: "elixir: mix format"
entry: mix format --check-formatted
language: system
files: \.exs*$

- id: mix-compile
name: "elixir: mix compile"
entry: mix compile --force --warnings-as-errors
language: system
pass_filenames: false
files: \.ex$

- id: mix-credo
name: "elixir: mix credo"
entry: mix credo
language: system
pass_filenames: false
files: \.exs*$
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"deps": true,
"postgres-data": true
}
}
}
4 changes: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RUN set -x &&\
apt-get install -y nodejs inotify-tools

RUN apt-get install -y python3-pip
RUN pip3 install gigalixir
RUN pip3 install gigalixir pre-commit

RUN mix archive.install --force hex phx_new 1.5.5
RUN mix archive.install --force hex phx_new 1.5.5

COPY . .
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is primary documentation for the Link application.

# Development
# Development

## Setup

Expand Down Expand Up @@ -67,4 +67,4 @@ Run the following command to enable the key in Gigalixir.
## GitHub branch protections

Enable branch protection on the `main` branch. This ensures that deployments
work (the deployment does not do a force push to Gigalixir).
work (the deployment does not do a force push to Gigalixir).
2 changes: 1 addition & 1 deletion testing.postgresql.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM postgres:11

COPY testing.postgresql.conf /etc/postgresql/postgresql.conf
COPY testing.postgresql.conf /etc/postgresql/postgresql.conf
2 changes: 1 addition & 1 deletion testing.postgresql.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ port = 5432
# https://www.postgresql.org/docs/current/non-durability.html
synchronous_commit = off
fsync = off
wal_sync_method = fsync
wal_sync_method = fsync

0 comments on commit ca6fbfb

Please sign in to comment.