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_context/pre_push.rb | Ruby | mit | 3,997 | main | 2,235 | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by pre-push hooks.
class PrePush < Base
attr_accessor :args
def remote_name
@args[0]
end
def remote_url
@args[1]
end
def remote_ref_deletion?
return @r... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/post_merge.rb | Ruby | mit | 3,997 | main | 1,143 | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by post-merge
# hooks.
class PostMerge < Base
attr_accessor :args
# Get a list of files that were added, copied, or modified in the merge
# commit. Renames and deletions are ignored,... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/run_all.rb | Ruby | mit | 3,997 | main | 1,075 | # frozen_string_literal: true
require 'set'
module Overcommit::HookContext
# Simulates a pre-commit context pretending that all files have been changed.
#
# This results in pre-commit hooks running against the entire repository,
# which is useful for automated CI scripts.
class RunAll < Base
def modifie... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/pre_commit.rb | Ruby | mit | 3,997 | main | 640 | # frozen_string_literal: true
require 'fileutils'
require 'set'
require_relative 'helpers/stash_unstaged_changes'
require_relative 'helpers/file_modifications'
module Overcommit::HookContext
# Contains helpers related to contextual information used by pre-commit hooks.
#
# This includes staged files, which line... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/post_rewrite.rb | Ruby | mit | 3,997 | main | 1,457 | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers for contextual information used by post-rewrite hooks.
class PostRewrite < Base
# Returns whether this post-rewrite was triggered by `git commit --amend`.
#
# @return [true,false]
def amend?
@args[0] == 'amend'
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/post_commit.rb | Ruby | mit | 3,997 | main | 1,128 | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by post-commit
# hooks.
class PostCommit < Base
# Get a list of files that were added, copied, or modified in the last
# commit. Renames and deletions are ignored, since there should be ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/commit_msg.rb | Ruby | mit | 3,997 | main | 1,525 | # frozen_string_literal: true
require_relative 'pre_commit'
require_relative 'helpers/stash_unstaged_changes'
require_relative 'helpers/file_modifications'
module Overcommit::HookContext
# Contains helpers related to contextual information used by commit-msg hooks.
class CommitMsg < Base
include Overcommit::H... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/prepare_commit_msg.rb | Ruby | mit | 3,997 | main | 1,145 | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by prepare-commit-msg
# hooks.
class PrepareCommitMsg < Base
# Returns the name of the file that contains the commit log message
def commit_message_filename
@args[0]
end
#... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/post_checkout.rb | Ruby | mit | 3,997 | main | 969 | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to contextual information used by post-checkout
# hooks.
class PostCheckout < Base
# Returns the ref of the HEAD that we transitioned from.
def previous_head
@args[0]
end
# Returns the ref of the new cu... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/base.rb | Ruby | mit | 3,997 | main | 4,386 | # frozen_string_literal: true
module Overcommit::HookContext
# Contains helpers related to the context with which a hook is being run.
#
# It acts as an adapter to the arguments passed to the hook, as well as
# context-specific information such as staged files, providing a single source
# of truth for this c... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/helpers/file_modifications.rb | Ruby | mit | 3,997 | main | 2,886 | # frozen_string_literal: true
module Overcommit::HookContext
module Helpers
# This module contains methods for determining what files were changed and on what unique line
# numbers did the change occur.
module FileModifications
# Returns whether this hook run was triggered by `git commit --amend`
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook_context/helpers/stash_unstaged_changes.rb | Ruby | mit | 3,997 | main | 5,462 | # frozen_string_literal: true
module Overcommit::HookContext
module Helpers
# This module contains behavior for stashing unstaged changes before hooks are ran and restoring
# them afterwards
module StashUnstagedChanges
# Stash unstaged contents of files so hooks don't see changes that aren't
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/utils/messages_utils.rb | Ruby | mit | 3,997 | main | 2,996 | # frozen_string_literal: true
module Overcommit::Utils
# Utility to process messages
module MessagesUtils
class << self
# Extract file, line number, and type of message from an error/warning
# messages in output.
#
# Assumes each element of `output` is a separate error/warning with all
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/utils/file_utils.rb | Ruby | mit | 3,997 | main | 2,243 | # frozen_string_literal: true
require 'overcommit/os'
require 'overcommit/subprocess'
module Overcommit::Utils
# Utility functions for file IO.
module FileUtils
class << self
# When the host OS is Windows, uses the `mklink` command to create an
# NTFS symbolic link from `new_name` to `old_name`. O... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/base.rb | Ruby | mit | 3,997 | main | 8,652 | # frozen_string_literal: true
require 'forwardable'
require 'overcommit/message_processor'
# Container for top-level hook-related classes and constants.
module Overcommit::Hook
# Helper containing metadata about error/warning messages returned by hooks.
Message = Struct.new(:type, :file, :line, :content) do
d... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/mix_test.rb | Ruby | mit | 3,997 | main | 354 | # 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
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/pytest.rb | Ruby | mit | 3,997 | main | 345 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/pronto.rb | Ruby | mit | 3,997 | main | 248 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/python_nose.rb | Ruby | mit | 3,997 | main | 349 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/test_unit.rb | Ruby | mit | 3,997 | main | 352 | # 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
[:... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/base.rb | Ruby | mit | 3,997 | main | 762 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/protected_branches.rb | Ruby | mit | 3,997 | main | 1,789 | # 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 =... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/php_unit.rb | Ruby | mit | 3,997 | main | 330 | # 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
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/r_spec.rb | Ruby | mit | 3,997 | main | 240 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/golangci_lint.rb | Ruby | mit | 3,997 | main | 338 | # 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]
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/go_test.rb | Ruby | mit | 3,997 | main | 298 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/cargo_test.rb | Ruby | mit | 3,997 | main | 275 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/pub_test.rb | Ruby | mit | 3,997 | main | 366 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/brakeman.rb | Ruby | mit | 3,997 | main | 313 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/rake_target.rb | Ruby | mit | 3,997 | main | 267 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/minitest.rb | Ruby | mit | 3,997 | main | 431 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_push/flutter_test.rb | Ruby | mit | 3,997 | main | 400 | # 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?
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/code_spell_check.rb | Ruby | mit | 3,997 | main | 1,019 | # 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
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/go_fmt.rb | Ruby | mit | 3,997 | main | 416 | # 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?
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/html_hint.rb | Ruby | mit | 3,997 | main | 664 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/go_vet.rb | Ruby | mit | 3,997 | main | 659 | # 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?
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/pycodestyle.rb | Ruby | mit | 3,997 | main | 668 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/broken_symlinks.rb | Ruby | mit | 3,997 | main | 401 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for broken symlinks.
class BrokenSymlinks < Base
def run
broken_symlinks = applicable_files.
select { |file| Overcommit::Utils.broken_symlink?(file) }
if broken_symlinks.any?
return :fail, "Broken symlinks de... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/fasterer.rb | Ruby | mit | 3,997 | main | 557 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/pyflakes.rb | Ruby | mit | 3,997 | main | 806 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pyflakes` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pyflakes
class Pyflakes < Base
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):/.freeze
def run
result = execute(command, args: applic... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/flay.rb | Ruby | mit | 3,997 | main | 1,142 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `flay` against any modified files.
#
# @see https://github.com/seattlerb/flay
class Flay < Base
# Flay prints two kinds of messages:
#
# 1) IDENTICAL code found in :defn (mass*2 = MASS)
# file_path_1.rb:LINE_1
# file_pa... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/bundle_check.rb | Ruby | mit | 3,997 | main | 1,004 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/ts_lint.rb | Ruby | mit | 3,997 | main | 911 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `tslint` against modified TypeScript files.
# @see http://palantir.github.io/tslint/
class TsLint < Base
# example message:
# "src/file/anotherfile.ts[298, 1]: exceeds maximum line length of 140"
# or
# "ERROR: src/AccountCon... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/es_lint.rb | Ruby | mit | 3,997 | main | 1,301 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/js_lint.rb | Ruby | mit | 3,997 | main | 551 | # 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)
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/dogma.rb | Ruby | mit | 3,997 | main | 959 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `dogma` against any modified ex files.
#
# @see https://github.com/lpil/dogma
class Dogma < Base
def run
result = execute command
return :pass if result.success?
messages = []
# example message:
# == web... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/pydocstyle.rb | Ruby | mit | 3,997 | main | 608 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pydocstyle` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pydocstyle
class Pydocstyle < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.success?
outpu... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/base.rb | Ruby | mit | 3,997 | main | 455 | # 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_... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/yaml_syntax.rb | Ruby | mit | 3,997 | main | 764 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/case_conflicts.rb | Ruby | mit | 3,997 | main | 996 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for files that would conflict in case-insensitive filesystems
# Adapted from https://github.com/pre-commit/pre-commit-hooks
class CaseConflicts < Base
def run
repo_files = Set.new(applicable_files)
unless Overcommit::GitRe... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/slim_lint.rb | Ruby | mit | 3,997 | main | 590 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/travis_lint.rb | Ruby | mit | 3,997 | main | 383 | # 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?
[:... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/stylelint.rb | Ruby | mit | 3,997 | main | 648 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `stylelint` against any modified CSS file.
#
# @see https://github.com/stylelint/stylelint
class Stylelint < Base
# example of output:
# index.css: line 4, col 4, error - Expected indentation of 2 spaces (indentation)
MESSAGE_... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/mix_format.rb | Ruby | mit | 3,997 | main | 777 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `mix format --check-formatted` against any modified ex/heex/exs files.
#
# @see https://hexdocs.pm/mix/main/Mix.Tasks.Format.html
class MixFormat < Base
# example message:
# ** (Mix) mix format failed due to --check-formatted.
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/yard_coverage.rb | Ruby | mit | 3,997 | main | 2,949 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Class to check yard documentation coverage.
#
# Use option "min_coverage_percentage" in your YardCoverage configuration
# to set your desired documentation coverage percentage.
#
class YardCoverage < Base
def run
# Run a no-stats ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/ginkgo_focus.rb | Ruby | mit | 3,997 | main | 536 | # 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"),
/^... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/license_header.rb | Ruby | mit | 3,997 | main | 1,182 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/jsl.rb | Ruby | mit | 3,997 | main | 788 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/scalariform.rb | Ruby | mit | 3,997 | main | 599 | # 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,... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/pep257.rb | Ruby | mit | 3,997 | main | 596 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/mdl.rb | Ruby | mit | 3,997 | main | 874 | # 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.... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/yaml_lint.rb | Ruby | mit | 3,997 | main | 971 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `YAMLLint` against any modified YAML files.
#
# @see https://github.com/adrienverge/yamllint
class YamlLint < Base
MESSAGE_REGEX = /
^(?<file>.+)
:(?<line>\d+)
:(?<col>\d+)
:\s\[(?<type>\w+)\]
\s(?<msg>.+)... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/vint.rb | Ruby | mit | 3,997 | main | 561 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/pronto.rb | Ruby | mit | 3,997 | main | 250 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/haml_lint.rb | Ruby | mit | 3,997 | main | 591 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/php_cs.rb | Ruby | mit | 3,997 | main | 1,178 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `phpcs` against any modified PHP files.
class PhpCs < Base
# Parse `phpcs` csv mode output
MESSAGE_REGEX = /^\"(?<file>.+)\",(?<line>\d+),\d+,(?<type>.+),\"(?<msg>.+)\"/.freeze
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
'err... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/execute_permissions.rb | Ruby | mit | 3,997 | main | 2,808 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for files with execute permissions, which are usually not necessary
# in source code files (and are typically caused by a misconfigured editor
# assigning incorrect default permissions).
#
# Protip: if you have some files that you want... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/pylint.rb | Ruby | mit | 3,997 | main | 927 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pylint` against any modified Python files.
#
# @see http://www.pylint.org/
class Pylint < Base
MESSAGE_REGEX = /^(?<file>(?:\w:)?.+):(?<line>\d+):(?<type>[CEFRW])/.freeze
# Classify 'E' and 'F' message codes as errors,
# ever... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/chamber_security.rb | Ruby | mit | 3,997 | main | 443 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `chamber secure` against any modified Chamber settings files.
#
# @see https://github.com/thekompanee/chamber
class ChamberSecurity < Base
def run
result = execute(command, args: applicable_files)
return :pass if result.st... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb | Ruby | mit | 3,997 | main | 743 | # 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>.*)... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/image_optim.rb | Ruby | mit | 3,997 | main | 871 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for images that can be optimized with `image_optim`.
#
# @see https://github.com/toy/image_optim
class ImageOptim < Base
def run
result = execute(command, args: applicable_files)
return [:fail, result.stdout + result.stde... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/merge_conflicts.rb | Ruby | mit | 3,997 | main | 357 | # 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}"
... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/php_lint.rb | Ruby | mit | 3,997 | main | 1,369 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/pep8.rb | Ruby | mit | 3,997 | main | 647 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `pep8` against any modified Python files.
#
# @see https://pypi.python.org/pypi/pep8
class Pep8 < Base
def run
result = execute(command, args: applicable_files)
output = result.stdout.chomp
return :pass if result.suc... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/license_finder.rb | Ruby | mit | 3,997 | main | 425 | # 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 ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/w3c_html.rb | Ruby | mit | 3,997 | main | 1,879 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb | Ruby | mit | 3,997 | main | 387 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Checks for local paths in files and issues a warning
class LocalPathsInGemfile < Base
def run
result = execute(command, args: applicable_files)
unless result.stdout.empty?
return :warn, "Avoid pointing to local paths in Gem... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/trailing_whitespace.rb | Ruby | mit | 3,997 | main | 347 | # 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+)/,... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/php_stan.rb | Ruby | mit | 3,997 | main | 749 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/r_spec.rb | Ruby | mit | 3,997 | main | 242 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/solargraph.rb | Ruby | mit | 3,997 | main | 1,439 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/sqlint.rb | Ruby | mit | 3,997 | main | 657 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs 'sqlint' against any modified SQL files.
#
# @see https://github.com/purcell/sqlint
class Sqlint < Base
MESSAGE_REGEX = /(?<file>(?:\w:)?.+):(?<line>\d+):\d+:(?<type>\w+)/.freeze
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
t... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/semi_standard.rb | Ruby | mit | 3,997 | main | 658 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `semistandard` against any modified JavaScript files.
#
# @see https://github.com/Flet/semistandard
class SemiStandard < Base
MESSAGE_REGEX = /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+)/.freeze
def run
result = execute(command,... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/yarn_check.rb | Ruby | mit | 3,997 | main | 1,398 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Check if local yarn.lock matches package.json when either changes, unless
# yarn.lock is ignored by git.
#
# @see https://yarnpkg.com/en/docs/cli/check
class YarnCheck < Base
LOCK_FILE = 'yarn.lock'
# A lot of the errors returned by ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/scss_lint.rb | Ruby | mit | 3,997 | main | 1,470 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/dart_analyzer.rb | Ruby | mit | 3,997 | main | 624 | # 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 = ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/rake_target.rb | Ruby | mit | 3,997 | main | 269 | # 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 |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/credo.rb | Ruby | mit | 3,997 | main | 717 | # 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 ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/json_syntax.rb | Ruby | mit | 3,997 | main | 450 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/rubo_cop.rb | Ruby | mit | 3,997 | main | 910 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/chamber_compare.rb | Ruby | mit | 3,997 | main | 1,317 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `chamber compare` against a configurable set of namespaces.
#
# @see https://github.com/thekompanee/chamber/wiki/Git-Commit-Hooks#chamber-compare-pre-commit-hook
# rubocop:disable Metrics/MethodLength
class ChamberCompare < Base
def ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/swift_lint.rb | Ruby | mit | 3,997 | main | 527 | # 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 = ... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/python_flake8.rb | Ruby | mit | 3,997 | main | 947 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/shell_check.rb | Ruby | mit | 3,997 | main | 595 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/terraform_format.rb | Ruby | mit | 3,997 | main | 509 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/cook_style.rb | Ruby | mit | 3,997 | main | 928 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/xml_lint.rb | Ruby | mit | 3,997 | main | 617 | # 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)... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/js_hint.rb | Ruby | mit | 3,997 | main | 655 | # 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? &... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/hlint.rb | Ruby | mit | 3,997 | main | 786 | # 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... |
github | sds/overcommit | https://github.com/sds/overcommit | lib/overcommit/hook/pre_commit/hadolint.rb | Ruby | mit | 3,997 | main | 631 | # frozen_string_literal: true
module Overcommit::Hook::PreCommit
# Runs `hadolint` against any modified Dockefile files.
#
# @see http://hadolint.lukasmartinelli.ch/
class Hadolint < Base
def run
output = ''
success = true
# hadolint doesn't accept multiple arguments
applicable_fil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.