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/commit_msg/trailing_period.rb | lib/overcommit/hook/commit_msg/trailing_period.rb | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Ensures commit message subject lines do not have a trailing period
class TrailingPeriod < Base
def run
return :pass if empty_message?
if commit_message_lines.first.rstrip.end_with?('.')
return :warn, 'Please omit trailing p... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/commit_msg/hard_tabs.rb | lib/overcommit/hook/commit_msg/hard_tabs.rb | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Checks for hard tabs in commit messages.
class HardTabs < Base
def run
return :pass if empty_message?
# Catches hard tabs entered by the user (not auto-generated)
if commit_message.index(/\t/)
return :warn, "Don't use... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/commit_msg/text_width.rb | lib/overcommit/hook/commit_msg/text_width.rb | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Ensures the number of columns the subject and commit message lines occupy is
# under the preferred limits.
class TextWidth < Base
def run
return :pass if empty_message?
@errors = []
find_errors_in_subject(commit_message_li... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/commit_msg/base.rb | lib/overcommit/hook/commit_msg/base.rb | # frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::CommitMsg
# Functionality common to all commit-msg hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context, :empty_message?, :commit_message,
:update_commit_message, :commit_mess... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/commit_msg/message_format.rb | lib/overcommit/hook/commit_msg/message_format.rb | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Ensures the commit message follows a specific format.
class MessageFormat < Base
def run
error_msg = validate_pattern(commit_message_lines.join("\n"))
return :fail, error_msg if error_msg
:pass
end
private
def v... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/commit_msg/capitalized_subject.rb | lib/overcommit/hook/commit_msg/capitalized_subject.rb | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Ensures commit message subject lines start with a capital letter.
class CapitalizedSubject < Base
def run
return :pass if empty_message?
# Git treats the first non-empty line as the subject
subject = commit_message_lines.find... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/commit_msg/russian_novel.rb | lib/overcommit/hook/commit_msg/russian_novel.rb | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Checks for long commit messages (not good or bad--just fun to point out)
class RussianNovel < Base
RUSSIAN_NOVEL_LENGTH = 30
def run
if commit_message_lines.length >= RUSSIAN_NOVEL_LENGTH
return :warn, 'You seem to have autho... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/commit_msg/empty_message.rb | lib/overcommit/hook/commit_msg/empty_message.rb | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Checks that the commit message is not empty
class EmptyMessage < Base
def run
return :pass unless empty_message?
[:fail, 'Commit message should not be empty']
end
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/pronto.rb | lib/overcommit/hook/pre_push/pronto.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/pronto'
module Overcommit::Hook::PrePush
# Runs `pronto`
#
# @see https://github.com/mmozuras/pronto
class Pronto < Base
include Overcommit::Hook::Shared::Pronto
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/go_test.rb | lib/overcommit/hook/pre_push/go_test.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `go test ./...` command on prepush
class GoTest < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
[:fail, output]
end
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/python_nose.rb | lib/overcommit/hook/pre_push/python_nose.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `nose` test suite before push
#
# @see https://nose.readthedocs.io/en/latest/
class PythonNose < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
[:fai... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/test_unit.rb | lib/overcommit/hook/pre_push/test_unit.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `test-unit` test suite before push
#
# @see https://github.com/test-unit/test-unit
class TestUnit < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
[:... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/rake_target.rb | lib/overcommit/hook/pre_push/rake_target.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/rake_target'
module Overcommit::Hook::PrePush
# Runs rake targets
#
# @see Overcommit::Hook::Shared::RakeTarget
class RakeTarget < Base
include Overcommit::Hook::Shared::RakeTarget
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/php_unit.rb | lib/overcommit/hook/pre_push/php_unit.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `phpunit` test suite before push
#
# @see https://phpunit.de/
class PhpUnit < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
[:fail, output]
end
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/golangci_lint.rb | lib/overcommit/hook/pre_push/golangci_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs golangci-lint
#
# @see https://github.com/golangci/golangci-lint
class GolangciLint < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
[:fail, output]
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/r_spec.rb | lib/overcommit/hook/pre_push/r_spec.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/r_spec'
module Overcommit::Hook::PrePush
# Runs `rspec` test suite
#
# @see http://rspec.info/
class RSpec < Base
include Overcommit::Hook::Shared::RSpec
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/protected_branches.rb | lib/overcommit/hook/pre_push/protected_branches.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Prevents updates to specified branches.
# Accepts a 'destructive_only' option globally or per branch
# to only prevent destructive updates.
class ProtectedBranches < Base
def run
return :pass unless illegal_pushes.any?
messages =... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/pytest.rb | lib/overcommit/hook/pre_push/pytest.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `pytest` test suite before push
#
# @see https://github.com/pytest-dev/pytest
class Pytest < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
[:fail, o... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/base.rb | lib/overcommit/hook/pre_push/base.rb | # frozen_string_literal: true
require 'forwardable'
require 'overcommit/utils/messages_utils'
module Overcommit::Hook::PrePush
# Functionality common to all pre-push hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context, :remote_name, :remote_url, :pushed_refs
def ru... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/pub_test.rb | lib/overcommit/hook/pre_push/pub_test.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs Dart test suite (`pub run test`) before push
#
# @see https://pub.dev/packages/test#running-tests
class PubTest < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.s... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/flutter_test.rb | lib/overcommit/hook/pre_push/flutter_test.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs Flutter test suite (`flutter test`) before push
#
# @see https://api.flutter.dev/flutter/flutter_test/flutter_test-library.html
class FlutterTest < Base
def run
result = execute(command)
return :pass if result.success?
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/cargo_test.rb | lib/overcommit/hook/pre_push/cargo_test.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `cargo test` before push if Rust files changed
class CargoTest < Base
def run
result = execute(command)
return :pass if result.success?
[:fail, result.stdout]
end
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/minitest.rb | lib/overcommit/hook/pre_push/minitest.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `minitest` test suite before push
#
# @see https://github.com/seattlerb/minitest
class Minitest < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
[:fa... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/mix_test.rb | lib/overcommit/hook/pre_push/mix_test.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `mix test` test suite before push
#
# @see https://hexdocs.pm/mix/Mix.Tasks.Test.html
class MixTest < Base
def run
result = execute(command)
return :pass if result.success?
output = result.stdout + result.stderr
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_push/brakeman.rb | lib/overcommit/hook/pre_push/brakeman.rb | # frozen_string_literal: true
module Overcommit::Hook::PrePush
# Runs `brakeman` whenever Ruby/Rails files change.
#
# @see http://brakemanscanner.org/
class Brakeman < Base
def run
result = execute(command)
return :pass if result.success?
[:fail, result.stdout]
end
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_commit/submodule_status.rb | lib/overcommit/hook/post_commit/submodule_status.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/submodule_status'
module Overcommit::Hook::PostCommit
# 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 SubmoduleSta... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_commit/git_guilt.rb | lib/overcommit/hook/post_commit/git_guilt.rb | # frozen_string_literal: true
module Overcommit::Hook::PostCommit
# Calculates the change in blame since the last revision.
#
# @see https://www.npmjs.com/package/git-guilt
class GitGuilt < Base
PLUS_MINUS_REGEX = /^(.*?)(?:(\++)|(-+))$/.freeze
GREEN = 32
RED = 31
def run
return :pass if... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_commit/npm_install.rb | lib/overcommit/hook/post_commit/npm_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/npm_install'
module Overcommit::Hook::PostCommit
# 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::NpmIns... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_commit/yarn_install.rb | lib/overcommit/hook/post_commit/yarn_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/yarn_install'
module Overcommit::Hook::PostCommit
# 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::Ya... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_commit/bundle_install.rb | lib/overcommit/hook/post_commit/bundle_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/bundle_install'
module Overcommit::Hook::PostCommit
# Runs `bundle install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::BundleInstall
class BundleInstall < Base
include Overcommit::Hook::Sh... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_commit/commitplease.rb | lib/overcommit/hook/post_commit/commitplease.rb | # frozen_string_literal: true
module Overcommit::Hook::PostCommit
# Check that a commit message conforms to a certain style
#
# @see https://www.npmjs.com/package/commitplease
class Commitplease < Base
def run
result = execute(command)
output = result.stderr
return :pass if result.success... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/post_commit/base.rb | lib/overcommit/hook/post_commit/base.rb | # frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::PostCommit
# Functionality common to all post-commit hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context, :modified_lines_in_file, :initial_commit?
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_commit/index_tags.rb | lib/overcommit/hook/post_commit/index_tags.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/index_tags'
module Overcommit::Hook::PostCommit
# 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_commit/composer_install.rb | lib/overcommit/hook/post_commit/composer_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/composer_install'
module Overcommit::Hook::PostCommit
# 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_commit/bower_install.rb | lib/overcommit/hook/post_commit/bower_install.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/bower_install'
module Overcommit::Hook::PostCommit
# Runs `bower install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::BowerInstall
class BowerInstall < 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/prepare_commit_msg/base.rb | lib/overcommit/hook/prepare_commit_msg/base.rb | # frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::PrepareCommitMsg
# Functionality common to all prepare-commit-msg hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context,
:commit_message_filename, :commit_message_source, :comm... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/prepare_commit_msg/replace_branch.rb | lib/overcommit/hook/prepare_commit_msg/replace_branch.rb | # frozen_string_literal: true
module Overcommit::Hook::PrepareCommitMsg
# Prepends the commit message with a message based on the branch name.
#
# === What to prepend
#
# It's possible to reference parts of the branch name through the captures in
# the `branch_pattern` regex.
#
# For instance, if your ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/slim_lint.rb | lib/overcommit/hook/pre_commit/slim_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `slim-lint` against any modified Slim templates.
#
# @see https://github.com/sds/slim-lint
class SlimLint < Base
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.include?('W') ? :warning : :error
end
def run
result... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/jsl.rb | lib/overcommit/hook/pre_commit/jsl.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `jsl` against any modified JavaScript files.
#
# @see http://www.javascriptlint.com/
class Jsl < Base
MESSAGE_REGEX = /(?<file>(?:\w:)?.+)\((?<line>\d+)\):(?<type>[^:]+)/.freeze
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
ty... | 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_fmt.rb | lib/overcommit/hook/pre_commit/go_fmt.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs go fmt for all modified Go files
class GoFmt < Base
def run
errors = []
applicable_files.each do |file|
result = execute(command, args: [file])
errors << (result.stdout + result.stderr) unless result.success?
... | 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_email.rb | lib/overcommit/hook/pre_commit/author_email.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks the format of an author's email address.
class AuthorEmail < Base
def run
email =
if ENV.key?('GIT_AUTHOR_EMAIL')
ENV['GIT_AUTHOR_EMAIL']
else
result = execute(%w[git config --get user.email])
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/rst_lint.rb | lib/overcommit/hook/pre_commit/rst_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `rst-lint` against any modified reStructuredText files
#
# @see https://github.com/twolfson/restructuredtext-lint
class RstLint < Base
MESSAGE_REGEX = /
^(?<type>INFO|WARNING|ERROR|SEVERE)(?<file>(?:\w:)?[^:]+):(?<line>\d+)\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/pycodestyle.rb | lib/overcommit/hook/pre_commit/pycodestyle.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pycodestyle` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pycodestyle
class Pycodestyle < Base
def run
result = execute(command, args: applicable_files)
output = result.stdout.chomp
retur... | 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_outdated.rb | lib/overcommit/hook/pre_commit/bundle_outdated.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check if any gems in Gemfile.lock have newer versions, unless the
# Gemfile.lock is ignored by Git.
#
# @see http://bundler.io/bundle_outdated.html
class BundleOutdated < Base
LOCK_FILE = 'Gemfile.lock'
def run
# Ignore if Gemf... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/pronto.rb | lib/overcommit/hook/pre_commit/pronto.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/pronto'
module Overcommit::Hook::PreCommit
# Runs `pronto`
#
# @see https://github.com/mmozuras/pronto
class Pronto < Base
include Overcommit::Hook::Shared::Pronto
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/coffee_lint.rb | lib/overcommit/hook/pre_commit/coffee_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `coffeelint` against any modified CoffeeScript files.
#
# @see http://www.coffeelint.org/
class CoffeeLint < Base
MESSAGE_REGEX = /
^(?<file>.+)
,(?<line>\d*),\d*
,(?<type>\w+)
,(?<msg>.+)$
/x.freeze
ME... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb | lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
#
# Run's the Puppet metadata linter. It has support for adding options
# in the .overcommit.yaml
#
# @see https://voxpupuli.org/blog/2014/11/06/linting-metadata-json/
#
class PuppetMetadataJsonLint < Base
MESSAGE_REGEX = /\((?<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/rubo_cop.rb | lib/overcommit/hook/pre_commit/rubo_cop.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `rubocop` against any modified Ruby files.
#
# @see http://batsov.com/rubocop/
class RuboCop < Base
GENERIC_MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.match?(/^warn/) ? :warning : :error
end
COP_MESSAGE_TYPE_CATEGO... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/ginkgo_focus.rb | lib/overcommit/hook/pre_commit/ginkgo_focus.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check for "focused" tests
class GinkgoFocus < Base
def run
keywords = config['keywords']
result = execute(command, args: [keywords.join('|')] + applicable_files)
extract_messages(
result.stdout.split("\n"),
/^... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/es_lint.rb | lib/overcommit/hook/pre_commit/es_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `eslint` against any modified JavaScript files.
#
# Protip: if you have an npm script set up to run eslint, you can configure
# this hook to run eslint via your npm script by using the `command` option in
# your .overcommit.yml file. Thi... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/terraform_format.rb | lib/overcommit/hook/pre_commit/terraform_format.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs 'terraform fmt' against any modified *.tf files.
#
# @see https://www.terraform.io/docs/commands/fmt.html
class TerraformFormat < Base
def run
messages = []
applicable_files.each do |f|
result = execute(command, arg... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/jscs.rb | lib/overcommit/hook/pre_commit/jscs.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `jscs` (JavaScript Code Style Checker) against any modified JavaScript
# files.
#
# @see http://jscs.info/
class Jscs < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/puppet_lint.rb | lib/overcommit/hook/pre_commit/puppet_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs 'puppet-lint' against any modified Puppet files.
#
# @see http://puppet-lint.com/
class PuppetLint < Base
MESSAGE_REGEX = /(?<file>(?:\w:)?.+):(?<line>\d+):\d+:(?<type>\w+)/.freeze
MESSAGE_TYPE_CATEGORIZER = lambda do |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/fasterer.rb | lib/overcommit/hook/pre_commit/fasterer.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `fasterer` against any modified Ruby files.
#
# @see https://github.com/DamirSvrtan/fasterer
class Fasterer < Base
def run
result = execute(command, args: applicable_files)
output = result.stdout
if extract_offense_n... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/nginx_test.rb | lib/overcommit/hook/pre_commit/nginx_test.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `nginx -t` against any modified Nginx config files.
#
# @see https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/
class NginxTest < Base
MESSAGE_REGEX = /^nginx: .+ in (?<file>.+):(?<line>\d+)$/.freeze
def run
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/scalariform.rb | lib/overcommit/hook/pre_commit/scalariform.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `scalariform` against any modified Scala files.
#
# @see https://github.com/mdr/scalariform
class Scalariform < Base
MESSAGE_REGEX = /^\[(?<type>FAILED|ERROR)\]\s+(?<file>(?:\w:)?.+)/.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/python_flake8.rb | lib/overcommit/hook/pre_commit/python_flake8.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `flake8` against any modified Python files.
#
# @see https://pypi.python.org/pypi/flake8
class PythonFlake8 < Base
MESSAGE_REGEX = /^(?<file>(?:\w:)?.+):(?<line>\d+):\d+:\s(?<type>\w\d+)/.freeze
# Classify 'Exxx' and 'Fxxx' messag... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/reek.rb | lib/overcommit/hook/pre_commit/reek.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `reek` against any modified Ruby files.
#
# @see https://github.com/troessner/reek
class Reek < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
output = scrub_output(res... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/license_header.rb | lib/overcommit/hook/pre_commit/license_header.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for license headers in source files
class LicenseHeader < Base
def run
begin
license_contents = license_lines
rescue Errno::ENOENT
return :fail, "Unable to load license file #{license_file}"
end
m... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/pep257.rb | lib/overcommit/hook/pre_commit/pep257.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pep257` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pep257
class Pep257 < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
output = result.s... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/fix_me.rb | lib/overcommit/hook/pre_commit/fix_me.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check for "token" strings
class FixMe < Base
def run
keywords = config['keywords']
result = execute(command, args: [keywords.join('|')] + applicable_files)
extract_messages(
result.stdout.split("\n"),
/^(?<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_syntax.rb | lib/overcommit/hook/pre_commit/yaml_syntax.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks the syntax of any modified YAML files.
class YamlSyntax < Base
def run
messages = []
applicable_files.each do |file|
YAML.load_file(file, aliases: true)
rescue ArgumentError
begin
YAML.load_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/kt_lint.rb | lib/overcommit/hook/pre_commit/kt_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `ktlint` against modified Kotlin files.
# @see https://github.com/shyiko/ktlint
class KtLint < Base
MESSAGE_REGEX = /((?<file>[^:]+):(?<line>\d+):(\d+):(?<message>.+))/.freeze
def run
result = execute(command, args: applicable... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/license_finder.rb | lib/overcommit/hook/pre_commit/license_finder.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs LicenseFinder if any of your package manager declaration files have changed
# See more about LicenseFinder at https://github.com/pivotal/LicenseFinder
class LicenseFinder < Base
def run
result = execute(command)
return :pass ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/hlint.rb | lib/overcommit/hook/pre_commit/hlint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `hlint` against any modified Haskell files.
#
# @see https://github.com/ndmitchell/hlint
class Hlint < Base
MESSAGE_REGEX = /
^(?<file>(?:\w:)?[^:]+)
:(?<line>\d+)
:\d+
:\s*(?<type>\w+)
/x.freeze
MESSAG... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/cook_style.rb | lib/overcommit/hook/pre_commit/cook_style.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `cookstyle` against any modified Chef Ruby files.
#
# @see https://docs.chef.io/cookstyle.html
class CookStyle < Base
GENERIC_MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.match?(/^warn/) ? :warning : :error
end
COP_M... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/rake_target.rb | lib/overcommit/hook/pre_commit/rake_target.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/rake_target'
module Overcommit::Hook::PreCommit
# Runs rake targets
#
# @see Overcommit::Hook::Shared::RakeTarget
class RakeTarget < Base
include Overcommit::Hook::Shared::RakeTarget
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/html_hint.rb | lib/overcommit/hook/pre_commit/html_hint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `htmlhint` against any modified HTML files.
#
# @see http://htmlhint.com/
class HtmlHint < Base
def run
result = execute(command + applicable_files)
output = Overcommit::Utils.strip_color_codes(result.stdout.chomp)
m... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/swift_lint.rb | lib/overcommit/hook/pre_commit/swift_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `swiftlint lint` against modified Swift files.
# @see https://github.com/realm/SwiftLint
class SwiftLint < Base
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+)[^ ]* (?<type>[^ ]+):(?<message>.*)/.freeze
def run
result = ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/file_size.rb | lib/overcommit/hook/pre_commit/file_size.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for oversized files before committing.
class FileSize < Base
def run
return :pass if oversized_files.empty?
oversized_files.map do |file|
error_message_for(file)
end
end
def description
"Check 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/dart_analyzer.rb | lib/overcommit/hook/pre_commit/dart_analyzer.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `dartanalyzer` against modified Dart files.
# @see https://dart.dev/tools/dartanalyzer
class DartAnalyzer < Base
MESSAGE_REGEX = /(?<type>.*)•\ (?<message>[^•]+)•\ (?<file>[^:]+):(?<line>\d+):(\d+)\.*/.freeze
def run
result = ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/merge_conflicts.rb | lib/overcommit/hook/pre_commit/merge_conflicts.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for unresolved merge conflicts
class MergeConflicts < Base
def run
result = execute(command, args: applicable_files)
unless result.stdout.empty?
return :fail, "Merge conflict markers detected:\n#{result.stdout}"
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/html_tidy.rb | lib/overcommit/hook/pre_commit/html_tidy.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `tidy` against any modified HTML files.
#
# @see http://www.html-tidy.org/
class HtmlTidy < Base
MESSAGE_REGEX = /
^(?<file>(?:\w:)?[^:]+):\s
line\s(?<line>\d+)\s
column\s(?<col>\d+)\s-\s
(?<type>Error|Warning):... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/travis_lint.rb | lib/overcommit/hook/pre_commit/travis_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `travis-lint` against any modified Travis CI files.
#
# @see https://github.com/travis-ci/travis.rb
class TravisLint < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
[:... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/golangci_lint.rb | lib/overcommit/hook/pre_commit/golangci_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `golangci-lint run` against any modified packages
#
# @see https://github.com/golangci/golangci-lint
class GolangciLint < Base
def run
packages = applicable_files.map { |f| File.dirname(f) }.uniq
result = execute(command, 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/php_stan.rb | lib/overcommit/hook/pre_commit/php_stan.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `phpstan` against any modified PHP files.
# For running `phpstan` with Laravel, it requires setup with `ide_helper`.
#
# References:
# https://github.com/phpstan/phpstan/issues/239
# https://gist.github.com/edmondscommerce/89695c9cd258... | 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_vet.rb | lib/overcommit/hook/pre_commit/go_vet.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `go vet` against any modified Golang files.
#
# @see https://godoc.org/code.google.com/p/go-zh.tools/cmd/vet
class GoVet < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
... | 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_lint.rb | lib/overcommit/hook/pre_commit/ruby_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `ruby-lint` against any modified Ruby files.
#
# @see https://github.com/YorickPeterse/ruby-lint
class RubyLint < Base
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.include?('W') ? :warning : :error
end
def run
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/shell_check.rb | lib/overcommit/hook/pre_commit/shell_check.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `shellcheck` against any modified shell script files.
#
# @see http://www.shellcheck.net/
class ShellCheck < Base
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.include?('note') ? :warning : :error
end
def run
re... | 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_html.rb | lib/overcommit/hook/pre_commit/w3c_html.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `w3c_validators` against any modified HTML files.
#
# @see https://github.com/alexdunae/w3c_validators
class W3cHtml < Base
def run
collect_messages
rescue W3CValidators::ParsingError,
W3CValidators::ValidatorUnava... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/r_spec.rb | lib/overcommit/hook/pre_commit/r_spec.rb | # frozen_string_literal: true
require 'overcommit/hook/shared/r_spec'
module Overcommit::Hook::PreCommit
# Runs `rspec` test suite
#
# @see http://rspec.info/
class RSpec < Base
include Overcommit::Hook::Shared::RSpec
end
end
| ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/js_lint.rb | lib/overcommit/hook/pre_commit/js_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `jslint` against any modified JavaScript files.
#
# @see http://www.jslint.com/
class JsLint < Base
MESSAGE_REGEX = /(?<file>(?:\w:)?[^:]+):(?<line>\d+)/.freeze
def run
result = execute(command, args: applicable_files)
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/scss_lint.rb | lib/overcommit/hook/pre_commit/scss_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `scss-lint` against any modified SCSS files.
#
# @see https://github.com/sds/scss-lint
class ScssLint < Base
def run
result = execute(command, args: applicable_files)
# Status code 81 indicates the applicable files were al... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/vint.rb | lib/overcommit/hook/pre_commit/vint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `vint` against any modified Vim script files.
#
# @see https://github.com/Kuniwak/vint
class Vint < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
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/pre_commit/trailing_whitespace.rb | lib/overcommit/hook/pre_commit/trailing_whitespace.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for trailing whitespace in files.
class TrailingWhitespace < Base
def run
result = execute(command, args: applicable_files)
extract_messages(
result.stdout.split("\n"),
/^(?<file>(?:\w:)?[^:]+):(?<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/php_lint.rb | lib/overcommit/hook/pre_commit/php_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `php -l` against any modified PHP files.
class PhpLint < Base
# Sample String
# rubocop:disable Layout/LineLength
# PHP Parse error: syntax error, unexpected 'require_once' (T_REQUIRE_ONCE) in site/sumo.php on line 12
# rubo... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/json_syntax.rb | lib/overcommit/hook/pre_commit/json_syntax.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks the syntax of any modified JSON files.
class JsonSyntax < Base
def run
messages = []
applicable_files.each do |file|
JSON.parse(IO.read(file))
rescue JSON::ParserError => e
error = "#{e.message} parsing... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/hard_tabs.rb | lib/overcommit/hook/pre_commit/hard_tabs.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for hard tabs in files.
class HardTabs < Base
def run
result = execute(command, args: applicable_files)
extract_messages(
result.stdout.split("\n"),
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+)/,
)
end
e... | 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_lint.rb | lib/overcommit/hook/pre_commit/xml_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `xmllint` against any modified XML files.
#
# @see http://xmlsoft.org/xmllint.html
class XmlLint < Base
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):/.freeze
def run
result = execute(command, args: applicable_files)... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/haml_lint.rb | lib/overcommit/hook/pre_commit/haml_lint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `haml-lint` against any modified HAML files.
#
# @see https://github.com/brigade/haml-lint/
class HamlLint < Base
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
type.include?('W') ? :warning : :error
end
def run
resul... | 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_check.rb | lib/overcommit/hook/pre_commit/bundle_check.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check if local Gemfile.lock matches Gemfile when either changes, unless
# Gemfile.lock is ignored by git.
#
# @see http://bundler.io/
class BundleCheck < Base
LOCK_FILE = File.basename(ENV['BUNDLE_GEMFILE'] || 'Gemfile') + '.lock'
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/credo.rb | lib/overcommit/hook/pre_commit/credo.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `credo` against any modified ex files.
#
# @see https://github.com/rrrene/credo
class Credo < Base
# example message:
# lib/file1.ex:1:11: R: Modules should have a @moduledoc tag.
# lib/file2.ex:12:81: R: Line is too long (max ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/base.rb | lib/overcommit/hook/pre_commit/base.rb | # frozen_string_literal: true
require 'forwardable'
require 'overcommit/utils/messages_utils'
module Overcommit::Hook::PreCommit
# Functionality common to all pre-commit hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context, :modified_lines_in_file, :amendment?, :initial_... | 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_verification.rb | lib/overcommit/hook/pre_commit/chamber_verification.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `chamber sign --verify`.
#
# @see https://github.com/thekompanee/chamber/wiki/Git-Commit-Hooks#chamber-verification-pre-commit-hook
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
class ChamberVerification < B... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/solargraph.rb | lib/overcommit/hook/pre_commit/solargraph.rb | # frozen_string_literal: true
require 'overcommit'
require 'overcommit/hook/pre_commit/base'
module Overcommit
module Hook
module PreCommit
# Runs `solargraph typecheck` against any modified Ruby files.
#
# @see https://github.com/castwide/solargraph
class Solargraph < Base
MESSA... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/code_spell_check.rb | lib/overcommit/hook/pre_commit/code_spell_check.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `alfonsox` spell-checking tool against any modified code file.
#
# @see https://github.com/diegojromerolopez/alfonsox
class CodeSpellCheck < Base
def run
# Create default file config if it does not exist
# Run spell-check
... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/js_hint.rb | lib/overcommit/hook/pre_commit/js_hint.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `jshint` against any modified JavaScript files.
#
# @see http://jshint.com/
class JsHint < Base
def run
result = execute(command, args: applicable_files)
output = result.stdout.chomp
return :pass if result.success? &... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/mdl.rb | lib/overcommit/hook/pre_commit/mdl.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `mdl` against any modified Markdown files
#
# @see https://github.com/mivok/markdownlint
class Mdl < Base
def run
result = execute(command, args: applicable_files)
output = result.stdout.chomp
return :pass if result.... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/java_checkstyle.rb | lib/overcommit/hook/pre_commit/java_checkstyle.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `checkstyle` against any modified Java files.
#
# @see http://checkstyle.sourceforge.net/
class JavaCheckstyle < Base
MESSAGE_REGEX = /^(\[(?<type>[^\]]+)\]\s+)?(?<file>(?:\w:)?[^:]+):(?<line>\d+)/.freeze
MESSAGE_TYPE_CATEGORIZER ... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
sds/overcommit | https://github.com/sds/overcommit/blob/11838c67483be9f12580e271f83dfcb07ad62a2c/lib/overcommit/hook/pre_commit/line_endings.rb | lib/overcommit/hook/pre_commit/line_endings.rb | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for line endings in files.
#
# WARNING: Works with Git 2.10.0 or newer.
class LineEndings < Base
def run
messages = []
offending_files.map do |file_name|
file = File.open(file_name)
begin
messag... | ruby | MIT | 11838c67483be9f12580e271f83dfcb07ad62a2c | 2026-01-04T15:47:52.694838Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.