Simply pre-commit hooks.
parent
9d18552218
commit
7849e3fcdd
|
@ -1,13 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
filesToFormat=$(
|
FORMAT_FILES=$(
|
||||||
git --no-pager diff --name-status --no-color --cached | \
|
git --no-pager diff --name-status --no-color --cached | \
|
||||||
awk '$1 != "D" && $2 ~ /\.c$|\.h$/ {print $NF}'
|
awk '$1 != "D" && $2 ~ /\.c$|\.h$/ {print $NF}'
|
||||||
)
|
)
|
||||||
|
|
||||||
for path in $filesToFormat
|
clang-format -i "$FORMAT_FILES"
|
||||||
do
|
|
||||||
clang-format -i "$path"
|
git add "$FORMAT_FILES"
|
||||||
git add "$path"
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
filesToFormat=$(
|
FORMAT_FILES=$(
|
||||||
git --no-pager diff --name-status --no-color --cached | \
|
git --no-pager diff --name-status --no-color --cached | \
|
||||||
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
|
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
|
||||||
)
|
)
|
||||||
|
|
||||||
for path in $filesToFormat
|
mix format "$FORMAT_FILES"
|
||||||
do
|
|
||||||
mix format "$path"
|
git add "$FORMAT_FILES"
|
||||||
git add "$path"
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
filesToFormat=$(
|
FORMAT_FILES=$(
|
||||||
git --no-pager diff --name-status --no-color --cached | \
|
git --no-pager diff --name-status --no-color --cached | \
|
||||||
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
|
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
|
||||||
)
|
)
|
||||||
|
|
||||||
for path in $filesToFormat
|
prettier --write "$FORMAT_FILES"
|
||||||
do
|
|
||||||
prettier --write "$path"
|
git add "$FORMAT_FILES"
|
||||||
git add "$path"
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,24 +1,18 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
mixFiles=$(
|
MIX_FILES=$(
|
||||||
git --no-pager diff --name-status --no-color --cached | \
|
git --no-pager diff --name-status --no-color --cached | \
|
||||||
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
|
awk '$1 != "D" && $2 ~ /\.exs?$/ {print $NF}'
|
||||||
)
|
)
|
||||||
|
|
||||||
for path in $mixFiles
|
WEB_FILES=$(
|
||||||
do
|
|
||||||
mix format "$path"
|
|
||||||
git add "$path"
|
|
||||||
done
|
|
||||||
|
|
||||||
webFiles=$(
|
|
||||||
git --no-pager diff --name-status --no-color --cached | \
|
git --no-pager diff --name-status --no-color --cached | \
|
||||||
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
|
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
|
||||||
)
|
)
|
||||||
|
|
||||||
for path in $webFiles
|
mix format "$MIX_FILES"
|
||||||
do
|
|
||||||
prettier --write "$path"
|
prettier --write "$WEB_FILES"
|
||||||
git add "$path"
|
|
||||||
done
|
git add "$MIX_FILES" "$WEB_FILES"
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
filesToFormat=$(
|
FORMAT_FILES=$(
|
||||||
git --no-pager diff --name-status --no-color --cached | \
|
git --no-pager diff --name-status --no-color --cached | \
|
||||||
awk '$1 != "D" && $2 ~ /\.py$/ {print $NF}'
|
awk '$1 != "D" && $2 ~ /\.py$/ {print $NF}'
|
||||||
)
|
)
|
||||||
|
|
||||||
for path in $filesToFormat
|
black --quiet "$FORMAT_FILES"
|
||||||
do
|
|
||||||
black --quiet "$path"
|
git add "$FORMAT_FILES"
|
||||||
git add "$path"
|
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in New Issue