repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/ts_lint.rb | lib/overcommit/hook/pre_commit/ts_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `tslint` against modified TypeScript files.
# @see http://palantir.github.io/tslint/
class TsLint < Base
# example message:
# "src/file/anotherfile.ts[298, 1]: exceeds maximum line length of 140"
# or
# "ERROR: src/AccountCon... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/hadolint.rb | lib/overcommit/hook/pre_commit/hadolint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `hadolint` against any modified Dockefile files.
#
# @see http://hadolint.lukasmartinelli.ch/
class Hadolint < Base
def run
output = ''
success = true
# hadolint doesn't accept multiple arguments
applicable_fil... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/sorbet.rb | lib/overcommit/hook/pre_commit/sorbet.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs 'srb tc' against any modified files.
#
# @see https://github.com/sorbet/sorbet
class Sorbet < Base
# example of output:
# sorbet.rb:1: Method `foo` does not exist on `T.class_of(Bar)` https://srb.help/7003
MESSAGE_REGEX = /^(?<... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/php_cs_fixer.rb | lib/overcommit/hook/pre_commit/php_cs_fixer.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `php-cs-fixer` against any modified PHP files.
class PhpCsFixer < Base
MESSAGE_REGEX = /\s+\d+\)\s+(?<file>.*\.php)(?<violated_rules>\s+\(\w+(?:,\s+)?\))?/.freeze
def run
messages = []
feedback = ''
# Exit status fo... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/mix_format.rb | lib/overcommit/hook/pre_commit/mix_format.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `mix format --check-formatted` against any modified ex/heex/exs files.
#
# @see https://hexdocs.pm/mix/main/Mix.Tasks.Format.html
class MixFormat < Base
# example message:
# ** (Mix) mix format failed due to --check-formatted.
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/go_lint.rb | lib/overcommit/hook/pre_commit/go_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `golint` against any modified Golang files.
#
# @see https://github.com/golang/lint
class GoLint < Base
def run
output = ''
# golint doesn't accept multiple file arguments if
# they belong to different packages
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/w3c_css.rb | lib/overcommit/hook/pre_commit/w3c_css.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `w3c_validators` against any modified CSS files.
#
# @see https://github.com/alexdunae/w3c_validators
class W3cCss < Base
def run
collect_messages
rescue W3CValidators::ParsingError,
W3CValidators::ValidatorUnavail... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/foodcritic.rb | lib/overcommit/hook/pre_commit/foodcritic.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `foodcritic` against any modified Ruby files from Chef directory structure.
#
# @see http://www.foodcritic.io/
#
# There are two "modes" you can run this hook in based on the repo:
#
# SINGLE COOKBOOK REPO MODE
# ------------------... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/yard_coverage.rb | lib/overcommit/hook/pre_commit/yard_coverage.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Class to check yard documentation coverage.
#
# Use option "min_coverage_percentage" in your YardCoverage configuration
# to set your desired documentation coverage percentage.
#
class YardCoverage < Base
def run
# Run a no-stats ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/pylint.rb | lib/overcommit/hook/pre_commit/pylint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pylint` against any modified Python files.
#
# @see http://www.pylint.org/
class Pylint < Base
MESSAGE_REGEX = /^(?<file>(?:\w:)?.+):(?<line>\d+):(?<type>[CEFRW])/.freeze
# Classify 'E' and 'F' message codes as errors,
# ever... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/rails_best_practices.rb | lib/overcommit/hook/pre_commit/rails_best_practices.rb | # frozen_string_literal: true
module Overcommit
module Hook
module PreCommit
# Runs `rails_best_practices` against Ruby files
#
# @see https://github.com/railsbp/rails_best_practices
class RailsBestPractices < Base
ERROR_REGEXP = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+)\s-\s(?<type>.... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/image_optim.rb | lib/overcommit/hook/pre_commit/image_optim.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for images that can be optimized with `image_optim`.
#
# @see https://github.com/toy/image_optim
class ImageOptim < Base
def run
result = execute(command, args: applicable_files)
return [:fail, result.stdout + result.stde... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/standard.rb | lib/overcommit/hook/pre_commit/standard.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `standard` against any modified JavaScript files.
#
# @see https://github.com/feross/standard
class Standard < Base
MESSAGE_REGEX = /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+)/.freeze
def run
result = execute(command, args: app... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/berksfile_check.rb | lib/overcommit/hook/pre_commit/berksfile_check.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check if local Berksfile.lock matches Berksfile when either changes, unless
# Berksfile.lock is ignored by git.
#
# @see http://berkshelf.com/
class BerksfileCheck < Base
LOCK_FILE = 'Berksfile.lock'
def run
# Ignore if Berksfi... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/execute_permissions.rb | lib/overcommit/hook/pre_commit/execute_permissions.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for files with execute permissions, which are usually not necessary
# in source code files (and are typically caused by a misconfigured editor
# assigning incorrect default permissions).
#
# Protip: if you have some files that you want... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/forbidden_branches.rb | lib/overcommit/hook/pre_commit/forbidden_branches.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Prevents commits to branches matching one of the configured patterns.
class ForbiddenBranches < Base
def run
return :pass unless forbidden_commit?
[:fail, "Committing to #{current_branch} is forbidden"]
end
private
de... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/broken_symlinks.rb | lib/overcommit/hook/pre_commit/broken_symlinks.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for broken symlinks.
class BrokenSymlinks < Base
def run
broken_symlinks = applicable_files.
select { |file| Overcommit::Utils.broken_symlink?(file) }
if broken_symlinks.any?
return :fail, "Broken symlinks de... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/php_cs.rb | lib/overcommit/hook/pre_commit/php_cs.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `phpcs` against any modified PHP files.
class PhpCs < Base
# Parse `phpcs` csv mode output
MESSAGE_REGEX = /^\"(?<file>.+)\",(?<line>\d+),\d+,(?<type>.+),\"(?<msg>.+)\"/.freeze
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
'err... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/case_conflicts.rb | lib/overcommit/hook/pre_commit/case_conflicts.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for files that would conflict in case-insensitive filesystems
# Adapted from https://github.com/pre-commit/pre-commit-hooks
class CaseConflicts < Base
def run
repo_files = Set.new(applicable_files)
unless Overcommit::GitRe... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/sqlint.rb | lib/overcommit/hook/pre_commit/sqlint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs 'sqlint' against any modified SQL files.
#
# @see https://github.com/purcell/sqlint
class Sqlint < Base
MESSAGE_REGEX = /(?<file>(?:\w:)?.+):(?<line>\d+):\d+:(?<type>\w+)/.freeze
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
t... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/dogma.rb | lib/overcommit/hook/pre_commit/dogma.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `dogma` against any modified ex files.
#
# @see https://github.com/lpil/dogma
class Dogma < Base
def run
result = execute command
return :pass if result.success?
messages = []
# example message:
# == web... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/pydocstyle.rb | lib/overcommit/hook/pre_commit/pydocstyle.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pydocstyle` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pydocstyle
class Pydocstyle < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
outpu... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/ruby_syntax.rb | lib/overcommit/hook/pre_commit/ruby_syntax.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `ruby -c` against all Ruby files.
#
class RubySyntax < Base
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.match?(/^(syntax)?\s*error/) ? :error : :warning
end
def run
result = execute(command, args: applicable_fil... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/yaml_lint.rb | lib/overcommit/hook/pre_commit/yaml_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `YAMLLint` against any modified YAML files.
#
# @see https://github.com/adrienverge/yamllint
class YamlLint < Base
MESSAGE_REGEX = /
^(?<file>.+)
:(?<line>\d+)
:(?<col>\d+)
:\s\[(?<type>\w+)\]
\s(?<msg>.+)... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/author_name.rb | lib/overcommit/hook/pre_commit/author_name.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Ensures that a commit author has a name with at least first and last names.
class AuthorName < Base
def run
name =
if ENV.key?('GIT_AUTHOR_NAME')
ENV['GIT_AUTHOR_NAME']
else
result = execute(%w[git conf... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/pyflakes.rb | lib/overcommit/hook/pre_commit/pyflakes.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pyflakes` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pyflakes
class Pyflakes < Base
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):/.freeze
def run
result = execute(command, args: applic... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/css_lint.rb | lib/overcommit/hook/pre_commit/css_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `csslint` against any modified CSS files.
#
# @see https://github.com/CSSLint/csslint
class CssLint < Base
MESSAGE_REGEX = /
^(?<file>(?:\w:)?[^:]+):\s
(?:line\s(?<line>\d+)[^EW]+)?
(?<type>Error|Warning)
/x.freez... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/chamber_security.rb | lib/overcommit/hook/pre_commit/chamber_security.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `chamber secure` against any modified Chamber settings files.
#
# @see https://github.com/thekompanee/chamber
class ChamberSecurity < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.st... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/erb_lint.rb | lib/overcommit/hook/pre_commit/erb_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `erblint` against any modified ERB files.
#
# @see https://github.com/Shopify/erb-lint
class ErbLint < Base
MESSAGE_REGEX = /(?<message>.+)\nIn file: (?<file>.+):(?<line>\d+)/.freeze
def run
result = execute(command, args: a... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/chamber_compare.rb | lib/overcommit/hook/pre_commit/chamber_compare.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `chamber compare` against a configurable set of namespaces.
#
# @see https://github.com/thekompanee/chamber/wiki/Git-Commit-Hooks#chamber-compare-pre-commit-hook
# rubocop:disable Metrics/MethodLength
class ChamberCompare < Base
def ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/xml_syntax.rb | lib/overcommit/hook/pre_commit/xml_syntax.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks the syntax of any modified XML files.
class XmlSyntax < Base
def run
messages = []
applicable_files.each do |file|
REXML::Document.new(IO.read(file))
rescue REXML::ParseException => e
error = "Error par... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/pep8.rb | lib/overcommit/hook/pre_commit/pep8.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pep8` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pep8
class Pep8 < Base
def run
result = execute(command, args: applicable_files)
output = result.stdout.chomp
return :pass if result.suc... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/flay.rb | lib/overcommit/hook/pre_commit/flay.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `flay` against any modified files.
#
# @see https://github.com/seattlerb/flay
class Flay < Base
# Flay prints two kinds of messages:
#
# 1) IDENTICAL code found in :defn (mass*2 = MASS)
# file_path_1.rb:LINE_1
# file_pa... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/bundle_audit.rb | lib/overcommit/hook/pre_commit/bundle_audit.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for vulnerable versions of gems in Gemfile.lock.
#
# @see https://github.com/rubysec/bundler-audit
class BundleAudit < Base
LOCK_FILE = 'Gemfile.lock'
def run
# Ignore if Gemfile.lock is not tracked by git
ignored_fi... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/yarn_check.rb | lib/overcommit/hook/pre_commit/yarn_check.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check if local yarn.lock matches package.json when either changes, unless
# yarn.lock is ignored by git.
#
# @see https://yarnpkg.com/en/docs/cli/check
class YarnCheck < Base
LOCK_FILE = 'yarn.lock'
# A lot of the errors returned by ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb | lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check to see whether the schema file is in line with the migrations. When a
# schema file is present but a migration file is not, this is usually a
# failure. The exception is if the schema is at version 0 (i.e before any
# migrations have been... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/stylelint.rb | lib/overcommit/hook/pre_commit/stylelint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `stylelint` against any modified CSS file.
#
# @see https://github.com/stylelint/stylelint
class Stylelint < Base
# example of output:
# index.css: line 4, col 4, error - Expected indentation of 2 spaces (indentation)
MESSAGE_... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/scalastyle.rb | lib/overcommit/hook/pre_commit/scalastyle.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `scalastyle` against any modified Scala files.
#
# @see http://www.scalastyle.org/
class Scalastyle < Base
MESSAGE_REGEX = /
^(?<type>error|warning)\s
file=(?<file>(?:\w:)?.+)\s
message=.+\s*
(line=(?<line>\d+))... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/semi_standard.rb | lib/overcommit/hook/pre_commit/semi_standard.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `semistandard` against any modified JavaScript files.
#
# @see https://github.com/Flet/semistandard
class SemiStandard < Base
MESSAGE_REGEX = /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+)/.freeze
def run
result = execute(command,... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb | lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for local paths in files and issues a warning
class LocalPathsInGemfile < Base
def run
result = execute(command, args: applicable_files)
unless result.stdout.empty?
return :warn, "Avoid pointing to local paths in Gem... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_rebase/merged_commits.rb | lib/overcommit/hook/pre_rebase/merged_commits.rb | # frozen_string_literal: true
module Overcommit::Hook::PreRebase
# Prevents rebasing commits that have already been merged into one of
# a specified set of branches.
class MergedCommits < Base
def run
# Allow rebasing a detached HEAD since no refs are changed.
return :pass if detached_head? || il... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_rebase/base.rb | lib/overcommit/hook/pre_rebase/base.rb | # frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::PreRebase
# Functionality common to all pre-rebase hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context,
:upstream_branch, :rebased_branch, :detached_head?,
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/submodule_status.rb | lib/overcommit/hook/post_checkout/submodule_status.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/submodule_status'
module Overcommit::Hook::PostCheckout
# Checks the status of submodules in the current repository and
# notifies the user if any are uninitialized, out of date with
# the current index, or contain merge conflicts.
class SubmoduleS... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/npm_install.rb | lib/overcommit/hook/post_checkout/npm_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/npm_install'
module Overcommit::Hook::PostCheckout
# Runs `npm install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::NpmInstall
class NpmInstall < Base
include Overcommit::Hook::Shared::NpmI... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/yarn_install.rb | lib/overcommit/hook/post_checkout/yarn_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/yarn_install'
module Overcommit::Hook::PostCheckout
# Runs `yarn install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::YarnInstall
class YarnInstall < Base
include Overcommit::Hook::Shared::... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/bundle_install.rb | lib/overcommit/hook/post_checkout/bundle_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/bundle_install'
module Overcommit::Hook::PostCheckout
# Runs `bundle install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::BundleInstall
class BundleInstall < Base
include Overcommit::Hook::... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/base.rb | lib/overcommit/hook/post_checkout/base.rb | # frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::PostCheckout
# Functionality common to all post-checkout hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context,
:previous_head, :new_head, :branch_checkout?, :file_checkout?
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/index_tags.rb | lib/overcommit/hook/post_checkout/index_tags.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/index_tags'
module Overcommit::Hook::PostCheckout
# Updates ctags index for all source code in the repository.
#
# @see Overcommit::Hook::Shared::IndexTags
class IndexTags < Base
include Overcommit::Hook::Shared::IndexTags
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/composer_install.rb | lib/overcommit/hook/post_checkout/composer_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/composer_install'
module Overcommit::Hook::PostCheckout
# Runs `composer install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::ComposerInstall
class ComposerInstall < Base
include Overcommit... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_checkout/bower_install.rb | lib/overcommit/hook/post_checkout/bower_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/bower_install'
module Overcommit::Hook::PostCheckout
# Runs `bower install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::BowerInstall
class BowerInstall < Base
include Overcommit::Hook::Shar... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/pronto.rb | lib/overcommit/hook/shared/pronto.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all Pronto hooks. Runs pronto linters.
# @see https://github.com/prontolabs/pronto
module Pronto
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.include?('E') ? :error : :warning
end
MESSAGE_REGEX = /^(?<file... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/submodule_status.rb | lib/overcommit/hook/shared/submodule_status.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all `SubmoduleStatus` hooks to notify the user if any
# submodules are uninitialized, out of date with the current index, or contain
# merge conflicts.
module SubmoduleStatus
def run
messages = []
submodule_stat... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/npm_install.rb | lib/overcommit/hook/shared/npm_install.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all NpmInstall hooks. Runs `npm install` when a change
# is detected in the repository's dependencies.
#
# @see https://www.npmjs.com/
module NpmInstall
def run
result = execute(command)
return :fail, result.s... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/yarn_install.rb | lib/overcommit/hook/shared/yarn_install.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all YarnInstall hooks. Runs `yarn install` when a change
# is detected in the repository's dependencies.
#
# @see https://yarnpkg.com/
module YarnInstall
def run
result = execute(command)
return :fail, result.... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/rake_target.rb | lib/overcommit/hook/shared/rake_target.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# runs specified rake targets. It fails on the first non-
# successful exit.
#
module RakeTarget
def run
targets = config['targets']
if Array(targets).empty?
raise 'RakeTarget: targets parameter is empty. Add at least one ta... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/bundle_install.rb | lib/overcommit/hook/shared/bundle_install.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all BundleInstall hooks. Runs `bundle install` when a
# change is detected in the repository's dependencies.
#
# @see http://bundler.io/
module BundleInstall
def run
result = execute(command)
return :fail, res... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/r_spec.rb | lib/overcommit/hook/shared/r_spec.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Runs `rspec` test suite before push
#
# @see http://rspec.info/
module RSpec
def run
result = if @config['include']
execute(command, args: applicable_files)
else
execute(command)
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/index_tags.rb | lib/overcommit/hook/shared/index_tags.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all IndexTags hooks. It runs ctags in the background so
# your tag definitions are up-to-date.
#
# @see http://ctags.sourceforge.net/
module IndexTags
def run
execute_in_background([Overcommit::Utils.script_path('in... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/composer_install.rb | lib/overcommit/hook/shared/composer_install.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all ComposerInstall hooks. Runs `composer install` when
# a change is detected in the repository's dependencies.
#
# @see https://getcomposer.org/
module ComposerInstall
def run
result = execute(command)
retur... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/shared/bower_install.rb | lib/overcommit/hook/shared/bower_install.rb | # frozen_string_literal: true
module Overcommit::Hook::Shared
# Shared code used by all BowerInstall hooks. Runs `bower install` when a
# change is detected in the repository's dependencies.
#
# @see http://bower.io/
module BowerInstall
def run
result = execute(command)
return :fail, result.s... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_loader/plugin_hook_loader.rb | lib/overcommit/hook_loader/plugin_hook_loader.rb | # frozen_string_literal: true
require 'digest'
module Overcommit::HookLoader
# Responsible for loading hooks that are specific to the repository Overcommit
# is running in.
class PluginHookLoader < Base
def load_hooks
check_for_modified_plugins if @config.verify_signatures?
hooks = plugin_paths... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_loader/built_in_hook_loader.rb | lib/overcommit/hook_loader/built_in_hook_loader.rb | # frozen_string_literal: true
module Overcommit::HookLoader
# Responsible for loading hooks that ship with Overcommit.
class BuiltInHookLoader < Base
def load_hooks
@config.enabled_builtin_hooks(@context).map do |hook_name|
underscored_hook_name = Overcommit::Utils.snake_case(hook_name)
r... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_loader/base.rb | lib/overcommit/hook_loader/base.rb | # frozen_string_literal: true
module Overcommit::HookLoader
# Responsible for loading hooks from a file.
class Base
# @param config [Overcommit::Configuration]
# @param context [Overcommit::HookContext]
# @param logger [Overcommit::Logger]
def initialize(config, context, logger)
@config = con... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/utils/file_utils.rb | lib/overcommit/utils/file_utils.rb | # frozen_string_literal: true
require 'overcommit/os'
require 'overcommit/subprocess'
module Overcommit::Utils
# Utility functions for file IO.
module FileUtils
class << self
# When the host OS is Windows, uses the `mklink` command to create an
# NTFS symbolic link from `new_name` to `old_name`. O... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/utils/messages_utils.rb | lib/overcommit/utils/messages_utils.rb | # frozen_string_literal: true
module Overcommit::Utils
# Utility to process messages
module MessagesUtils
class << self
# Extract file, line number, and type of message from an error/warning
# messages in output.
#
# Assumes each element of `output` is a separate error/warning with all
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/diff.rb | lib/overcommit/hook_context/diff.rb | # frozen_string_literal: true
require 'overcommit/git_repo'
require 'set'
module Overcommit::HookContext
# Simulates a pre-commit context based on the diff with another git ref.
#
# This results in pre-commit hooks running against the changes between the current
# and another ref, which is useful for automat... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/pre_push.rb | lib/overcommit/hook_context/pre_push.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by pre-push hooks.
class PrePush < Base
attr_accessor :args
def remote_name
@args[0]
end
def remote_url
@args[1]
end
def remote_ref_deletion?
return @r... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/pre_commit.rb | lib/overcommit/hook_context/pre_commit.rb | # frozen_string_literal: true
require 'fileutils'
require 'set'
require_relative 'helpers/stash_unstaged_changes'
require_relative 'helpers/file_modifications'
module Overcommit::HookContext
# Contains helpers related to contextual information used by pre-commit hooks.
#
# This includes staged files, which line... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/post_checkout.rb | lib/overcommit/hook_context/post_checkout.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by post-checkout
# hooks.
class PostCheckout < Base
# Returns the ref of the HEAD that we transitioned from.
def previous_head
@args[0]
end
# Returns the ref of the new cu... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/base.rb | lib/overcommit/hook_context/base.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to the context with which a hook is being run.
#
# It acts as an adapter to the arguments passed to the hook, as well as
# context-specific information such as staged files, providing a single source
# of truth for this c... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/post_merge.rb | lib/overcommit/hook_context/post_merge.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by post-merge
# hooks.
class PostMerge < Base
attr_accessor :args
# Get a list of files that were added, copied, or modified in the merge
# commit. Renames and deletions are ignored,... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/post_rewrite.rb | lib/overcommit/hook_context/post_rewrite.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers for contextual information used by post-rewrite hooks.
class PostRewrite < Base
# Returns whether this post-rewrite was triggered by `git commit --amend`.
#
# @return [true,false]
def amend?
@args[0] == 'amend'
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/commit_msg.rb | lib/overcommit/hook_context/commit_msg.rb | # frozen_string_literal: true
require_relative 'pre_commit'
require_relative 'helpers/stash_unstaged_changes'
require_relative 'helpers/file_modifications'
module Overcommit::HookContext
# Contains helpers related to contextual information used by commit-msg hooks.
class CommitMsg < Base
include Overcommit::H... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/post_commit.rb | lib/overcommit/hook_context/post_commit.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by post-commit
# hooks.
class PostCommit < Base
# Get a list of files that were added, copied, or modified in the last
# commit. Renames and deletions are ignored, since there should be ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/prepare_commit_msg.rb | lib/overcommit/hook_context/prepare_commit_msg.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by prepare-commit-msg
# hooks.
class PrepareCommitMsg < Base
# Returns the name of the file that contains the commit log message
def commit_message_filename
@args[0]
end
#... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/pre_rebase.rb | lib/overcommit/hook_context/pre_rebase.rb | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by pre-rebase
# hooks.
class PreRebase < Base
# Returns the name of the branch we are rebasing onto.
def upstream_branch
@args[0]
end
# Returns the name of the branch bein... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/run_all.rb | lib/overcommit/hook_context/run_all.rb | # frozen_string_literal: true
require 'set'
module Overcommit::HookContext
# Simulates a pre-commit context pretending that all files have been changed.
#
# This results in pre-commit hooks running against the entire repository,
# which is useful for automated CI scripts.
class RunAll < Base
def modifie... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/helpers/file_modifications.rb | lib/overcommit/hook_context/helpers/file_modifications.rb | # frozen_string_literal: true
module Overcommit::HookContext
module Helpers
# This module contains methods for determining what files were changed and on what unique line
# numbers did the change occur.
module FileModifications
# Returns whether this hook run was triggered by `git commit --amend`
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook_context/helpers/stash_unstaged_changes.rb | lib/overcommit/hook_context/helpers/stash_unstaged_changes.rb | # frozen_string_literal: true
module Overcommit::HookContext
module Helpers
# This module contains behavior for stashing unstaged changes before hooks are ran and restoring
# them afterwards
module StashUnstagedChanges
# Stash unstaged contents of files so hooks don't see changes that aren't
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/helper.rb | test/helper.rb | # frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
require "minitest/autorun"
require "mocha/minitest"
$VERBOSE = true
ENV["DRIVER"] ||= "ruby"
require "redis"
Redis.silence_deprecations = true
require "redis/distributed"
require_relative "support/redis_mock"
if ENV["DRIVER"] ... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/support/redis_mock.rb | test/support/redis_mock.rb | # frozen_string_literal: true
require "socket"
module RedisMock
class Server
def initialize(options = {})
tcp_server = TCPServer.new(options[:host] || "127.0.0.1", 0)
tcp_server.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)
@concurrent = options.delete(:concurrent)
if opti... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/sentinel/sentinel_command_test.rb | test/sentinel/sentinel_command_test.rb | # frozen_string_literal: true
require "helper"
# @see https://redis.io/topics/sentinel#sentinel-commands Sentinel commands
class SentinelCommandsTest < Minitest::Test
include Helper::Sentinel
def test_sentinel_command_master
wait_for_quorum
redis = build_sentinel_client
result = redis.sentinel('mast... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/sentinel/sentinel_test.rb | test/sentinel/sentinel_test.rb | # frozen_string_literal: true
require "helper"
class SentinelTest < Minitest::Test
include Helper::Sentinel
def test_sentinel_master_role_connection
wait_for_quorum
actual = redis.role
assert_equal 'master', actual[0]
end
def test_sentinel_slave_role_connection
wait_for_quorum
redis =... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/authentication.rb | test/lint/authentication.rb | # frozen_string_literal: true
module Lint
module Authentication
def test_auth_with_password
mock(auth: ->(*_) { '+OK' }) do |r|
assert_equal 'OK', r.auth('mysecret')
end
mock(auth: ->(*_) { '-ERR some error' }) do |r|
assert_raises(Redis::BaseError) { r.auth('mysecret') }
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/hyper_log_log.rb | test/lint/hyper_log_log.rb | # frozen_string_literal: true
module Lint
module HyperLogLog
def test_pfadd
assert_equal true, r.pfadd("foo", "s1")
assert_equal true, r.pfadd("foo", "s2")
assert_equal false, r.pfadd("foo", "s1")
assert_equal 2, r.pfcount("foo")
end
def test_variadic_pfadd
assert_equal tr... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/sets.rb | test/lint/sets.rb | # frozen_string_literal: true
module Lint
module Sets
def test_sadd
assert_equal 1, r.sadd("foo", "s1")
assert_equal 1, r.sadd("foo", "s2")
assert_equal 0, r.sadd("foo", "s1")
assert_equal ["s1", "s2"], r.smembers("foo").sort
end
def test_sadd?
assert_equal true, r.sadd?("... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/hashes.rb | test/lint/hashes.rb | # frozen_string_literal: true
module Lint
module Hashes
def test_hset_and_hget
assert_equal 1, r.hset("foo", "f1", "s1")
assert_equal "s1", r.hget("foo", "f1")
end
def test_variadic_hset
assert_equal 2, r.hset("foo", "f1", "s1", "f2", "s2")
assert_equal "s1", r.hget("foo", "f1"... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/strings.rb | test/lint/strings.rb | # frozen_string_literal: true
module Lint
module Strings
def mock(*args, &block)
redis_mock(*args, &block)
end
def test_set_and_get
r.set("foo", "s1")
assert_equal "s1", r.get("foo")
end
def test_set_and_get_with_newline_characters
r.set("foo", "1\n")
assert_equa... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/blocking_commands.rb | test/lint/blocking_commands.rb | # frozen_string_literal: true
module Lint
module BlockingCommands
def setup
super
r.rpush('{zap}foo', 's1')
r.rpush('{zap}foo', 's2')
r.rpush('{zap}bar', 's1')
r.rpush('{zap}bar', 's2')
r.zadd('{szap}foo', %w[0 a 1 b 2 c])
r.zadd('{szap}bar', %w[0 c 1 d 2 e])
end
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/streams.rb | test/lint/streams.rb | # frozen_string_literal: true
module Lint
module Streams
MIN_REDIS_VERSION = '4.9.0'
ENTRY_ID_FORMAT = /\d+-\d+/.freeze
def setup
super
omit_version(MIN_REDIS_VERSION)
end
def test_xinfo_with_stream_subcommand
redis.xadd('s1', { f: 'v1' })
redis.xadd('s1', { f: 'v2' })
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/sorted_sets.rb | test/lint/sorted_sets.rb | # frozen_string_literal: true
module Lint
module SortedSets
def test_zadd
assert_equal 0, r.zcard("foo")
assert_equal true, r.zadd("foo", 1, "s1")
assert_equal false, r.zadd("foo", 1, "s1")
assert_equal 1, r.zcard("foo")
r.del "foo"
# XX option
assert_equal 0, r.zcard("... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/lists.rb | test/lint/lists.rb | # frozen_string_literal: true
module Lint
module Lists
def test_lmove
target_version "6.2" do
r.lpush("foo", "s1")
r.lpush("foo", "s2") # foo = [s2, s1]
r.lpush("bar", "s3")
r.lpush("bar", "s4") # bar = [s4, s3]
assert_nil r.lmove("nonexistent", "foo", "LEFT", "LEFT... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/lint/value_types.rb | test/lint/value_types.rb | # frozen_string_literal: true
module Lint
module ValueTypes
def test_exists
assert_equal 0, r.exists("foo")
r.set("foo", "s1")
assert_equal 1, r.exists("foo")
assert_equal 1, r.exists(["foo"])
end
def test_variadic_exists
assert_equal 0, r.exists("{1}foo", "{1}bar")
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/remote_server_control_commands_test.rb | test/redis/remote_server_control_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestRemoteServerControlCommands < Minitest::Test
include Helper::Client
def test_info
keys = [
"redis_version",
"uptime_in_seconds",
"uptime_in_days",
"connected_clients",
"used_memory",
"total_connections_received",
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/thread_safety_test.rb | test/redis/thread_safety_test.rb | # frozen_string_literal: true
require "helper"
class TestThreadSafety < Minitest::Test
include Helper::Client
def test_thread_safety
redis = Redis.new(OPTIONS)
redis.set "foo", 1
redis.set "bar", 2
sample = 100
t1 = Thread.new do
@foos = Array.new(sample) { redis.get "foo" }
end
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_sorted_sets_test.rb | test/redis/commands_on_sorted_sets_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsOnSortedSets < Minitest::Test
include Helper::Client
include Lint::SortedSets
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/scripting_test.rb | test/redis/scripting_test.rb | # frozen_string_literal: true
require "helper"
class TestScripting < Minitest::Test
include Helper::Client
def to_sha(script)
r.script(:load, script)
end
def test_script_exists
a = to_sha("return 1")
b = a.succ
assert_equal true, r.script(:exists, a)
assert_equal false, r.script(:exists... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/error_replies_test.rb | test/redis/error_replies_test.rb | # frozen_string_literal: true
require "helper"
class TestErrorReplies < Minitest::Test
include Helper::Client
# Every test shouldn't disconnect from the server. Also, when error replies are
# in play, the protocol should never get into an invalid state where there are
# pending replies in the connection. Cal... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/sorting_test.rb | test/redis/sorting_test.rb | # frozen_string_literal: true
require "helper"
class TestSorting < Minitest::Test
include Helper::Client
def test_sort
r.set("foo:1", "s1")
r.set("foo:2", "s2")
r.rpush("bar", "1")
r.rpush("bar", "2")
assert_equal ["s1"], r.sort("bar", get: "foo:*", limit: [0, 1])
assert_equal ["s2"], r... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/internals_test.rb | test/redis/internals_test.rb | # frozen_string_literal: true
require "helper"
class TestInternals < Minitest::Test
include Helper::Client
def test_large_payload
# see: https://github.com/redis/redis-rb/issues/962
# large payloads will trigger write_nonblock to write a portion
# of the payload in connection/ruby.rb _write_to_socket... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.