From 802f0571beaceb317ae9e1db2905ee557b86315a Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 31 May 2024 10:59:56 -0400 Subject: [PATCH 1/4] add flake8 file --- .flake8 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..92c9bb29 --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +[flake8] +exclude = + .git, + __pycache__, + build, + dist, + versioneer.py, + labpdfproc/_version.py, + doc/manual/source/conf.py +max-line-length = 115 +# Ignore some style 'errors' produced while formatting by 'black' +ignore = W503 From 0be93105fd0d4c1f42edfa9a8a2a2c388228d2fa Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 31 May 2024 11:03:01 -0400 Subject: [PATCH 2/4] add .isort.cfg file --- .isort.cfg | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .isort.cfg diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 00000000..e0926f42 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,4 @@ +[settings] +line_length = 115 +multi_line_output = 3 +include_trailing_comma = True From 3e59412c86c55f9d3c8f0c046ce1c92165936226 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 31 May 2024 11:03:22 -0400 Subject: [PATCH 3/4] add pre-commit yaml file --- .pre-commit-config.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..3a8f4de5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,34 @@ +default_language_version: + python: python3 +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + exclude: '\.(rst|txt)$' + - repo: https://github.com/ambv/black + rev: 23.3.0 + hooks: + - id: black + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + args: ["--profile", "black"] + - repo: https://github.com/kynan/nbstripout + rev: 0.6.1 + hooks: + - id: nbstripout + - repo: local + hooks: + - id: prevent-commit-to-main + name: Prevent Commit to Main Branch + entry: ./prevent_commit_to_main.sh + language: script + stages: [commit] From aacf348601826f3843410fbf5ac6594e59f6ca35 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 31 May 2024 11:03:53 -0400 Subject: [PATCH 4/4] add prevent_commit_to_main.sh file --- prevent_commit_to_main.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 prevent_commit_to_main.sh diff --git a/prevent_commit_to_main.sh b/prevent_commit_to_main.sh new file mode 100755 index 00000000..5237b16a --- /dev/null +++ b/prevent_commit_to_main.sh @@ -0,0 +1,9 @@ +#!/bin/sh +##!"C:\\Program Files\\Git\\usr\\bin\\bash.exe" + +branch="$(git rev-parse --abbrev-ref HEAD)" + +if [ "$branch" = "main" ]; then +echo "You are on the main branch. Committing to the main branch is not allowed." +exit 1 +fi