source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/jscs.rb | Ruby | mit | 3,997 | main | 795 | # 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?
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/golangci_lint.rb | Ruby | mit | 3,997 | main | 583 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/fix_me.rb | Ruby | mit | 3,997 | main | 414 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/coffee_lint.rb | Ruby | mit | 3,997 | main | 851 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/line_endings.rb | Ruby | mit | 3,997 | main | 1,974 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/go_lint.rb | Ruby | mit | 3,997 | main | 749 | # 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
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/hard_tabs.rb | Ruby | mit | 3,997 | main | 327 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/w3c_css.rb | Ruby | mit | 3,997 | main | 1,905 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/rst_lint.rb | Ruby | mit | 3,997 | main | 728 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/reek.rb | Ruby | mit | 3,997 | main | 577 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/sorbet.rb | Ruby | mit | 3,997 | main | 628 | # 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 = /^(?<... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/berksfile_check.rb | Ruby | mit | 3,997 | main | 637 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/foodcritic.rb | Ruby | mit | 3,997 | main | 4,727 | # 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
# ------------------... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/standard.rb | Ruby | mit | 3,997 | main | 648 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/java_checkstyle.rb | Ruby | mit | 3,997 | main | 738 | # 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 ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/file_size.rb | Ruby | mit | 3,997 | main | 937 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/puppet_lint.rb | Ruby | mit | 3,997 | main | 677 | # 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|
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/ruby_syntax.rb | Ruby | mit | 3,997 | main | 686 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/rails_best_practices.rb | Ruby | mit | 3,997 | main | 833 | # 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>.... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/nginx_test.rb | Ruby | mit | 3,997 | main | 634 | # 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
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/author_name.rb | Ruby | mit | 3,997 | main | 674 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb | Ruby | mit | 3,997 | main | 2,230 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/xml_syntax.rb | Ruby | mit | 3,997 | main | 468 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/chamber_verification.rb | Ruby | mit | 3,997 | main | 1,199 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/author_email.rb | Ruby | mit | 3,997 | main | 725 | # 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])
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/scalastyle.rb | Ruby | mit | 3,997 | main | 809 | # 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+))... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/kt_lint.rb | Ruby | mit | 3,997 | main | 494 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/php_cs_fixer.rb | Ruby | mit | 3,997 | main | 1,377 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/erb_lint.rb | Ruby | mit | 3,997 | main | 490 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/html_tidy.rb | Ruby | mit | 3,997 | main | 799 | # 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):... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/forbidden_branches.rb | Ruby | mit | 3,997 | main | 641 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/css_lint.rb | Ruby | mit | 3,997 | main | 647 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/ruby_lint.rb | Ruby | mit | 3,997 | main | 590 | # 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
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/bundle_audit.rb | Ruby | mit | 3,997 | main | 633 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/bundle_outdated.rb | Ruby | mit | 3,997 | main | 882 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/yarn_install.rb | Ruby | mit | 3,997 | main | 340 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/index_tags.rb | Ruby | mit | 3,997 | main | 307 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/git_guilt.rb | Ruby | mit | 3,997 | main | 1,195 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/base.rb | Ruby | mit | 3,997 | main | 285 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/commitplease.rb | Ruby | mit | 3,997 | main | 380 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/bower_install.rb | Ruby | mit | 3,997 | main | 345 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/npm_install.rb | Ruby | mit | 3,997 | main | 335 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/bundle_install.rb | Ruby | mit | 3,997 | main | 350 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/submodule_status.rb | Ruby | mit | 3,997 | main | 395 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_commit/composer_install.rb | Ruby | mit | 3,997 | main | 360 | # 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::... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/index_tags.rb | Ruby | mit | 3,997 | main | 456 | # frozen_string_literal: true
require 'overcommit/hook/shared/index_tags'
module Overcommit::Hook::PostRewrite
# Updates ctags index for all source code in the repository.
#
# @see Overcommit::Hook::Shared::IndexTags
class IndexTags < Base
include Overcommit::Hook::Shared::IndexTags
def run
# I... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/bower_install.rb | Ruby | mit | 3,997 | main | 346 | # frozen_string_literal: true
require 'overcommit/hook/shared/bower_install'
module Overcommit::Hook::PostRewrite
# Runs `bower install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::BowerInstall
class BowerInstall < Base
include Overcommit::Hook::Share... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/npm_install.rb | Ruby | mit | 3,997 | main | 336 | # frozen_string_literal: true
require 'overcommit/hook/shared/npm_install'
module Overcommit::Hook::PostRewrite
# 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::NpmIn... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/base.rb | Ruby | mit | 3,997 | main | 283 | # frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::PostRewrite
# Functionality common to all post-rewrite hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context, :amend?, :rebase?, :rewritten_commits
end
end |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/yarn_install.rb | Ruby | mit | 3,997 | main | 341 | # frozen_string_literal: true
require 'overcommit/hook/shared/yarn_install'
module Overcommit::Hook::PostRewrite
# 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::Y... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/composer_install.rb | Ruby | mit | 3,997 | main | 361 | # frozen_string_literal: true
require 'overcommit/hook/shared/composer_install'
module Overcommit::Hook::PostRewrite
# Runs `composer install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::ComposerInstall
class ComposerInstall < Base
include Overcommit:... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/bundle_install.rb | Ruby | mit | 3,997 | main | 351 | # frozen_string_literal: true
require 'overcommit/hook/shared/bundle_install'
module Overcommit::Hook::PostRewrite
# Runs `bundle install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::BundleInstall
class BundleInstall < Base
include Overcommit::Hook::S... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_rewrite/submodule_status.rb | Ruby | mit | 3,997 | main | 396 | # frozen_string_literal: true
require 'overcommit/hook/shared/submodule_status'
module Overcommit::Hook::PostRewrite
# 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 SubmoduleSt... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/yarn_install.rb | Ruby | mit | 3,997 | main | 381 | # 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.... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/composer_install.rb | Ruby | mit | 3,997 | main | 397 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/r_spec.rb | Ruby | mit | 3,997 | main | 455 | # 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)
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/submodule_status.rb | Ruby | mit | 3,997 | main | 965 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/index_tags.rb | Ruby | mit | 3,997 | main | 363 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/pronto.rb | Ruby | mit | 3,997 | main | 848 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/rake_target.rb | Ruby | mit | 3,997 | main | 666 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/npm_install.rb | Ruby | mit | 3,997 | main | 380 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/bundle_install.rb | Ruby | mit | 3,997 | main | 385 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/shared/bower_install.rb | Ruby | mit | 3,997 | main | 380 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/base.rb | Ruby | mit | 3,997 | main | 509 | # 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?
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/yarn_install.rb | Ruby | mit | 3,997 | main | 342 | # 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::... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/index_tags.rb | Ruby | mit | 3,997 | main | 309 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/bower_install.rb | Ruby | mit | 3,997 | main | 347 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/bundle_install.rb | Ruby | mit | 3,997 | main | 352 | # 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::... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/npm_install.rb | Ruby | mit | 3,997 | main | 337 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/submodule_status.rb | Ruby | mit | 3,997 | main | 397 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_checkout/composer_install.rb | Ruby | mit | 3,997 | main | 362 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/single_line_subject.rb | Ruby | mit | 3,997 | main | 396 | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Ensures commit message subject lines are followed by a blank line.
class SingleLineSubject < Base
def run
return :pass if empty_message?
unless commit_message_lines[1].to_s.strip.empty?
return :warn, 'Subject should be one ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/hard_tabs.rb | Ruby | mit | 3,997 | main | 392 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/russian_novel.rb | Ruby | mit | 3,997 | main | 400 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/spell_check.rb | Ruby | mit | 3,997 | main | 1,242 | # frozen_string_literal: true
require 'tempfile'
module Overcommit::Hook::CommitMsg
# Checks the commit message for potential misspellings with `hunspell`.
#
# @see http://hunspell.sourceforge.net/
class SpellCheck < Base
Misspelling = Struct.new(:word, :suggestions)
MISSPELLING_REGEX = /^[&#]\s(?<wo... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/message_format.rb | Ruby | mit | 3,997 | main | 767 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/trailing_period.rb | Ruby | mit | 3,997 | main | 396 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/base.rb | Ruby | mit | 3,997 | main | 406 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/empty_message.rb | Ruby | mit | 3,997 | main | 266 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/gerrit_change_id.rb | Ruby | mit | 3,997 | main | 761 | # frozen_string_literal: true
module Overcommit::Hook::CommitMsg
# Ensures a Gerrit Change-Id line is included in the commit message.
#
# It may seem odd to do this here instead of in a prepare-commit-msg hook, but
# the reality is that if you want to _ensure_ the Change-Id is included then
# you need to do ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/text_width.rb | Ruby | mit | 3,997 | main | 1,489 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/commit_msg/capitalized_subject.rb | Ruby | mit | 3,997 | main | 684 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_rebase/base.rb | Ruby | mit | 3,997 | main | 364 | # 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?,
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_rebase/merged_commits.rb | Ruby | mit | 3,997 | main | 858 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/prepare_commit_msg/base.rb | Ruby | mit | 3,997 | main | 760 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/prepare_commit_msg/replace_branch.rb | Ruby | mit | 3,997 | main | 2,550 | # 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 ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/bower_install.rb | Ruby | mit | 3,997 | main | 344 | # frozen_string_literal: true
require 'overcommit/hook/shared/bower_install'
module Overcommit::Hook::PostMerge
# 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:... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/npm_install.rb | Ruby | mit | 3,997 | main | 334 | # frozen_string_literal: true
require 'overcommit/hook/shared/npm_install'
module Overcommit::Hook::PostMerge
# 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::NpmInst... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/bundle_install.rb | Ruby | mit | 3,997 | main | 349 | # frozen_string_literal: true
require 'overcommit/hook/shared/bundle_install'
module Overcommit::Hook::PostMerge
# Runs `bundle install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::BundleInstall
class BundleInstall < Base
include Overcommit::Hook::Sha... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/index_tags.rb | Ruby | mit | 3,997 | main | 306 | # frozen_string_literal: true
require 'overcommit/hook/shared/index_tags'
module Overcommit::Hook::PostMerge
# 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/base.rb | Ruby | mit | 3,997 | main | 291 | # frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::PostMerge
# Functionality common to all post-merge hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context, :modified_lines_in_file, :squash?, :merge_commit?
end
end |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/submodule_status.rb | Ruby | mit | 3,997 | main | 394 | # frozen_string_literal: true
require 'overcommit/hook/shared/submodule_status'
module Overcommit::Hook::PostMerge
# 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 SubmoduleStat... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/yarn_install.rb | Ruby | mit | 3,997 | main | 339 | # frozen_string_literal: true
require 'overcommit/hook/shared/yarn_install'
module Overcommit::Hook::PostMerge
# 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::Yar... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/post_merge/composer_install.rb | Ruby | mit | 3,997 | main | 359 | # frozen_string_literal: true
require 'overcommit/hook/shared/composer_install'
module Overcommit::Hook::PostMerge
# Runs `composer install` when a change is detected in the repository's
# dependencies.
#
# @see Overcommit::Hook::Shared::ComposerInstall
class ComposerInstall < Base
include Overcommit::H... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_loader/built_in_hook_loader.rb | Ruby | mit | 3,997 | main | 456 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_loader/plugin_hook_loader.rb | Ruby | mit | 3,997 | main | 2,977 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_loader/base.rb | Ruby | mit | 3,997 | main | 1,442 | # 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... |
github | redis/redis-rb | https://github.com/redis/redis-rb | redis.gemspec | Ruby | mit | 3,989 | master | 1,153 | # frozen_string_literal: true
require "./lib/redis/version"
Gem::Specification.new do |s|
s.name = "redis"
s.version = Redis::VERSION
s.homepage = "https://github.com/redis/redis-rb"
s.summary = "A Ruby client library for Redis"
s.description = <<-EOS
A Ruby client that tries to match Redis' API one... |
github | redis/redis-rb | https://github.com/redis/redis-rb | Rakefile | Ruby | mit | 3,989 | master | 1,004 | # frozen_string_literal: true
require 'bundler/gem_tasks'
Bundler::GemHelper.install_tasks(dir: "cluster", name: "redis-clustering")
require 'rake/testtask'
namespace :test do
groups = %i(redis distributed sentinel)
groups.each do |group|
Rake::TestTask.new(group) do |t|
t.libs << "test"
t.libs <... |
github | redis/redis-rb | https://github.com/redis/redis-rb | cluster/redis-clustering.gemspec | Ruby | mit | 3,989 | master | 1,387 | # frozen_string_literal: true
require_relative "../lib/redis/version"
Gem::Specification.new do |s|
s.name = "redis-clustering"
s.version = Redis::VERSION
github_root = "https://github.com/redis/redis-rb"
s.homepage = "#{github_root}/blob/master/cluster"
s.summary = "A Ruby client library for Redis Clust... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.