Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Pre-Commit Utilities #11

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 164 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################
# PYTHON GITIGNORE TEMPLATE
# (https://github.com/github/gitignore/) (2024-10-03)
# (https://github.com/github/gitignore/blob/main/Python.gitignore) (2024-10-03)
################################################################################

# Byte-compiled / optimized / DLL files
Expand Down Expand Up @@ -480,6 +480,166 @@ TSWLatexianTemp*
# Uncomment the next line to have this generated file ignored.
#*Notes.bib


################################################################################
# R GITIGNORE TEMPLATE
# (https://github.com/github/gitignore/blob/main/R.gitignore) (2024-12-05)
################################################################################

# History files
.Rhistory
.Rapp.history

# Session Data files
.RData
.RDataTmp

# User-specific files
.Ruserdata

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# R Environment Variables
.Renviron

# pkgdown site
docs/

# translation temp files
po/*~

# RStudio Connect folder
rsconnect/


################################################################################
# JULIA GITIGNORE TEMPLATE
# (https://github.com/github/gitignore/blob/main/Julia.gitignore) (2024-12-05)
################################################################################

# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov

# Files generated by invoking Julia with --track-allocation
*.jl.mem

# System-specific files and directories generated by the BinaryProvider and BinDeps packages
# They contain absolute paths specific to the host computer, and so should not be committed
deps/deps.jl
deps/build.log
deps/downloads/
deps/usr/
deps/src/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/

# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml


################################################################################
# GITHUB PAGES GITIGNORE TEMPLATE
# (https://github.com/github/gitignore/blob/main/GitHubPages.gitignore) (2024-12-05)
################################################################################

# This .gitignore is appropriate for repositories deployed to GitHub Pages and using
# a Gemfile as specified at https://github.com/github/pages-gem#conventional

# Basic Jekyll gitignores (synchronize to Jekyll.gitignore)
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata

# Additional Ruby/bundler ignore for when you run: bundle install
/vendor

# Specific ignore for GitHub Pages
# GitHub Pages will always use its own deployed version of pages-gem
# This means GitHub Pages will NOT use your Gemfile.lock and therefore it is
# counterproductive to check this file into the repository.
# Details at https://github.com/github/pages-gem/issues/768
Gemfile.lock

################################################################################
# SASS GITIGNORE TEMPLATE
# (https://github.com/github/gitignore/blob/main/Sass.gitignore) (2024-12-05)
################################################################################

.sass-cache/
*.css.map
*.sass.map
*.scss.map

################################################################################
# C++ GITIGNORE TEMPLATE
# (https://github.com/github/gitignore/blob/main/C%2B%2B.gitignore) (2024-12-05)
################################################################################

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

################################################################################
# MISCELLANEOUS
################################################################################
Expand All @@ -492,3 +652,6 @@ _site
_freeze
.DS_Store
DS_Store
_book/
_book
author_emails.txt
2 changes: 2 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
linters: linters_with_defaults(object_usage_linter = NULL)
encoding: "UTF-8"
94 changes: 92 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,70 @@
################################################################################
# OVERVIEW
################################################################################
# The following contains the pre-commit hooks for this repository, which are
# likely a modified version of the author's (AFg6K7h4fhy2) repository template.
#
# Links:
#
# Pre-commit: https://pre-commit.com/
# The author's template: https://github.com/AFg6K7h4fhy2/AFg6K7h4fhy2-Template
# Supported hooks: https://github.com/pre-commit/pre-commit-hooks
repos:
################################################################################
# GENERAL
################################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# prevent giant files from being committed.
- id: check-added-large-files
args: ["--maxkb=10000"]
# simply check whether files parse as valid
# python
- id: check-ast
# check for files with names that would
# conflict on a case-insensitive filesystem
# like MacOS HFS+ or Windows FAT.
- id: check-case-conflict
# checks for a common error of placing
# code before the docstring.
- id: check-docstring-first
# attempts to load all yaml files to
# verify syntax.
- id: check-yaml
# allow yaml files which use the
# multi-document syntax
args: ["--allow-multiple-documents"]
# attempts to load all TOML files to
# verify syntax.
- id: check-toml
# makes sure files end in a newline and
# only a newline.
- id: end-of-file-fixer
# replaces or checks mixed line ending.
- id: mixed-line-ending
# verifies that test files are named
# correctly.
- id: name-tests-test
# ensure tests match test_.*\.py
args: ["--pytest-test-first"]
# checks that all your JSON files are pretty.
# "Pretty" here means that keys are sorted
# and indented.
- id: pretty-format-json
# automatically format json files;
# when autofixing, retain the original
# key ordering (instead of sorting
# the keys)
args: ["--autofix", "--no-sort-keys"]
# trims trailing whitespace.
- id: trailing-whitespace
# checks that non-binary executables have
# a proper shebang.
- id: check-executables-have-shebangs
files: \.sh$
# checks for the existence of private keys.
- id: detect-private-key
################################################################################
# PYTHON
################################################################################
Expand All @@ -28,10 +80,44 @@ repos:
- id: isort
args: ["--profile", "black", "--line-length", "79"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.8.2
hooks:
- id: ruff
args: ["--ignore=E741", "--ignore=E731", "--fix"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
################################################################################
# R
################################################################################
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.3.9003
hooks:
- id: style-files
- id: lintr
################################################################################
# MAKE FILES
################################################################################
- repo: https://github.com/mrtazz/checkmake.git
rev: 0.2.2
hooks:
- id: checkmake
################################################################################
# SECURITY
################################################################################
# - repo: https://github.com/gitleaks/gitleaks
# rev: v8.19.0
# hooks:
# - id: gitleaks
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
# must first run
# detect-secrets scan > .secrets.baseline
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
exclude: package.lock.json
################################################################################
# GITHUB ACTIONS
################################################################################
Expand All @@ -43,7 +129,7 @@ repos:
# SPELLING
################################################################################
- repo: https://github.com/crate-ci/typos
rev: v1.28.1
rev: typos-dict-v0.11.37
hooks:
- id: typos
args: ["--force-exclude"]
Expand All @@ -54,4 +140,8 @@ repos:
rev: v4.0.0
hooks:
- id: commitizen
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
################################################################################
Loading
Loading