Showing preview only (984K chars total). Download the full file or copy to clipboard to get everything.
Repository: sds/overcommit
Branch: main
Commit: 11838c67483b
Files: 458
Total size: 877.0 KB
Directory structure:
gitextract_l2gjobnw/
├── .editorconfig
├── .git-hooks/
│ └── pre_commit/
│ └── master_hooks_match.rb
├── .github/
│ └── workflows/
│ ├── lint.yml
│ └── tests.yml
├── .gitignore
├── .overcommit.yml
├── .rubocop.yml
├── .rubocop_todo.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Gemfile
├── MIT-LICENSE
├── README.md
├── bin/
│ └── overcommit
├── config/
│ ├── default.yml
│ └── starter.yml
├── lib/
│ ├── overcommit/
│ │ ├── cli.rb
│ │ ├── command_splitter.rb
│ │ ├── configuration.rb
│ │ ├── configuration_loader.rb
│ │ ├── configuration_validator.rb
│ │ ├── constants.rb
│ │ ├── exceptions.rb
│ │ ├── git_config.rb
│ │ ├── git_repo.rb
│ │ ├── git_version.rb
│ │ ├── hook/
│ │ │ ├── base.rb
│ │ │ ├── commit_msg/
│ │ │ │ ├── base.rb
│ │ │ │ ├── capitalized_subject.rb
│ │ │ │ ├── empty_message.rb
│ │ │ │ ├── gerrit_change_id.rb
│ │ │ │ ├── hard_tabs.rb
│ │ │ │ ├── message_format.rb
│ │ │ │ ├── russian_novel.rb
│ │ │ │ ├── single_line_subject.rb
│ │ │ │ ├── spell_check.rb
│ │ │ │ ├── text_width.rb
│ │ │ │ └── trailing_period.rb
│ │ │ ├── post_checkout/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── post_commit/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── commitplease.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── git_guilt.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── post_merge/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── post_rewrite/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── pre_commit/
│ │ │ │ ├── author_email.rb
│ │ │ │ ├── author_name.rb
│ │ │ │ ├── base.rb
│ │ │ │ ├── berksfile_check.rb
│ │ │ │ ├── broken_symlinks.rb
│ │ │ │ ├── bundle_audit.rb
│ │ │ │ ├── bundle_check.rb
│ │ │ │ ├── bundle_outdated.rb
│ │ │ │ ├── case_conflicts.rb
│ │ │ │ ├── chamber_compare.rb
│ │ │ │ ├── chamber_security.rb
│ │ │ │ ├── chamber_verification.rb
│ │ │ │ ├── code_spell_check.rb
│ │ │ │ ├── coffee_lint.rb
│ │ │ │ ├── cook_style.rb
│ │ │ │ ├── credo.rb
│ │ │ │ ├── css_lint.rb
│ │ │ │ ├── dart_analyzer.rb
│ │ │ │ ├── dogma.rb
│ │ │ │ ├── erb_lint.rb
│ │ │ │ ├── es_lint.rb
│ │ │ │ ├── execute_permissions.rb
│ │ │ │ ├── fasterer.rb
│ │ │ │ ├── file_size.rb
│ │ │ │ ├── fix_me.rb
│ │ │ │ ├── flay.rb
│ │ │ │ ├── foodcritic.rb
│ │ │ │ ├── forbidden_branches.rb
│ │ │ │ ├── ginkgo_focus.rb
│ │ │ │ ├── go_fmt.rb
│ │ │ │ ├── go_lint.rb
│ │ │ │ ├── go_vet.rb
│ │ │ │ ├── golangci_lint.rb
│ │ │ │ ├── hadolint.rb
│ │ │ │ ├── haml_lint.rb
│ │ │ │ ├── hard_tabs.rb
│ │ │ │ ├── hlint.rb
│ │ │ │ ├── html_hint.rb
│ │ │ │ ├── html_tidy.rb
│ │ │ │ ├── image_optim.rb
│ │ │ │ ├── java_checkstyle.rb
│ │ │ │ ├── js_hint.rb
│ │ │ │ ├── js_lint.rb
│ │ │ │ ├── jscs.rb
│ │ │ │ ├── jsl.rb
│ │ │ │ ├── json_syntax.rb
│ │ │ │ ├── kt_lint.rb
│ │ │ │ ├── license_finder.rb
│ │ │ │ ├── license_header.rb
│ │ │ │ ├── line_endings.rb
│ │ │ │ ├── local_paths_in_gemfile.rb
│ │ │ │ ├── mdl.rb
│ │ │ │ ├── merge_conflicts.rb
│ │ │ │ ├── mix_format.rb
│ │ │ │ ├── nginx_test.rb
│ │ │ │ ├── pep257.rb
│ │ │ │ ├── pep8.rb
│ │ │ │ ├── php_cs.rb
│ │ │ │ ├── php_cs_fixer.rb
│ │ │ │ ├── php_lint.rb
│ │ │ │ ├── php_stan.rb
│ │ │ │ ├── pronto.rb
│ │ │ │ ├── puppet_lint.rb
│ │ │ │ ├── puppet_metadata_json_lint.rb
│ │ │ │ ├── pycodestyle.rb
│ │ │ │ ├── pydocstyle.rb
│ │ │ │ ├── pyflakes.rb
│ │ │ │ ├── pylint.rb
│ │ │ │ ├── python_flake8.rb
│ │ │ │ ├── r_spec.rb
│ │ │ │ ├── rails_best_practices.rb
│ │ │ │ ├── rails_schema_up_to_date.rb
│ │ │ │ ├── rake_target.rb
│ │ │ │ ├── reek.rb
│ │ │ │ ├── rst_lint.rb
│ │ │ │ ├── rubo_cop.rb
│ │ │ │ ├── ruby_lint.rb
│ │ │ │ ├── ruby_syntax.rb
│ │ │ │ ├── scalariform.rb
│ │ │ │ ├── scalastyle.rb
│ │ │ │ ├── scss_lint.rb
│ │ │ │ ├── semi_standard.rb
│ │ │ │ ├── shell_check.rb
│ │ │ │ ├── slim_lint.rb
│ │ │ │ ├── solargraph.rb
│ │ │ │ ├── sorbet.rb
│ │ │ │ ├── sqlint.rb
│ │ │ │ ├── standard.rb
│ │ │ │ ├── stylelint.rb
│ │ │ │ ├── swift_lint.rb
│ │ │ │ ├── terraform_format.rb
│ │ │ │ ├── trailing_whitespace.rb
│ │ │ │ ├── travis_lint.rb
│ │ │ │ ├── ts_lint.rb
│ │ │ │ ├── vint.rb
│ │ │ │ ├── w3c_css.rb
│ │ │ │ ├── w3c_html.rb
│ │ │ │ ├── xml_lint.rb
│ │ │ │ ├── xml_syntax.rb
│ │ │ │ ├── yaml_lint.rb
│ │ │ │ ├── yaml_syntax.rb
│ │ │ │ ├── yard_coverage.rb
│ │ │ │ └── yarn_check.rb
│ │ │ ├── pre_push/
│ │ │ │ ├── base.rb
│ │ │ │ ├── brakeman.rb
│ │ │ │ ├── cargo_test.rb
│ │ │ │ ├── flutter_test.rb
│ │ │ │ ├── go_test.rb
│ │ │ │ ├── golangci_lint.rb
│ │ │ │ ├── minitest.rb
│ │ │ │ ├── mix_test.rb
│ │ │ │ ├── php_unit.rb
│ │ │ │ ├── pronto.rb
│ │ │ │ ├── protected_branches.rb
│ │ │ │ ├── pub_test.rb
│ │ │ │ ├── pytest.rb
│ │ │ │ ├── python_nose.rb
│ │ │ │ ├── r_spec.rb
│ │ │ │ ├── rake_target.rb
│ │ │ │ └── test_unit.rb
│ │ │ ├── pre_rebase/
│ │ │ │ ├── base.rb
│ │ │ │ └── merged_commits.rb
│ │ │ ├── prepare_commit_msg/
│ │ │ │ ├── base.rb
│ │ │ │ └── replace_branch.rb
│ │ │ └── shared/
│ │ │ ├── bower_install.rb
│ │ │ ├── bundle_install.rb
│ │ │ ├── composer_install.rb
│ │ │ ├── index_tags.rb
│ │ │ ├── npm_install.rb
│ │ │ ├── pronto.rb
│ │ │ ├── r_spec.rb
│ │ │ ├── rake_target.rb
│ │ │ ├── submodule_status.rb
│ │ │ └── yarn_install.rb
│ │ ├── hook_context/
│ │ │ ├── base.rb
│ │ │ ├── commit_msg.rb
│ │ │ ├── diff.rb
│ │ │ ├── helpers/
│ │ │ │ ├── file_modifications.rb
│ │ │ │ └── stash_unstaged_changes.rb
│ │ │ ├── post_checkout.rb
│ │ │ ├── post_commit.rb
│ │ │ ├── post_merge.rb
│ │ │ ├── post_rewrite.rb
│ │ │ ├── pre_commit.rb
│ │ │ ├── pre_push.rb
│ │ │ ├── pre_rebase.rb
│ │ │ ├── prepare_commit_msg.rb
│ │ │ └── run_all.rb
│ │ ├── hook_context.rb
│ │ ├── hook_loader/
│ │ │ ├── base.rb
│ │ │ ├── built_in_hook_loader.rb
│ │ │ └── plugin_hook_loader.rb
│ │ ├── hook_runner.rb
│ │ ├── hook_signer.rb
│ │ ├── installer.rb
│ │ ├── interrupt_handler.rb
│ │ ├── logger.rb
│ │ ├── message_processor.rb
│ │ ├── os.rb
│ │ ├── printer.rb
│ │ ├── subprocess.rb
│ │ ├── utils/
│ │ │ ├── file_utils.rb
│ │ │ └── messages_utils.rb
│ │ ├── utils.rb
│ │ └── version.rb
│ └── overcommit.rb
├── libexec/
│ ├── gerrit-change-id
│ └── index-tags
├── overcommit.gemspec
├── spec/
│ ├── integration/
│ │ ├── committing_spec.rb
│ │ ├── configuration_signing_spec.rb
│ │ ├── diff_flag_spec.rb
│ │ ├── disable_overcommit_spec.rb
│ │ ├── gemfile_option_spec.rb
│ │ ├── hook_signing_spec.rb
│ │ ├── installing_overcommit_spec.rb
│ │ ├── parallelize_spec.rb
│ │ ├── protected_branches_spec.rb
│ │ ├── resolving_cherry_pick_conflict_spec.rb
│ │ ├── resolving_merge_conflict_spec.rb
│ │ ├── run_flag_spec.rb
│ │ └── template_dir_spec.rb
│ ├── overcommit/
│ │ ├── cli_spec.rb
│ │ ├── command_splitter_spec.rb
│ │ ├── configuration_loader_spec.rb
│ │ ├── configuration_spec.rb
│ │ ├── configuration_validator_spec.rb
│ │ ├── default_configuration_spec.rb
│ │ ├── git_config_spec.rb
│ │ ├── git_repo_spec.rb
│ │ ├── hook/
│ │ │ ├── base_spec.rb
│ │ │ ├── commit_msg/
│ │ │ │ ├── capitalized_subject_spec.rb
│ │ │ │ ├── empty_message_spec.rb
│ │ │ │ ├── gerrit_change_id_spec.rb
│ │ │ │ ├── hard_tabs_spec.rb
│ │ │ │ ├── message_format_spec.rb
│ │ │ │ ├── russian_novel_spec.rb
│ │ │ │ ├── single_line_subject_spec.rb
│ │ │ │ ├── spell_check_spec.rb
│ │ │ │ ├── text_width_spec.rb
│ │ │ │ └── trailing_period_spec.rb
│ │ │ ├── post_checkout/
│ │ │ │ ├── base_spec.rb
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── post_commit/
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── commitplease_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── git_guilt_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── post_merge/
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── post_rewrite/
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── pre_commit/
│ │ │ │ ├── author_email_spec.rb
│ │ │ │ ├── author_name_spec.rb
│ │ │ │ ├── berksfile_check_spec.rb
│ │ │ │ ├── broken_symlinks_spec.rb
│ │ │ │ ├── bundle_audit_spec.rb
│ │ │ │ ├── bundle_check_spec.rb
│ │ │ │ ├── bundle_outdated_spec.rb
│ │ │ │ ├── case_conflicts_spec.rb
│ │ │ │ ├── chamber_compare_spec.rb
│ │ │ │ ├── chamber_security_spec.rb
│ │ │ │ ├── chamber_verification_spec.rb
│ │ │ │ ├── code_spell_check_spec.rb
│ │ │ │ ├── coffee_lint_spec.rb
│ │ │ │ ├── cook_style_spec.rb
│ │ │ │ ├── credo_spec.rb
│ │ │ │ ├── css_lint_spec.rb
│ │ │ │ ├── dart_analyzer_spec.rb
│ │ │ │ ├── dogma_spec.rb
│ │ │ │ ├── erb_lint_spec.rb
│ │ │ │ ├── es_lint_spec.rb
│ │ │ │ ├── execute_permissions_spec.rb
│ │ │ │ ├── fasterer_spec.rb
│ │ │ │ ├── file_size_spec.rb
│ │ │ │ ├── fix_me_spec.rb
│ │ │ │ ├── flay_spec.rb
│ │ │ │ ├── foodcritic_spec.rb
│ │ │ │ ├── forbidden_branches_spec.rb
│ │ │ │ ├── go_fmt_spec.rb
│ │ │ │ ├── go_lint_spec.rb
│ │ │ │ ├── go_vet_spec.rb
│ │ │ │ ├── golangci_lint_spec.rb
│ │ │ │ ├── hadolint_spec.rb
│ │ │ │ ├── haml_lint_spec.rb
│ │ │ │ ├── hard_tabs_spec.rb
│ │ │ │ ├── hlint_spec.rb
│ │ │ │ ├── html_hint_spec.rb
│ │ │ │ ├── html_tidy_spec.rb
│ │ │ │ ├── image_optim_spec.rb
│ │ │ │ ├── java_checkstyle_spec.rb
│ │ │ │ ├── js_hint_spec.rb
│ │ │ │ ├── js_lint_spec.rb
│ │ │ │ ├── jscs_spec.rb
│ │ │ │ ├── jsl_spec.rb
│ │ │ │ ├── json_syntax_spec.rb
│ │ │ │ ├── kt_lint_spec.rb
│ │ │ │ ├── license_finder_spec.rb
│ │ │ │ ├── license_header_spec.rb
│ │ │ │ ├── line_endings_spec.rb
│ │ │ │ ├── local_paths_in_gemfile_spec.rb
│ │ │ │ ├── mdl_spec.rb
│ │ │ │ ├── merge_conflicts_spec.rb
│ │ │ │ ├── mix_format_spec.rb
│ │ │ │ ├── nginx_test_spec.rb
│ │ │ │ ├── pep257_spec.rb
│ │ │ │ ├── pep8_spec.rb
│ │ │ │ ├── php_lint_spec.rb
│ │ │ │ ├── php_stan_spec.rb
│ │ │ │ ├── phpcs_fixer_spec.rb
│ │ │ │ ├── phpcs_spec.rb
│ │ │ │ ├── pronto_spec.rb
│ │ │ │ ├── puppet_lint_spec.rb
│ │ │ │ ├── puppet_metadata_json_lint_spec.rb
│ │ │ │ ├── pycodestyle_spec.rb
│ │ │ │ ├── pydocstyle_spec.rb
│ │ │ │ ├── pyflakes_spec.rb
│ │ │ │ ├── pylint_spec.rb
│ │ │ │ ├── python_flake8_spec.rb
│ │ │ │ ├── r_spec_spec.rb
│ │ │ │ ├── rails_best_practices_spec.rb
│ │ │ │ ├── rails_schema_up_to_date_spec.rb
│ │ │ │ ├── rake_target_spec.rb
│ │ │ │ ├── reek_spec.rb
│ │ │ │ ├── rst_lint_spec.rb
│ │ │ │ ├── rubo_cop_spec.rb
│ │ │ │ ├── ruby_lint_spec.rb
│ │ │ │ ├── ruby_syntax_spec.rb
│ │ │ │ ├── scalariform_spec.rb
│ │ │ │ ├── scalastyle_spec.rb
│ │ │ │ ├── scss_lint_spec.rb
│ │ │ │ ├── semi_standard_spec.rb
│ │ │ │ ├── shell_check_spec.rb
│ │ │ │ ├── slim_lint_spec.rb
│ │ │ │ ├── solargraph_spec.rb
│ │ │ │ ├── sorbet_spec.rb
│ │ │ │ ├── sqlint_spec.rb
│ │ │ │ ├── standard_spec.rb
│ │ │ │ ├── stylelint_spec.rb
│ │ │ │ ├── swift_lint_spec.rb
│ │ │ │ ├── terraform_format_spec.rb
│ │ │ │ ├── trailing_whitespace_spec.rb
│ │ │ │ ├── travis_lint_spec.rb
│ │ │ │ ├── ts_lint_spec.rb
│ │ │ │ ├── vint_spec.rb
│ │ │ │ ├── w3c_css_spec.rb
│ │ │ │ ├── w3c_html_spec.rb
│ │ │ │ ├── xml_lint_spec.rb
│ │ │ │ ├── xml_syntax_spec.rb
│ │ │ │ ├── yaml_lint_spec.rb
│ │ │ │ ├── yaml_syntax_spec.rb
│ │ │ │ ├── yard_coverage_spec.rb
│ │ │ │ └── yarn_check_spec.rb
│ │ │ ├── pre_push/
│ │ │ │ ├── base_spec.rb
│ │ │ │ ├── brakeman_spec.rb
│ │ │ │ ├── cargo_test_spec.rb
│ │ │ │ ├── flutter_test_spec.rb
│ │ │ │ ├── go_test_spec.rb
│ │ │ │ ├── golangci_lint_spec.rb
│ │ │ │ ├── minitest_spec.rb
│ │ │ │ ├── mix_test_spec.rb
│ │ │ │ ├── php_unit_spec.rb
│ │ │ │ ├── pronto_spec.rb
│ │ │ │ ├── protected_branches_spec.rb
│ │ │ │ ├── pub_test_spec.rb
│ │ │ │ ├── pytest_spec.rb
│ │ │ │ ├── python_nose_spec.rb
│ │ │ │ ├── r_spec_spec.rb
│ │ │ │ ├── rake_target_spec.rb
│ │ │ │ └── test_unit_spec.rb
│ │ │ ├── pre_rebase/
│ │ │ │ └── merged_commits_spec.rb
│ │ │ └── prepare_commit_msg/
│ │ │ ├── base_spec.rb
│ │ │ └── replace_branch_spec.rb
│ │ ├── hook_context/
│ │ │ ├── base_spec.rb
│ │ │ ├── commit_msg_spec.rb
│ │ │ ├── diff_spec.rb
│ │ │ ├── post_checkout_spec.rb
│ │ │ ├── post_commit_spec.rb
│ │ │ ├── post_merge_spec.rb
│ │ │ ├── post_rewrite_spec.rb
│ │ │ ├── pre_commit_spec.rb
│ │ │ ├── pre_push_spec.rb
│ │ │ ├── pre_rebase_spec.rb
│ │ │ ├── prepare_commit_msg_spec.rb
│ │ │ └── run_all_spec.rb
│ │ ├── hook_signer_spec.rb
│ │ ├── installer_spec.rb
│ │ ├── logger_spec.rb
│ │ ├── message_processor_spec.rb
│ │ └── utils_spec.rb
│ ├── spec_helper.rb
│ └── support/
│ ├── git_spec_helpers.rb
│ ├── matchers/
│ │ └── hook.rb
│ ├── normalize_indent.rb
│ ├── output_helpers.rb
│ └── shell_helpers.rb
└── template-dir/
└── hooks/
├── commit-msg
├── overcommit-hook
├── post-checkout
├── post-commit
├── post-merge
├── post-rewrite
├── pre-commit
├── pre-push
├── pre-rebase
└── prepare-commit-msg
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# Defines the coding style for different editors and IDEs.
# http://editorconfig.org
root = true
[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
================================================
FILE: .git-hooks/pre_commit/master_hooks_match.rb
================================================
# frozen_string_literal: true
require 'fileutils'
module Overcommit::Hook::PreCommit
# Ensures all master hooks have the same content.
#
# This is necessary because we can't use symlinks to link all the hooks in the
# template directory to the master `overcommit-hook` file, since symlinks are
# not supported on Windows.
class MasterHooksMatch < Base
def run
hooks_dir = File.join('template-dir', 'hooks')
master_hook = File.join(hooks_dir, 'overcommit-hook')
Dir.glob(File.join(hooks_dir, '*')).each do |hook_path|
unless FileUtils.compare_file(master_hook, hook_path)
return [
:fail,
"Template directory hook '#{hook_path}' does not match '#{master_hook}'!\n" \
"Run `cp #{master_hook} #{hook_path}`"
]
end
end
:pass
end
end
end
================================================
FILE: .github/workflows/lint.yml
================================================
name: Lint
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
overcommit:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Prepare environment
run: |
git config --global user.email "gh-actions@example.com"
git config --global user.name "GitHub Actions"
bundle exec overcommit --sign
bundle exec overcommit --sign pre-commit
- name: Run pre-commit checks
run: bundle exec overcommit --run
================================================
FILE: .github/workflows/tests.yml
================================================
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
rspec:
timeout-minutes: 15
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
ruby-version:
- "2.6"
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"
os:
- ubuntu
# At the moment of this commit various specs fail on Windows.
# Any contributor is welcome to fix them and enable the Windows build.
# Please see Issue #836 for more details.
# - windows
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Run tests
run: |
git config --global user.email "gh-actions@example.com"
git config --global user.name "GitHub Actions"
bundle exec rspec
- name: Code coverage reporting
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
flag-name: ruby${{ matrix.ruby-version }}-${{ matrix.os }}
parallel: true
finish:
needs: rspec
runs-on: ubuntu-latest
steps:
- name: Finalize code coverage report
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
================================================
FILE: .gitignore
================================================
Gemfile.lock
coverage/
pkg/
.bundle
.idea
.history/
.vscode/
================================================
FILE: .overcommit.yml
================================================
gemfile: Gemfile
PreCommit:
# Disabled since this causes spurious failures on AppVeyor builds
BrokenSymlinks:
enabled: false
BundleCheck:
enabled: true
ExecutePermissions:
enabled: true
exclude:
- 'bin/overcommit'
- 'libexec/**/*'
- 'template-dir/hooks/**/*'
HardTabs:
enabled: true
MasterHooksMatch:
enabled: true
quiet: true
RuboCop:
enabled: true
include:
- '**/*.gemspec'
- '**/*.rb'
- '**/Gemfile'
- template-dir/hooks/overcommit-hook
TrailingWhitespace:
enabled: true
YamlSyntax:
enabled: true
================================================
FILE: .rubocop.yml
================================================
inherit_from: .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.6
NewCops: disable
SuggestExtensions: false
Layout/ClosingParenthesisIndentation:
Enabled: false
Layout/DotPosition:
EnforcedStyle: trailing
# Fails on AppVeyor builds
Layout/EndOfLine:
Enabled: false
Layout/FirstParameterIndentation:
Enabled: false
Layout/FirstArrayElementIndentation:
Enabled: false
Layout/HeredocIndentation:
Enabled: false
Layout/LineLength:
Max: 100
Layout/MultilineMethodCallIndentation:
Enabled: false
Layout/MultilineOperationIndentation:
Enabled: false
Layout/SpaceBeforeFirstArg:
Exclude:
- '*.gemspec'
Lint/AmbiguousBlockAssociation:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Enabled: false
Lint/AssignmentInCondition:
Enabled: false
Lint/Void:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/MethodLength:
Max: 20
Metrics/ModuleLength:
Enabled: false
Naming/FileName:
Exclude:
- 'template-dir/hooks/*'
- 'Gemfile'
- 'Rakefile'
- '*.gemspec'
# Renaming `has_something?` to `something?` obfuscates whether it is a "is-a" or
# a "has-a" relationship.
Naming/PredicatePrefix:
Enabled: false
# commit_sha1 is indeed how we want to write such a variable, so ignore this cop
Naming/VariableNumber:
Enabled: false
# Enforcing this results in a lot of unnecessary indentation.
Style/ClassAndModuleChildren:
Enabled: false
Style/Documentation:
Exclude:
- 'spec/overcommit/**/*'
Style/FormatString:
Enabled: false
# There are a number of situations where this makes code less readable or
# disrupts the visual flow of code.
Style/GuardClause:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
# We want to allow multi-line lambdas using the `->` syntax which Rubocop
# doesn't allow. We're also not too worried about people using `lambda` for
# single-line lambdas either.
Style/Lambda:
Enabled: false
Style/Next:
Enabled: false
# Calling .zero? instead of comparing `== 0` seems unnecessarily verbose
Style/NumericPredicate:
Enabled: false
Style/ParallelAssignment:
Enabled: false
# Prefer curly braces except for %i/%w/%W, since those return arrays.
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%': '{}'
'%i': '[]'
'%q': '{}'
'%Q': '{}'
'%r': '{}'
'%s': '()'
'%w': '[]'
'%W': '[]'
'%x': '{}'
Style/RescueModifier:
Exclude:
- 'bin/overcommit'
Style/SignalException:
Enabled: false
# Forcing a particular name (e.g. |a, e|) for inject methods prevents you from
# choosing intention-revealing names.
Style/SingleLineBlockParams:
Enabled: false
Style/SpecialGlobalVars:
Enabled: false
Style/SymbolArray:
Enabled: false
Style/TrailingCommaInArguments:
Enabled: false
Style/TrailingCommaInArrayLiteral:
Enabled: false
Style/TrailingCommaInHashLiteral:
Enabled: false
================================================
FILE: .rubocop_todo.yml
================================================
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit`
# on 2024-01-10 14:09:00 UTC using RuboCop version 1.59.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
# AllowedMethods: alias_method, public, protected, private
Layout/EmptyLinesAroundAttributeAccessor:
Exclude:
- 'lib/overcommit/hook_context/post_merge.rb'
# Offense count: 6
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/overcommit/message_processor_spec.rb'
# Offense count: 4
Lint/MixedRegexpCaptureTypes:
Exclude:
- 'lib/overcommit/hook/pre_commit/dart_analyzer.rb'
- 'lib/overcommit/hook/pre_commit/java_checkstyle.rb'
- 'lib/overcommit/hook/pre_commit/kt_lint.rb'
- 'lib/overcommit/hook/pre_commit/scalastyle.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantCopDisableDirective:
Exclude:
- 'lib/overcommit/hook_runner.rb'
- 'lib/overcommit/printer.rb'
# Offense count: 1
# Configuration parameters: CountComments, Max, CountAsOne.
Metrics/ClassLength:
Exclude:
- 'lib/overcommit/utils.rb'
# Offense count: 2
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
Metrics/CyclomaticComplexity:
Exclude:
- 'lib/overcommit/configuration.rb'
- 'lib/overcommit/hook_runner.rb'
# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
Metrics/PerceivedComplexity:
Exclude:
- 'lib/overcommit/configuration.rb'
- 'lib/overcommit/configuration_validator.rb'
- 'lib/overcommit/hook_runner.rb'
# Offense count: 23
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'bin/overcommit'
- 'lib/overcommit/hook/post_commit/git_guilt.rb'
- 'template-dir/hooks/commit-msg'
- 'template-dir/hooks/overcommit-hook'
- 'template-dir/hooks/post-checkout'
- 'template-dir/hooks/post-commit'
- 'template-dir/hooks/post-merge'
- 'template-dir/hooks/post-rewrite'
- 'template-dir/hooks/pre-commit'
- 'template-dir/hooks/pre-push'
- 'template-dir/hooks/pre-rebase'
- 'template-dir/hooks/prepare-commit-msg'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/HashTransformValues:
Exclude:
- 'lib/overcommit/configuration.rb'
- 'lib/overcommit/configuration_validator.rb'
# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'lib/overcommit/logger.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantBegin:
Exclude:
- 'lib/overcommit/hook/prepare_commit_msg/replace_branch.rb'
- 'lib/overcommit/utils.rb'
# Offense count: 10
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SafeForConstants.
Style/RedundantFetchBlock:
Exclude:
- 'lib/overcommit/configuration.rb'
- 'lib/overcommit/configuration_validator.rb'
- 'lib/overcommit/hook/base.rb'
- 'lib/overcommit/hook/pre_commit/chamber_verification.rb'
- 'lib/overcommit/logger.rb'
- 'spec/support/shell_helpers.rb'
# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'lib/overcommit/configuration.rb'
- 'lib/overcommit/hook/pre_commit/php_cs.rb'
- 'lib/overcommit/hook/pre_commit/php_lint.rb'
- 'lib/overcommit/hook/pre_commit/php_stan.rb'
# Offense count: 15
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/overcommit/hook/pre_commit/bundle_check.rb'
- 'lib/overcommit/hook_runner.rb'
- 'lib/overcommit/message_processor.rb'
- 'spec/integration/gemfile_option_spec.rb'
- 'spec/overcommit/hook/commit_msg/text_width_spec.rb'
- 'spec/overcommit/hook/prepare_commit_msg/base_spec.rb'
- 'spec/overcommit/message_processor_spec.rb'
- 'spec/spec_helper.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/ZeroLengthPredicate:
Exclude:
- 'lib/overcommit/hook/pre_commit/ruby_syntax.rb'
================================================
FILE: CHANGELOG.md
================================================
# Overcommit Changelog
## 0.68.0
* Add `Solargraph` pre-commit hook
## 0.67.1
* Fix `set` gem dependency error when running with `--diff` flag
## 0.67.0
* Fix bug introduced in 0.65.0 that prevented `gemfile: false` from working correctly
## 0.66.0
* Add `--diff` CLI option for running pre-commit hooks against only changed files
## 0.65.0
* Load bundled gems on expected version
## 0.64.1
* Update minimum version of rexml to address [CVE-2024-49761](https://www.ruby-lang.org/en/news/2024/10/28/redos-rexml-cve-2024-49761/)
## 0.64.0
* Add support for `stylelint` 16+
* Add `changelog_uri` to gemspec
## 0.63.0
* Add `Sorbet` pre-commit hook
* Add `RSpec` pre-commit hook
## 0.62.0
* Allow version 5 of `childprocess` gem dependency
## 0.61.0
* Allow `ReplaceBranch` to use `skip_if`
* Fix local Overcommit file merges with existing `.overcommit.yml`
## 0.60.0
* Allow overriding `Gemfile.lock` location for `BundleCheck` pre-commit hook
* Fix `ReplaceBranch` prepare-commit-msg hook to allow trailing spaces
* Add `MixFormat` pre-commit hook
* Add `MixTest` pre-push hook
* Allow loading custom local configuration from `.local-overcommit.yml`
* Handle `Psych::DisallowedClass` when running `YamlSyntax` pre-commit hook
* Add support for specifying custom `encoding` in `RailsSchemaUpToDate` pre-commit hook
## 0.59.1
* Remove `--disable-pending-cops` as default flag to `RuboCop` pre-commit hook.
* Remove special handling of process output on Windows since it broke on Linux.
## 0.59.0
* Add `--disable-pending-cops` as default flag to `RuboCop` pre-commit hook to ignore non-existent cops. Requires RuboCop `0.82.0` or newer.
* Fix deprecation warning for `Bundler.with_clean_env`.
* Fix handling of some kinds of pronto errors in the `Pronto` hook.
* Fix encoding of process output on Windows.
* Add support for specifying hook type to `--run` flag.
* Fix message regex parser for Stylelint.
* Fix configuration loading on Ruby 3.1.
* Fix `YamlSyntax` to support aliases when parsing.
* Fix run output to explicitly flush partial logs.
## 0.58.0
* Add `rexml` dependency explicitly to support Ruby 3.0.
* Add `DartAnalyzer` pre-commit hook to analyze Dart files.
* Add `PubTest` and `FlutterTest` pre-push hooks to run `pub test` and `flutter test` for Dart projects, respectively.
* Update `index-tags` script to support scanning only files tracked by Git.
* Fix `EsLint` pre-commit hook to not report certain false positives.
* Update `YamlLint` to `fail` the run instead of `warn` when errors are detected.
* Update `YamlLint` parse the line number of output so it is line aware.
* Gracefully handle breaking behavior in upstream Psych gem to support YAML aliases.
* Fix case where `git` would delete all tracked files when popping stash.
## 0.57.0
* Fix `CommitMsg` hooks to be able to call `modified_lines_in_file`.
* Add `ErbLint` pre-commit hook to lint ERB files.
## 0.56.0
* Update `ReplaceBranch` prepare-commit-msg hook to avoid running on `--amend` by default.
* Add support for `modified_files` and `modified_lines_in_file` in `CommitMsg` hooks.
## 0.55.0
* Fix `GoFmt` to not be enabled by default. This was enabled by mistake when introduced in Overcommit `0.52.0`.
## 0.54.1
* Fix `Overcommit::GitRepo.list_files` helper to work with arbitrarily large lists of files.
* Fix `AuthorName` to allow mononyms to be more inclusive of names.
## 0.54.0
* Fix `YamlLint` pre-commit hook
* Relax `childprocess` gem version constraint to allow version 4.x
## 0.53.0
* Improve performance in `PhpCs` pre-commit hook
* Add `Pronto` pre-push hook
* Remove erroneous extra newline in replacement string for `ReplaceBranch` prepare-commit-msg hook
* Add note about potentially checking your stash when hook is interrupted
* Add support for skipping hooks based on command result using the `skip_if` option
## 0.52.1
* Fix case where no standard input is provided to `pre-push` hooks
## 0.52.0
* Fix `Mdl` to properly parse JSON output from `mdl`
* Add `GolangciLint` pre-commit and pre-push hooks
* Add `GoTest` pre-push hook
* Add `GoFmt` pre-commit hook
* Add `exclude_branches` hook option to disable hooks running on specific branches
* Add `exclude_remotes` pre-push hook option to disable pre-push hooks running against specific remotes
* Change default behavior of pre-push hooks to **not** run against deleted remote refs
* Add `include_remote_ref_deletions` pre-push hook option to allow running for a remote branch deletion
* Rename `remote_branch_deletion?` pre-push hook helper to `remote_ref_deletion?`
* Add per-branch `destructive_only` setting to `ProtectedBranches` pre-push hook
## 0.51.0
* Stop stashing in pre-commit hooks when all changes are already staged,
avoiding unnecessary file modification
* Improve instructions for recovering commit message when a `commit-msg` hook
fails
## 0.50.0
* Fix Overcommit to display helpful error message when a hook does not inherit
from the base class
* Relax `childprocess` gem constraint to allow up to version 3.x
* Display a helpful message if hooks do not inherit from the correct base class
* Fix Overcommit to work with emacs/magit by [disabling literal pathspecs](https://magit.vc/manual/magit/My-Git-hooks-work-on-the-command_002dline-but-not-inside-Magit.html)
## 0.49.1
* Fix Overcommit to run when executed with no parent process
* Fix `Stylelint` pre-commit hook `required_executable`
## 0.49.0
### New Features
* Add `skipped_commit_types` option to `ReplaceBranch` prepare-commit-msg hook
* Add `RubySyntax` pre-commit hook
* Add `CodeSpellCheck` pre-commit hook
### Changes
* Relax `childprocess` dependency to allow version 1.x
### Bug Fixes
* Fix deadlock which was more likely to occur when setting `parallelize` on a hook to `false`
* Fix `Mdl` hook to use JSON output and not fail on unexpected output
## 0.48.1
* Fix `Stylelint` hook regex to extract line numbers with more than one digit
* Fix `CaseConflicts` hook to work with file paths containing double quotes
## 0.48.0
* Drop support for Ruby 2.3 or older
* Support multi-line matches in `MessageFormat` `commit-msg` hook
* Add `FileSize` pre-commit hook
## 0.47.0
### New Features
* Add support for `prepare-commit-message` hooks
* Add [`SwiftLint`](https://github.com/realm/SwiftLint) pre-commit hook
* Add [`KtLint`](https://github.com/shyiko/ktlint) pre-commit hook
* Add `TerraformFormat` pre-commit hook
* Add [`CookStyle`](https://docs.chef.io/cookstyle.html) pre-commit hook
### Changes
* Update `validator_uri` for `W3cHtml` pre-commit hook
* Update `TsLint` pre-commit hook to support new output format
* Update `BundleCheck` error message with additional instructions
### Bug Fixes
* Add `--force-exclusion` flag to `Reek` pre-commit hook configuration to
ensure excluded files are excluded
## 0.46.0
* Fix `Credo` pre-commit hook to lint applicable files only rather than
all files
* Add `PhpCsFixer` pre-commit hook
* Add `YardCoverage` pre-commit hook
* Add `Flay` pre-commit hook
* Add `Stylelint` pre-commit hook
* Fix `TsLint` default flags to work with `tslint` 5.11+
## 0.45.0
### New Features
* Add `CargoTest` pre-push hook for running `cargo test`
* Add `min_subject_width` option to `TextWidth` `commit-msg` hook
### Changes
* Drop support for Ruby versions 2.1 and older
### Bug Fixes
* Fix detection of `.git` directory location on Git versions before 2.5
## 0.44.0
### New Features
* Add support for [worktrees](https://git-scm.com/docs/git-worktree)
### Bug Fixes
* Fix installer to not attempt to remove old hooks directory if non-empty
* Fix erroneous `fatal` error message from a pre-commit hook run when adding
the first submodule to a repo
## 0.43.0
### Changes
* Add [`GitLfs`](https://git-lfs.github.com/) `post-checkout`, `post-commit`
and `post-merge` hooks
* Display commit message when `commit-msg` hooks fail
* Drop support for JRuby
* Enhance `pre-push` hooks to expose `modified_lines_in_file`, similar to
`pre-commit` hooks
* Add `YarnCheck` pre-commit hook which checks if `yarn.lock` matches `package.json`
* Add [`PhpUnit`](https://phpunit.de/) `pre-push` hook
## 0.42.0
### New Features
* Add `YarnInstall` post-checkout, post-commit, post-merge, and post-rewrite hooks
* Add [`metadata-json-lint`](https://voxpupuli.org/blog/2014/11/06/linting-metadata-json/) pre-commit hook
* Add [`RstLint`](https://github.com/twolfson/restructuredtext-lint) pre-commit
hook
* Add `YarnInstall` post-checkout, post-commit, post-merge, and post-rewrite hooks
* Add additional file patterns for `ChamberSecurity` pre-commit hook
* Add `ChamberCompare` and `ChamberVerification` pre-commit hooks
* Add `ComposerInstall` post-checkout, post-commit, post-merge, and post-rewrite hooks
* Add ability to `pre-push` hooks to inspect modified files for pushed refs
* Add [`PhpStan`](https://github.com/phpstan/phpstan) pre-commit hook
### Changes
* Run `GoLint` pre-commit hook against each file individually
* Improve performance of `BundleAudit` checking of `Gemfile.lock` file
* Allow ad hoc hooks to run executables not tracked by Git
* Drop support for Ruby 2.0
### Bug Fixes
* Fix `LineEndings` pre-commit hook handling of file paths with spaces
* Fix `Mdl` pre-commit hook message parsing regex
* Fix `RailsBestPractices` hook to only run against changed files
* Fix Overcommit installation in submodules
* Don't print backtrace of signature change for `overcommit --run`
## 0.41.0
* Add [`PhpCs`](http://pear.php.net/package/PHP_CodeSniffer) pre-commit hook
* Add [`PhpLint`](http://php.net/manual/en/features.commandline.options.php)
pre-commit hook
* Allow toggling colorize output via `OVERCOMMIT_COLOR` environment variable
## 0.40.0
* Add [`Pronto`](https://github.com/mmozuras/pronto) pre-commit hook
* Add [`hadolint`](https://github.com/lukasmartinelli/hadolint) pre-commit hook
* Add [`license_finder`](https://github.com/pivotal/LicenseFinder) pre-commit hook
* Use the `core.hooksPath` Git configuration option when installing hooks
* Gracefully handle binary files in `LineEndings` pre-commit hook
* Relax `childprocess` dependency to allow 0.x
* Gracefully handle gem loading errors when invoking Overcommit in a repo where
the `gemfile` specified by the local `.overcommit.yml` references a gem
version incompatible with the already-loaded Overcommit
* Ignore `Makefile` and `*.go` files in `HardTabs` pre-commit hook by default
## 0.39.1
### Bug Fixes
* Update `childprocess` to 0.6.3
## 0.39.0
### New Features
* Add [`GitLfs`](https://git-lfs.github.com/) pre-push hook
### Changes
* Update `childprocess` dependency to 0.6.x series
* Auto-sign configuration file when installing hooks for the first time
### Bug Fixes
* Fix `forwarding to private method` warning on Ruby 2.4.x
* Fix potential hang when a hook's `parallelize` option was set to `false`
* Fix `empty strings as pathspecs` warning introduced in Git 2.11
## 0.38.0
### New Features
* Add `Pytest` pre-push hook
* Add `RakeTarget` pre-commit and pre-push hook
* Moved `CommitPlease` from `CommitMsg` to `PostCommit` hook
* Add `skip_file_checkout` hook setting for `PostCheckout` hooks
### Bug Fixes
* Fix `install_command` for scss_lint gem
## 0.37.0
### New Features
* Add `FixMe` pre-commit hook, to ensure that no "token" words slips through.
These strings are things you should fix now, not later
* Add [`YAMLLint`](https://github.com/adrienverge/yamllint) pre-commit hook
* Add `LicenseHeader` pre-commit enforcement to ensure open source projects
contain proper license comments
* Add [`Foodcritic`](http://www.foodcritic.io/) pre-commit hook
* Add `LineEndings` pre-commit hook that allows you to enforcing UNIX- or
Windows-style line endings
### Bug Fixes
* Fix `CapitalizedSubject` to not fail when commit message starts with one or
more empty lines
## 0.36.0
* Add [`Fasterer`](https://github.com/DamirSvrtan/fasterer) pre-commit hook
* Add [`Brakeman`](http://brakemanscanner.org/) pre-push hook
* Add [`TSLint`](http://palantir.github.io/tslint/) pre-commit hook
* Validate that hook `env` environment configurations have valid names/values
* Fix a false negative reported by RailsSchemaUpToDate for newly-created Rails
projects that don't yet have any migrations
## 0.35.0
* Drop support for Ruby 1.9.3
* Fix `JavaCheckstyle` pre-commit hook to properly categorize `INFO` and
`WARN` messages
* Add `TestUnit` pre-push hook to run tests with `Test::Unit`
* Add `BundleAudit` pre-commit hook to scan gems for vulnerabilities with
[`bundle-audit`](https://github.com/rubysec/bundler-audit)
* Copy hook files instead of symlinking
* Add `Credo` pre-commit hook to check Elixir files
* Remove `Brakeman` pre-commit hook as it could erroneously report clean
runs depending on which files were committed to your repository. You
should run this tool in a separate job/task in your CI runs as it doesn't
make for a good pre-commit hook.
* Add `Commitplease` pre-commit hook which checks commit messages with
[`commitplease`](https://www.npmjs.com/package/commitplease)
## 0.34.2
* Add `--no-color` flag to all `git diff`/`git show` calls to override local
configuration
* Ignore `commit.gpgsign` configuration option when creating stash commits
in pre-commit hooks
## 0.34.1
* Switch template directory hooks from symlinks to regular files so gem can
be installed on Windows
## 0.34.0
* Fix `Scalastyle` pre-commit hook to capture messages with no line number
* Fix `CoffeeLint` pre-commit hook detection of modified lines
* Fix `Jscs` pre-commit hook to work with `jscs` 3.0.0+
* Fix `CapitalizedSubject` pre-commit hook to ignore commit message subjects
starting with `fixup!` or `squash!` special prefixes
* Add `BundleOutdated` pre-commit hook to report gems in the `Gemfile.lock`
that have newer versions available
* Add `destructive_only` option to `ProtectedBranches` pre-push hook
* Include `.ru` files in `RuboCop` pre-commit hook
* Fix `TextWidth` to ignore special `fixup!`/`squash!` prefixes in commit
message subjects when determining width of line
## 0.33.0
### New Features
* Add global `quiet` option which silences all hook output except in the case
of warning or error
### Changes
* Official support for Rubinius has been dropped. It will probably still work
for most use cases, but parallelized hook runs may be problematic. If someone
from the community is willing to step up to support it, we'll gladly add it
back
* Change `overcommit` CLI to automatically run within a Bundler context if the
`gemfile` option is specified. This mainly saves you from needing
`bundle exec` when running `overcommit --run`
### Bug Fixes
* Fix `AuthorName`/`AuthorEmail` pre-commit hooks to respect
`GIT_AUTHOR_NAME`/`GIT_AUTHOR_EMAIL` environment variables, respectively
* Fix `JavaCheckstyle` pre-commit hook to ignore `[ERROR]` prefix when parsing
output messages
## 0.32.0
### New Features
* Hooks are now run in parallel by default
* Add `concurrency` global option allowing you to specify the number of threads
to use when running hooks concurrently
* Add `parallelize` hook option which specifies whether or not this hook should
be run in parallel (default is `true`)
* Add `processors` hook option allowing you to specify how many processing
units a hook should require
* Add `ForbiddenBranches` pre-commit hook which prevents creating a commit
on any blacklisted branch by name/pattern
* Add `MessageFormat` commit-msg hook to validate commit messages against
a regex pattern
### Changes
* Improve error message output when there is a problem processing messages
via `extract_messages` pre-commit hook helper
* Switch `ScssLint` pre-commit hook to use the JSON output formatter instead
of the default formatter
* Change tense of hook descriptions from progressive indicative form ("Running")
to indicative present form ("Run") so output reads better in parallel hook
runs
### Bug Fixes
* Fix bug where amending a commit with command line arguments containing
Unicode characters could cause a crash due to invalid byte sequences
* Fix `Minitest` pre-push hook to include all test files
## 0.32.0.rc1
* Add `concurrency` global option allowing you to specify the number of threads
to use when running hooks concurrently
* Add `parallelize` hook option which specifies whether or not this hook should
be run in parallel (default is `true`)
* Add `processors` hook option allowing you to specify how many processing
units a hook should require
## 0.31.0
* Add support for glob patterns to `ProtectedBranches` pre-push hook
* Add `Mdl` pre-commit hook to run
[`mdl`](https://github.com/mivok/markdownlint) on Markdown files
* Add `--without-color` flag to `RailsBestPractices` pre-commit hook
to fix parsing issues due to color escape sequences
* Improve error message when `gemfile` has not had a dependency installed
* Fix `RuboCop` pre-commit hook to not swallow cop messages when `parser` gem
warnings are output to STDERR
## 0.30.0
### New Features
* Add `Dogma` pre-commit hook to lint Elixir files with
[dogma](http://elixir-lang.org/) files
* Add `Minitest` pre-push hook to run Minitest tests
* Add `RailsBestPractices` pre-commit hook which lints code with
[`rails_best_practices`](https://github.com/railsbp/rails_best_practices)
### Bug Fixes
* Fix `--run` flag to not block reading STDIN when using existing hook scripts
* Fix `RuboCop` pre-commit hook to fail when RuboCop version specified by
Bundler context is not available
* Fix `TextWidth` commit-msg hook to not include newline characters in
calculated width
## 0.29.1
* Raise error when hooks are defined with invalid names (i.e. non-alphanumeric
characters)
* Fix hook signing when specifying hook name
* Fix `BundleCheck` pre-commit hook to not report false negatives when running
via `overcommit --run` with local changes
## 0.29.0
### Important Security Fix
* Fix vulnerability where disabling signature verification would not be caught
by signature verification, allowing an attacker to bypass the check. If you
disable signature verification in your configuration, you must rename the
option to `verify_signatures` and should audit your hooks.
### New Features
* Allow nested arrays in `include` and `exclude` options so lists of file
glob patterns can be shared across hook configurations via YAML references
* Add `NginxTest` pre-commit hook that checks nginx configuration files with
[`nginx -t`](https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/)
* Respect `core.commentchar` configuration when reading commit messages
### Changes
* Rename `verify_plugin_signatures` to `verify_signatures`
### Bug Fixes
* Fix `Jscs` pre-commit hook to handle the new `jscs`
[exit codes](https://github.com/jscs-dev/node-jscs/wiki/Exit-codes) introduced
as of 2.2.0
* Fix `Scalastyle` pre-commit hook to fail with non-zero exit statuses
## 0.28.0
* Ensure `applicable_files` hook helper returns files in lexicographic order
* Add `NpmInstall` post-checkout, post-commit, post-merge, and post-rewrite hooks
* Add `PuppetLint` pre-commit hook that checks Puppet code with
[puppet-lint](http://puppet-lint.com/)
* Add `BowerInstall` post-checkout, post-commit, post-merge, and post-rewrite hooks
* Add `BundleInstall` post-checkout, post-commit, post-merge, and post-rewrite hooks
* Add `Sqlint` pre-commit hook that checks SQL code with
[sqlint](https://github.com/purcell/sqlint)
* Add Windows support
* Add `Hlint` pre-commit hook that checks Haskell files with
[hlint](https://github.com/ndmitchell/hlint)
* Add `ExecutePermissions` pre-commit hook that checks file mode for
unnecessary execute permissions
## 0.27.0
### New Features
* Add `HtmlHint` pre-commit hook that checks HTML files with
[HTMLHint](http://htmlhint.com/)
* Add support to the hook `execute` helper for accepting an optional list of
splittable command arguments for transparently dealing with really long file
lists and the operating system command length limit
* Add `modified_files` helper to `PostCheckout` and `PostRewrite` hooks
* Add `rewritten_commits` helper to `PostRewrite` hooks
* Add `gemfile` option to configuration file which allows a `Gemfile` to be
loaded by Bundler to enforce particular gem versions during hook runs
* Add support for `OVERCOMMIT_DEBUG` environment variable which toggles the
display of additional verbose output from executed commands
* Add support for defining
[hooks based on your existing git hooks](README.md#adding-existing-git-hooks)
within your `.overcommit.yml` (no Ruby code required)
* Add support for filtering all hooks except a small list via the `ONLY`
environment variable (similar to `SKIP` except a whitelist instead of
blacklist)
### Changes
* Don't display "No applicable _hook-type_ hooks to run" message unless debug
mode is enabled
### Bug Fixes
* Fix pre-commit hook bug where amending a commit which breaks a symlink would
result in that symlink not being included in the list of modified files
* Fix `CaseConflicts` pre-commit hook handling of large sets of files
* Fix `SemiStandard`/`Standard` hooks to read from `STDOUT` instead of `STDERR`
and handle new output format
* Fix `commit-msg` hooks to handle large commit messages auto-generated by the
`--verbose` flag for `git commit`
## 0.26.0
### New Features
* Add `EmptyMessage` commit-msg hook that reports commits messages that are
empty or contain only whitespace
* Add `env` hook configuration option that allows you to set values for
environment variables during the course of a particular hook's run
### Bug Fixes
* Fix handling of paths with spaces in the name
* Fix `CaseConflicts` pre-commit hook to not fail on initial commit
* Fix handling of files removed or renamed in a commit amendment
## 0.25.0
### New Features
* Add `Vint` pre-commit hook that checks Vim script with
[Vint](https://github.com/Kuniwak/vint)
* Add `Scalariform` pre-commit hook that checks formatting of Scala code with
[Scalariform](https://mdr.github.io/scalariform/)
* Add `SlimLint` pre-commit hook that analyzes Slim templates with
[Slim-Lint](https://github.com/sds/slim-lint)
### Changes
* Include SVG files in `ImageOptim`, `XmlLint`, and `XmlSyntax` pre-commit
hooks by default
* Make `IndexTags` hooks quiet by default
* Rename `Rubocop` pre-commit hook to `RuboCop` to match the project's proper
name
### Bug Fixes
* Fix `HardTabs` and `TrailingWhitespace` pre-commit hooks to include
line information in errors, making it work as expected when
`problem_on_unmodified_line` is set to something other than `report`
* Fix handling of changing a symlink to a directory on commit amendment so it
is not included in the list of modified files for pre-commit hooks
* Handle empty commit messages in `CapitalizedSubject`, `SingleLineSubject`,
`HardTabs`, `TextWidth`, and `TrailingPeriod` commit-msg hooks
## 0.24.0
### New Features
* Add `required_library`/`required_libraries` hook option which specifies
a list of paths a hook should load with `Kernel.require` before running
* Add `JsLint` pre-commit hook that checks the style of JavaScript files with
[JSLint](http://www.jslint.com/)
* Add `RubyLint` pre-commit hook that statically analyzes Ruby files with
[ruby-lint](https://github.com/YorickPeterse/ruby-lint)
* Add `Jsl` pre-commit hook that checks the style of JavaScript files with
[JavaScript Lint](http://www.javascriptlint.com/)
* Add `CapitalizedSubject` commit message hook
* Add `GoVet` pre-commit hook that examines Go source files with
[vet](https://godoc.org/golang.org/x/tools/cmd/vet)
* Add `XmlSyntax` pre-commit hook to check that XML files are valid
* Add `CaseConflicts` pre-commit hook which checks for file names in the same
directory which differ by letter casing
* Preserve existing git hooks in a repository when installing Overcommit hooks,
and restore them on uninstall
* Add `RSpec` pre-push hook that runs [RSpec](http://rspec.info/) tests before
pushing to remote
* Add `ProtectedBranches` pre-push hook that prevents destructive pushes
(deletions or force pushes) to specified branches
* Add `SpellCheck` commit-msg hook to check commit messages for misspelled words
* Add support for `pre-rebase` hooks
* Add `SubmoduleStatus` `post-checkout`, `post-commit`, `post-merge`, and
`post-rewrite` hooks that warn when submodules are uninitialized, out of date
with the current index, or contain merge conflicts
### Changes
* Disable `ShellCheck` pre-commit hook by default
* Switch `ImageOptim` hook to use executable instead of Ruby API
* Improve `CoffeeLint` pre-commit hook to differentiate between errors and
warnings
* Improve `GoLint` pre-commit hook to extract file and line information
* Change configuration loading behavior to prefer user-defined `ALL` hook
configuration over default `ALL` configuration, and user-defined hook
configuration over default `ALL` configuration
* Change hook summary message to mention warnings if there were any
* Disable almost all hooks by default. You will now need to explicitly enable
almost all hooks yourself in your `.overcommit.yml`. If you are migrating from
`overcommit` 0.23.0 and want to use the default configuration that shipped
with that version, copy the [default configuration from 0.23.0](https://github.com/sds/overcommit/blob/9f03e9c82b385d375a836ca7146b117dbde5c822/config/default.yml)
* Update `ScssLint` pre-commit hook to properly handle special exit code that
signals all files were filtered by exclusions (new as of `scss-lint` 0.36.0)
* Update `childprocess` dependency to minimum 0.5.6
* Change default value for `problem_on_unmodified_line` from `warn` to `report`
* Update `Rubocop` pre-commit hook to pass `--display-cop-names` flag so
cop names appear in output
* Drop support for returning `:good`/`:bad` results from hooks (was deprecated in
0.15.0)
* Remove `PryBinding` pre-commit hook since its functionality is provided by the
`Rubocop` pre-commit hook
### Bug Fixes
* Fix `LocalPathsInGemfile` to not report lints for commented paths
* Fix `CssLint` pre-commit hook to ignore blank lines in `csslint` output
* Fix error instructions typo in `BundleCheck` pre-commit hook
* Fix bug where stashed changes were not restored when plugin signature
validation failed
* Don't clear working tree after pre-commit hook when only submodule changes
are present
* Restore file modification times of unstaged files in addition to staged files
in pre-commit hook runs
## 0.23.0
### New Features
* Add pre-commit [ESLint](http://eslint.org/) hook
* Add pre-commit hooks for [standard](https://github.com/feross/standard) and
[semistandard](https://github.com/Flet/semistandard) JavaScript linters
* Add support for `post-commit`, `post-merge`, and `post-rewrite` hooks
* Add `GitGuilt` `post-commit` hook to display changes in blame ownership for
modified files
* Add `execute_in_background` helper to provide a standardized way to start
long-running processes without blocking the hook run
* Add `IndexTags` hook for `post-commit`, `post-merge`, and `post-rewrite`
hook types so tags index can always be kept up to date via `ctags`
* Add `W3cCss` and `W3cHtml` pre-commit hooks which integrate with the
`w3c_validator` gem
* Add `Scalastyle` pre-commit hook that runs
[scalastyle](http://www.scalastyle.org/) against Scala code
* Add `XmlLint` pre-commit hook to check XML files with
[xmllint](http://xmlsoft.org/xmllint.html)
* Add `JavaCheckstyle` pre-commit hook to check style of Java files with
[checkstyle](http://checkstyle.sourceforge.net/)
* Add `Pep8` pre-commit hook to check Python files with
[pep8](https://pypi.python.org/pypi/pep8)
* Add `Pyflakes` pre-commit hook to check Python files with
[pyflakes](https://pypi.python.org/pypi/pyflakes)
* Add `Pep257` pre-commit hook to check Python files with
[pep257](https://pypi.python.org/pypi/pep257)
* Add `HtmlTidy` pre-commit hook to check HTML files with
[tidy](http://www.html-tidy.org/)
* Add `Pylint` pre-commit hook to check Python files with
[pylint](http://www.pylint.org/)
### Changes
* Parse JSHint errors more precisely
* Remove `JsxHint` and `Jsxcs` pre-commit hooks in favor of using the
`required_executable` option on the JsHint and Jscs pre-commit hooks
* Change behavior of configuration options containing array values to always
replace the old value instead of appending to it
* Change `ImageOptim` hook to fail instead of warn if the `image_optim` gem
cannot be found
* Remove `ctags_arguments` option from `IndexTags` hooks
* Improve `PythonFlake8` pre-commit hook to differentiate between errors
and warnings
* Improve `CssLint` pre-commit hook to differentiate between errors and
warnings
### Bug Fixes
* Fix `--run` flag to consider all lines in all files as modified rather than none
* Fix `--run` flag to exclude submodule directories from the list of modified files
* Fix handling of files with spaces in their name when calculating modified
lines in a file
## 0.22.0
* Disable `Reek` pre-commit hook by default
* Allow `required_executable` to include paths that are in the repo root
* Add `command` hook option allowing the actual command that is executed
to be configured (useful to invoke command via `bundle exec` or similar)
* Add `flags` hook option allowing the flags passed on the command line
to be configured
## 0.21.0
* Change `HardTabs`, `MergeConflicts`, and `PryBinding` pre-commit hooks to
be `quiet` by default
* Switch `TravisLint` pre-commit hook from deprecated `travis-lint` gem to
`travis` gem
* Add .projections.json configuration file
* Add pre-commit static analysis and linting for sh/bash scripts with
[ShellCheck](http://www.shellcheck.net/)
* Use `--verbose` flag when running JSCS to include name of offending rule
## 0.20.0
* Add `--run` flag which runs all configured pre-commit hooks against the
entire repository
* Fix installer to work with Overcommit hooks created via `GIT_TEMPLATE_DIR`
* Fix hook runner to not display skip message unless hook would have actually
run
* Change `ImageOptim` hook to use `skip_missing_workers` option and update
dependency to 0.18.0
* Remove interactive prompt support from overcommit hooks
* Change hook signing from interactive flow to be done via
`overcommit --sign <hook-type>` command
## 0.19.0
* Add `--no-pngout` flag for `image_optim` command on `:fail` message
* Fix `Brakeman` pre-commit hook when multiple files have been staged
* Reset modification times more frequently when cleaning up the environment
after running pre-commit hooks. This should help overcommit work with file
watchers a little more nicely.
* Add pre-commit JavaScript style checking with
[JSXCS](https://github.com/orktes/node-jsxcs)
* Add pre-commit Ruby code smell checking with
[Reek](https://github.com/troessner/reek)
* Gracefully handle `.git` files that point to an external git directory
## 0.18.0
* Update minimum version of `image_optim` gem to 0.15.0 (breaking change in
name of exception classes)
* Add `--list-hooks` flag which displays all hooks for a repository and
whether they are enabled/disabled
* Add `required_executable` and `install_command` options that allow a hook
to define an executable that must be in the `PATH` in order for it to work,
and a command the user can use to install the executable if it doesn't exist
* All built-in hooks will now fail if the required executable is not present
* Fix bug where pre-commit hook would crash if user attempted to commit a
broken symlink
* Add `BrokenSymlinks` pre-commit hook which checks for broken symlinks
* Fix Chamber integration
* Fix 'include' path for ChamberSecurity
* Fix bug where commit message from cherry-picked commit would be lost if
there were conflicts
## 0.17.0
* Change commit hook header text to bold instead of bold white so that it
displays on terminals with a white background
* Add support for `OVERCOMMIT_DISABLE` environment variable, which when set
prevents Overcommit hooks from running
* Fix bug that prevented RailsSchemaUpToDate from working in directories that
contained decimals
* Warn when trying to pipe commands using the `execute` helper, as this is not
supported
* Include both standard out/error streams in exception messages in pre-commit
hook context
## 0.16.0
* Fix edge case where hitting Ctrl-C twice rapidly could result in work
tree being lost
* Fix edge case where hitting Ctrl-C after all pre-commit hooks had run
but before the cleanup had finished would result in a lost working
tree
* Handle edge case where if a file was created in the working directory by a
separate process in between the working tree being reset and the stash being
applied, the hook runner would silently fail
* Prevent stack traces from appearing during early interrupt before Overcommit
has loaded its code
* Remove `BundleCheck` post-checkout hook as it was a bit overzealous
## 0.15.0
* Fix bug where incorrect "hook run interrupted" message displayed when
hook run failed
* Gracefully handle `git stash` failures in pre-commit hook runs
* Fix `overcommit-hook` auto-updating not passing original arguments to
updated hook
* Display message when `overcommit-hook` file is automatically updated
* Deprecate `:bad` status in favor of `:fail`
* Deprecate `:good` status in favor of `:pass`
* Allow hook statuses to be transformed via `on_fail` and `on_warn`
configuration options
* Add `config` attribute as the preferred method to access hook
configurations in hook implementations
* Generate starter configuration on install with instructions on how to
configure overcommit if an `.overcommit.yml` file does not yet exist
* Include name of hook in output (to make it easier to find out which name
to use when skipping)
## 0.14.1
* Fix hook skipping regression
## 0.14.0
* Ignore `db/structure.sql` in `TrailingWhitespace` pre-commit hook
* Drop stashed changes after restoring them (now that #55 is fixed)
* Change `JSCS` pre-commit hook to check status code instead of using
regex to determine type of error
* Fix performance regression where running Overcommit in a repository
with a lot of files would be very slow
* Wildcards in include/exclude globs now match files beginning with `.`
* Drop support for Ruby 1.8.7
## 0.13.0
* Prevent `JsonSyntax` pre-commit hook from failing if `json_class` key
is present in JSON
* Prevent `HardTabs` pre-commit hook from warning on tabs in Makefiles
* Fix bug where `overcommit` hooks would fail for initial commit to repo
* Add support for gracefully exiting from Ctrl-C interruptions
* Add `.gitmodules` to the list of ignored files in `HardTabs` pre-commit hook
## 0.12.0
* Skip `HardTabs` pre-commit hook for Golang source files by default
* Disable `IndexTags` post-checkout hook by default
* Add `GoLint` pre-commit hook which runs `golint` on Golang source files
## 0.11.1
* Fix bug where `CHERRY_PICK_HEAD` would be lost when a pre-commit hook failed
after attempting to cherry pick a commit with a conflict
* Drop support for Ruby 1.9.2
## 0.11.0
* Allow custom arguments to be passed to `ctags` via `IndexTags` post-checkout
hook
## 0.10.0
* Change format of `include`/`exclude` file globs to match that of standard
shell globbing (e.g. `**` matches zero or more directories rather than 1 or
more)
* Don't drop stashed changes after restoring them
* Fix bug where `MERGE_HEAD` would be lost when attempting to commit a
resolution to a merge conflict
## 0.9.0
* Include `--force-exclusion` flag in Rubocop hook so files excluded via
`.rubocop.yml` are actually excluded
* Add pre-commit `JsxHint` hook which uses the
[JSXHint](https://github.com/STRML/JSXHint) project
* Add pre-commit `BerksfileCheck` hook which warns you when your
`Berksfile.lock` is out of sync with your `Berksfile`
* Fix `BundleCheck` to use `git ls-files` instead of `git check-ignore`,
as the latter is only available as of git 1.8
* Fix bug where skipping a hook via the `SKIP` environment variable would
incorrectly warn about the hook's configuration having changed
* Add `MergeConflicts` pre-commit hook which checks for unresolved merge
conflicts in files
* Add `RailsSchemaUpToDate` pre-commit hook which checks for
`schema.rb`/`structure.sql` that aren't up-to-date with the latest migration
* Add `PryBinding` pre-commit hook which checks for `binding.pry` calls that
have been left behind in code
* Add `LocalPathsInGemfile` pre-commit hook which checks for gem dependencies
pointing to local paths in a `Gemfile`
* Add `JsonSyntax` pre-commit hook which checks the syntax of all `.json` files
* Add `Brakeman` pre-commit hook which runs security checks against code
(disabled by default as it is slow)
* Add `ChamberSecurity` pre-commit hook which ensures that `chamber secure` has
been run before committing your changes (see the
[Chamber](https://github.com/thekompanee/chamber) gem for more information)
## 0.8.0
* Add pre-commit `TravisLint` hook which uses the
[travis-lint](https://github.com/travis-ci/travis-lint) gem
* Display actual warning message when dependencies aren't satisfied in
post-checkout `BundleCheck` hook
* Add support for hook plugin signature verification so that you don't
automatically execute repo-specific hooks that changed since you last
ran them. See [Security](README.md#security) for more information
* Automatically update `overcommit-hook` master hook and any other symlinks
before hook run. Run `overcommit --install` if you're upgrading to save
you from having to run `overcommit --install` in the future
## 0.7.0
* Change `command` hook helper signature to accept an array of arguments
instead of a shell string
* Rename `command` hook helper to `execute`
* Add support for JRuby 1.7.9 in Ruby 1.9 mode
* Display more helpful error message when installing Overcommit into a repo
that already has non-Overcommit hooks
* Add `--force` flag allowing Overcommit to be installed in repositories that
already contain non-Overcommit hooks (overwriting them in the process)
## 0.6.3
* `TextWidth` pre-commit hook now supports customized maximum subject line
and commit message body widths
* Fix bug where committing a change with only file deletions would result
in those changes not being committed
* Warn instead of failing when gem dependencies are out of date in
`BundleCheck` post-checkout hook
## 0.6.2
* Fix bug where hook run would crash if hook was unsuccessful but returned no
output
## 0.6.1
* Fix bug where a plugin would fail to load if it had a custom configuration
defined
## 0.6.0
* Breaking changes: plugin framework has been overhauled.
You must now subclass `Overcommit::Hook::<Type>` and implement
the method `run` instead of `run_check`. Also, the old hook runner
no longer works, so you'll need to remove the hooks installed in
`.git/hooks` and install new ones with `overcommit --install`
* Configuration for repository can be specified via `.overcommit.yml` file
* Can now skip hooks using just `SKIP` instead of `SKIP_CHECKS` environment
variable
* Add `--template-dir` flag which provides a convenient way to auto-install
overcommit via Git template directories
* Converted all script-based hook scripts to Ruby-based ones
* `AuthorEmail` check can be customized so emails match a regex
* `Whitespace` check was split into `HardTabs` and `TrailingWhitespace`
* Add pre-commit JavaScript style checking with
[JSCS](https://github.com/mdevils/node-jscs)
* Add `BundleCheck` pre-commit hook which checks if `Gemfile.lock` matches
`Gemfile`
## 0.5.0
* Use per-file `.scss-lint.yml` configuration for staged files
## 0.4.1
* Remove `RestrictedPaths` pre-commit check
## 0.4.0
* Added pre-commit check that optimizes images with `image_optim`
* Don't include submodules in the list of modified files
## 0.3.2
* Fix bug where `.rubocop.yml` would not be found in present working directory
## 0.3.1
* Use per-file `.rubocop.yml` configuration for staged files
## 0.3.0
* Added Gemfile.lock/bundler checking
* Added `--no-ext-diff` option to git diff
* Exposed StagedFile#original_path
## 0.2.6
* Added check for linting HAML files with
[haml-lint](https://github.com/sds/haml-lint)
## 0.2.5
* Don't use `--silent` flag with `rubocop` for Ruby style check
(allows upgrade to Rubocop 0.12.0)
## 0.2.4
* Teach scss-lint check to downgrade lints on untouched lines as warnings
## 0.2.3
* Fix "Too many open files" error for very large commits
* Make `StagedFile` tempfile creation lazy - should speed up some checks
* Address rare cross-platform compatibility issue by replacing a `which`
call with a pure Ruby equivalent
* Fix CoffeeScript linter path processing
## 0.2.2
* Allow specifying multiple file types for checks and syntax check rake files
* Fix bug where checks which returned lists of lines would output incorrectly
* Indent check output lines to nest under check name for better readability
## 0.2.1
* Fix bug where checks that didn't return strings for output would error
## 0.2.0
* Teach `StagedFile`s how to calculate which lines were actually added/modified
* Checks no longer need to filter temporary staged file paths themselves
* Condense Ruby style check output
* Teach Ruby style check to downgrade style lints on untouched lines as warnings
## 0.1.11
* Added Ruby code style linting via RuboCop
## 0.1.10
* Fixed bug where `output` was expected to be a string but was an array in
js_syntax
## 0.1.9
* Fixed bug where `staged` helper in `HookSpecificCheck` wasn't returning
`StagedFile`s
## 0.1.8
* Resurrect StagedFile for reading index contents rather than disk contents
## 0.1.7
* Sort plugins alphabetically
* Omit periods from warning messages for consistency
* Enforce single-line commit message subjects
* Only colorize output when logging to a TTY
* Add check to detect hard tabs in commit messages
* Fix crashing --list-templates flag
## 0.1.6
* Strip out blank release note in addition to warning the committer
* Add Python linting via [flake8](http://flake8.readthedocs.org/en/latest/)
* Add CoffeeScript linting via [coffeelint](http://www.coffeelint.org/)
## 0.1.5
* Improve spec coverage
* Use installed `jshint` if available instead of Rhino
* Update readme with dependencies, uninstall instructions
## 0.1.4
* Fix SKIP_CHECKS for namespaced hooks
* Make hooks work when repo-specific configuration file is missing
* Improve error handling when loading custom hooks
## 0.1.3
* Add un-skippable checks (not skipped via SKIP_CHECKS)
* Improve spec coverage
## 0.1.2
* Add uninstall (-u) option
## 0.1.1
* Make installer more robust
* Improve readme documentation
* Add template listing (-l) to CLI
* Add rspec and super-basic spec coverage
* Improve command-line messaging
## 0.1.0
* First public release
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Overcommit
## Bug Reports
* Ensure that your issue [has not already been reported][1]. It may already be
fixed!
* Include the steps you carried out to produce the problem.
* Include the behavior you observed along with the behavior you expected, and
why you expected it.
* Try setting the `OVERCOMMIT_DEBUG` environment variable to enable the display
of additional verbose output from executed commands.
* Include the stack trace and any debugging output reported by Overcommit.
## Feature Requests
We welcome feedback with or without pull requests. If you have an idea for how
to improve the tool, great! All we ask is that you take the time to write a
clear and concise explanation of what need you are trying to solve. If you have
thoughts on _how_ it can be solved, include those too!
The best way to see a feature added, however, is to submit a pull request.
## Pull Requests
* Before creating your pull request, it's usually worth asking if the code
you're planning on writing will actually be considered for merging. You can
do this by [opening an issue][1] and asking. It may also help give the
maintainers context for when the time comes to review your code.
* Ensure your [commit messages are well-written][2]. This can double as your
pull request message, so it pays to take the time to write a clear message.
* Add tests for your feature. You should be able to look at other tests for
examples, especially if you're contributing a pre-commit hook.
Speaking of tests, we use `rspec`, which can be run like so:
```bash
bundle exec rspec
```
* Submit your pull request!
All pull requests will be tested against [Travis CI][3], where the following
commands are run against multiple versions of Ruby:
```bash
bundle exec rspec
bundle exec overcommit --run
```
Ensuring your changes pass for the above commands before submitting your pull
request will save you time having to fix those changes. Better yet, if you
[install Overcommit](README.md#installation) hooks into your forked repo, a lot
of these checks will be done automatically for you!
### Naming Hooks
Hooks should be named in camel case format (e.g. `RuboCop`) with acronyms only
capitalizing the first letter in the series (e.g. SCSS Lint becomes `ScssLint`).
If a tool has a specific capitalization that is odd, follow that capitalization.
For example, `Scalastyle` is written with a lowercase "s" rather than
camel-cased as `ScalaStyle`, so the `Scalastyle` hook follows that convention.
Exceptions to this rule are tools that begin with a lowercase
letter—these should be capitalized.
Lastly, unless a tool has a particularly unique or descriptive name, include
an additional prefix to help categorize it (e.g. `Java` in `JavaCheckstyle`),
so it is easier for others to find hooks in the [README](README.md).
The reasoning for this perhaps odd naming scheme is to strike a balance between
consistency, familiarity for those who already know the tool, and Overcommit's
ability to deduce the name of a hook from its filename and vice versa.
[1]: https://github.com/sds/overcommit/issues
[2]: https://medium.com/brigade-engineering/the-secrets-to-great-commit-messages-106fc0a92a25
[3]: https://travis-ci.org/
## Code of conduct
This project adheres to the [Open Code of Conduct][code-of-conduct]. By
participating, you are expected to honor this code.
[code-of-conduct]: https://github.com/civiccc/code-of-conduct
================================================
FILE: Gemfile
================================================
# frozen_string_literal: true
source 'https://rubygems.org'
gemspec
# Development dependencies are listed below
gem 'rspec', '~> 3.0'
gem 'simplecov', '~> 0.21.0'
gem 'simplecov-lcov', '~> 0.8.0'
# Pin RuboCop for CI builds
if RUBY_VERSION < '2.7.0'
gem 'rubocop', '1.50.0'
else
gem 'rubocop', '1.77.0'
end
gem 'ffi' if Gem.win_platform?
================================================
FILE: MIT-LICENSE
================================================
Copyright (c) 2013-2019 Shane da Silva, Aiden Scandella
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
[](https://badge.fury.io/rb/overcommit)
[](https://github.com/sds/overcommit/actions/workflows/tests.yml/badge.svg?branch=main)
[](https://coveralls.io/github/sds/overcommit?branch=main)
[](https://codeclimate.com/github/sds/overcommit/maintainability)
[](http://inch-ci.org/github/sds/overcommit)
<p align="center">
<img src="https://raw.githubusercontent.com/sds/overcommit/master/logo/horizontal.png" width="65%" alt="Overcommit Logo"/>
</p>
`overcommit` is a tool to manage and configure
[Git hooks](http://git-scm.com/book/en/Customizing-Git-Git-Hooks).
In addition to supporting a wide variety of hooks that can be used across
multiple repositories, you can also define hooks specific to a repository which
are stored in source control. You can also easily
[add your existing hook scripts](#adding-existing-git-hooks) without writing
any Ruby code.
- [Requirements](#requirements)
- [Windows](#windows)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Automatically Install Overcommit Hooks](#automatically-install-overcommit-hooks)
- [Usage](#usage)
- [Skipping Hooks](#skipping-hooks)
- [Disabling Overcommit](#disabling-overcommit)
- [Disabling Colorized Output](#disabling-colorized-output)
- [Continuous Integration](#continuous-integration)
- [Configuration](#configuration)
- [Hook Options](#hook-options)
- [Hook Categories](#hook-categories)
- [The `ALL` Hook](#the-all-hook)
- [Gemfile](#gemfile)
- [Plugin Directory](#plugin-directory)
- [Quiet Hook Runs](#quiet-hook-runs)
- [Concurrency](#concurrency)
- [Signature Verification](#signature-verification)
- [Built-In Hooks](#built-in-hooks)
- [CommitMsg](#commitmsg)
- [PostCheckout](#postcheckout)
- [PostCommit](#postcommit)
- [PostMerge](#postmerge)
- [PostRewrite](#postrewrite)
- [PreCommit](#precommit)
- [WARNING: pre-commit hooks cannot have side effects](#warning-pre-commit-hooks-cannot-have-side-effects)
- [PrePush](#prepush)
- [PreRebase](#prerebase)
- [Repo-Specific hooks](#repo-specific-hooks)
- [Adding Existing Git Hooks](#adding-existing-git-hooks)
- [Security](#security)
- [Disabling Signature Checking](#disabling-signature-checking)
- [Contributing](#contributing)
- [Community](#community)
- [Changelog](#changelog)
- [License](#license)
## Requirements
This project aims to support the following Ruby runtimes on \*nix (and best effort on Windows):
* Ruby 2.6+
### Dependencies
Some hooks have third-party dependencies. For example, to lint your
[SCSS](http://sass-lang.com/) files, you're going to need the
[scss_lint gem](https://github.com/sds/scss-lint).
Depending on the hooks you enable/disable for your repository, you'll need to
ensure your development environment already has those dependencies installed.
Most hooks will display a warning if a required executable isn't available.
If you are using Bundler to manage your Ruby gem dependencies, you'll likely
want to use the [`gemfile`](#gemfile) option to control which gem versions are
available during your hook runs.
## Installation
`overcommit` is installed via [RubyGems](https://rubygems.org/). It is strongly
recommended that your environment support running `gem install` without
requiring root user privileges via `sudo` or otherwise. Using a Ruby version
manager like [`rbenv`](https://github.com/rbenv/rbenv/) or
[`rvm`](https://rvm.io/) is recommended.
Once you have an environment that allows you to install gems without `sudo`,
run:
```bash
gem install overcommit
```
You can then run the `overcommit` command to install hooks into repositories.
```bash
mkdir important-project
cd important-project
git init
overcommit --install
```
After running `overcommit --install`, any existing hooks for your repository
which Overcommit will replace will be backed up. You can restore everything to
the way it was by running `overcommit --uninstall`.
### Automatically Install Overcommit Hooks
If you want to use `overcommit` for all repositories you create/clone going
forward, add the following to automatically run in your shell environment:
```bash
export GIT_TEMPLATE_DIR="$(overcommit --template-dir)"
```
The `GIT_TEMPLATE_DIR` provides a directory for Git to use as a template
for automatically populating the `.git` directory. If you have your own
template directory, you might just want to copy the contents of
`overcommit --template-dir` to that directory.
## Usage
Once you've installed the hooks via `overcommit --install`, they will
automatically run when the appropriate hook is triggered.
The `overcommit` executable supports the following command-line flags:
Command Line Flag | Description
--------------------------|----------------------------------------------------
`-i`/`--install` | Install Overcommit hooks in a repository
`-u`/`--uninstall` | Remove Overcommit hooks from a repository
`-f`/`--force` | Don't bail on install if other hooks already exist--overwrite them
`-l`/`--list-hooks` | Display all available hooks in the current repository
`-r`/`--run` | Run pre-commit hook against all tracked files in repository
`--diff <ref>` | Run pre-commit hook against all changed files relative to `<ref>`
`-t`/`--template-dir` | Print location of template directory
`-h`/`--help` | Show command-line flag documentation
`-v`/`--version` | Show version
### Skipping Hooks
Sometimes a hook will report an error that for one reason or another you'll want
to ignore. To prevent these errors from blocking your commit, you can include
the name of the relevant hook in the `SKIP` environment variable, e.g.
```bash
SKIP=RuboCop git commit
```
If you would prefer to specify a whitelist of hooks rather than a blacklist, use
the `ONLY` environment variable instead.
```bash
ONLY=RuboCop git commit
```
Use this feature sparingly, as there is no point to having the hook in the first
place if you're just going to ignore it. If you want to ensure a hook is never
skipped, set the `required` option to `true` in its configuration. If you
attempt to skip it, you'll see a warning telling you that the hook is required,
and the hook will still run.
### Disabling Overcommit
If you have scripts that execute `git` commands where you don't want Overcommit
hooks to run, you can disable Overcommit entirely by setting the
`OVERCOMMIT_DISABLE` environment variable.
```bash
OVERCOMMIT_DISABLE=1 ./my-custom-script
```
### Disabling Colorized Output
Overcommit automatically colorizes its output based on whether it is outputting
to a TTY. However, you can manually enable/disable color by setting the
`OVERCOMMIT_COLOR` environment variable.
```bash
OVERCOMMIT_COLOR=0 git commit
```
## Continuous Integration
You can run the same set of hooks that would be executed in a pre-commit hook
against your entire repository by running `overcommit --run`. This makes it
easy to have the checks verified by a CI service such as
[Travis CI](https://travis-ci.com/), including custom hooks you've written
yourself.
The `--run` flag works by creating a pre-commit context that assumes _all_ the
files in your repository have changed, and follows the same rules as a normal
pre-commit check. If any hook fails with an error, it will return a non-zero
exit code.
## Configuration
Overcommit provides a flexible configuration system that allows you to tailor
the built-in hooks to suit your workflow. All configuration specific to a
repository is stored in `.overcommit.yml` in the top-level directory of the
repository.
When writing your own configuration, it will automatically extend the
[default configuration](config/default.yml), so you only need to specify
your configuration with respect to the default. In order to
enable/disable hooks, you can add the following to your repo-specific
configuration file:
```yaml
PreCommit:
RuboCop:
enabled: true
command: ['bundle', 'exec', 'rubocop'] # Invoke within Bundler context
```
Additionally, you may wish to have repo-specific configurations that are local to your computer that are not part of the shared repo config.
Adding a `.local-overcommit.yml` file in the top-level directory of the repository adds another configuration file. This file works the same as `.overcommit.yml`.
Adding this to ignored files in a git repo will allow you to have a local configuration per repo.
### Hook Options
Individual hooks expose both built-in configuration options as well as their
own custom options unique to each hook. The following table lists all built-in
configuration options:
Option | Description
----------------------------------------|--------------------------------------
`enabled` | If `false`, this hook will never be run
`required` | If `true`, this hook cannot be skipped via the `SKIP` environment variable
`quiet` | If `true`, this hook does not display any output unless it warns/fails
`description` | Message displayed while hook is running.
`requires_files` | If `true`, this hook runs only if files that are applicable to it have been modified. See `include` and `exclude` for how to specify applicable files.
`include` | File paths or glob patterns of files that apply to this hook. The hook will only run on the applicable files when they have been modified. Note that the concept of modified varies for different types of hooks. By default, `include` matches every file until you specify a list of patterns.
`exclude` | File paths or glob patterns of files that do not apply to this hook. This is used to exclude any files that would have been matched by `include`.
`exclude_branches` | List of branch names or glob patterns of branches that this hook should not run against.
`exclude_remotes` | *`PrePush` hooks only.* List of remote names that the hook should not run against.
`include_remote_ref_deletions` | *`PrePush` hooks only.* By default, `PrePush` hooks will **not** run for pushes that delete a remote ref (i.e. branches or tags). Set to `true` to have the hook run even for deleted remote ref.
`problem_on_unmodified_line` | How to treat errors reported on lines that weren't modified during the action captured by this hook (e.g. for pre-commit hooks, warnings/errors reported on lines that were not staged with `git add` may not be warnings/errors you care about). Valid values are `report`: report errors/warnings as-is regardless of line location (default); `warn`: report errors as warnings if they are on lines you didn't modify; and `ignore`: don't display errors/warnings at all if they are on lines you didn't modify (`ignore` is _not_ recommended).
`on_fail` | Change the status of a failed hook to `warn` or `pass`. This allows you to treat failures as warnings or potentially ignore them entirely, but you should use caution when doing so as you might be hiding important information.
`on_warn` | Similar to `on_fail`, change the status of a hook that returns a warning status to either `pass` (you wish to silence warnings entirely) or `fail` (you wish to treat all warnings as errors).
`required_executable` | Name of an executable that must exist in order for the hook to run. If this is a path (e.g. `./bin/ruby`), ensures that the executable file exists at the given location relative to the repository root. Otherwise, if it just the name of an executable (e.g. `ruby`) checks if the executable can be found in one of the directories in the `PATH` environment variable. Set this to a specific path if you want to always use an executable that is stored in your repository. (e.g. RubyGems bin stubs, Node.js binaries, etc.)
`required_library`/`required_libraries` | List of Ruby libraries to load with `Kernel.require` before the hook runs. This is specifically for hooks that integrate with external Ruby libraries.
`command` | Array of arguments to use as the command. How each hook uses this is different, but it allows hooks to change the context with which they run. For example, you can change the command to be `['bundle', 'exec', 'rubocop']` instead of just `rubocop` so that you can use the gem versions specified in your local `Gemfile.lock`. This defaults to the name of the `required_executable`.
`flags` | Array of arguments to append to the `command`. This is useful for customizing the behavior of a tool. It's also useful when a newer version of a tool removes/renames existing flags, so you can update the flags via your `.overcommit.yml` instead of waiting for an upstream fix in Overcommit.
`env` | Hash of environment variables the hook should be run with. This is intended to be used as a last resort when an executable a hook runs is configured only via an environment variable. Any pre-existing environment variables with the same names as ones defined in `env` will have their original values restored after the hook runs. **NOTE:** Currently, only strings are accepted values. Boolean values will raise an error. **WARNING**: If you set the same environment variable for multiple hooks and you've enabled parallel hook runs, since the environment is shared across all threads you could accidentally have these separate hooks trample on each other. In this case, you should disable parallelization for the hook using the `parallelize` option.
`parallelize` | Whether to allow this hook to be run concurrently with other hooks. Disable this if the hook requires access to a shared resource that other hooks may also access and modify (e.g. files, the git index, process environment variables, etc).
`processors` | The number of processing units to reserve for this hook. This does not reserve CPUs, but indicates that out of the total number of possible concurrent hooks allowed by the global `concurrency` option, this hook requires the specified number. Thus in the typical case where `concurrency` is set to the number of available cores (default), and you have a hook that executes an application which itself creates 2 threads (or is otherwise scheduled on 2 cores), you can indicate that Overcommit should allocate 2 `processors` to the hook. Ideally this means your hooks won't put undue load on your available cores.
`install_command` | Command the user can run to install the `required_executable` (or alternately the specified `required_libraries`). This is intended for documentation purposes, as Overcommit does not install software on your behalf since there are too many edge cases where such behavior would result in incorrectly configured installations (e.g. installing a Python package in the global package space instead of in a virtual environment).
`skip_file_checkout` | Whether to skip this hook for file checkouts (e.g. `git checkout some-ref -- file`). Only applicable to `PostCheckout` hooks.
`skip_if` | Array of arguments to be executed to determine whether or not the hook should run. For example, setting this to a value of `['bash', '-c', '! which my-executable']` would allow you to skip running this hook if `my-executable` was not in the bin path.
In addition to the built-in configuration options, each hook can expose its
own unique configuration options. The `AuthorEmail` hook, for example, allows
you to customize the regex used to check commit author emails via the `pattern`
option—useful if you want to enforce that developers use a company
email address for their commits. This provides incredible flexibility for hook
authors as you can make your hooks sufficiently generic and then customize them
on a per-project basis.
### Hook Categories
Hook configurations are organized into categories based on the type of hook. So
`pre-commit` hooks are located under the `PreCommit` option, and `post-commit`
hooks are located under `PostCommit`. See the
[default configuration](config/default.yml) for a thorough example.
#### The `ALL` Hook
Within a hook category, there is a special type of hook configuration that
applies to _all_ hooks in the category. This configuration looks like a normal
hook configuration, except it has the name `ALL`:
```yaml
PreCommit:
ALL:
problem_on_unmodified_line: warn
requires_files: true
required: false
quiet: false
SomeHook:
enabled: true
...
```
The `ALL` configuration is useful for when you want to
[DRY](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself) up your
configuration, or when you want to apply changes across an entire category of
hooks.
Note that array configuration options (like `include`/`exclude`) in the
special `ALL` hook section are not merged with individual hook configurations
if custom ones are defined for the hook.
Any custom configuration option for `include`/`exclude` will replace the `ALL`
hook's configuration. If you want to have a global list of default exclusions
and extend them with a custom list, you can use YAML references, e.g.
```yaml
PreCommit:
ALL:
exclude: &default_excludes
- 'node_modules/**/*'
- 'vendor/**/*'
MyHook:
exclude:
- *default_excludes
- 'another/directory/in/addition/to/default/excludes/**/*'
```
Again, you can consult the [default configuration](config/default.yml) for
detailed examples of how the `ALL` hook can be used.
### Gemfile
You may want to enforce the version of Overcommit or other gems that you use in
your git hooks. This can be done by specifying the `gemfile` option in your
`.overcommit.yml`.
The `gemfile` option tells Overcommit to load the specified file with
[Bundler](http://bundler.io/), the standard gem dependency manager for Ruby.
This is useful if you would like to:
- Enforce a specific version of Overcommit to use for all hook runs
(or to use a version from the master branch that has not been released yet)
- Enforce a specific version or unreleased branch is used for a gem you want
to use in your git hooks
Loading a Bundler context necessarily adds a startup delay to your hook runs
as Bundler parses the specified `Gemfile` and checks that the dependencies are
satisfied. Thus for projects with many gems this can introduce a noticeable
delay.
The recommended workaround is to create a separate `Gemfile` in the root of
your repository (call it `.overcommit_gems.rb`), and include only the gems that
your Overcommit hooks need in order to run. Generate the associated lock file
by running:
```bash
bundle install --gemfile=.overcommit_gems.rb
```
...and commit `.overcommit_gems.rb` and the resulting
`.overcommit_gems.rb.lock` file to your repository. Set your `gemfile` option
to `.overcommit_gems.rb`, and you're all set.
Using a smaller Gemfile containing only the gems used by your Overcommit hooks
significantly reduces the startup delay in your hook runs. It is thus the
recommended approach unless your project has a relatively small number of gems
in your `Gemfile`.
### Plugin Directory
You can change the directory that project-specific hooks are loaded from via
the `plugin_directory` option. The default directory is `.git-hooks`.
### Quiet Hook Runs
If you prefer to have your hooks be completely silent unless there is a
problem, you can set the top-level `quiet` option to `true`. Note that if you
have many hooks or slow hooks this may not be desirable, as you don't get
visual feedback indicating the general progress of the hook run.
### Concurrency
Overcommit runs hooks in parallel by default, with a number of concurrent
workers equal to the number of logical cores on your machine. If you know your
particular set of hooks would benefit from higher/lower number of workers, you
can adjust the global `concurrency` option. You can define single-operator
mathematical expressions, e.g. `%{processors} * 2`, or `%{processors} / 2`.
```yaml
concurrency: '%{processors} / 4'
```
Note that individual hooks can specify the number of processors they require
with the `processors` hook option. See the [hook options](#hook-options)
section for more details.
### Signature Verification
You can disable manual verification of signatures by setting
`verify_signatures` to `false`. See the [Security](#security) section for more
information on this option and what exactly it controls.
## Built-In Hooks
Currently, Overcommit supports the following hooks out of the box—simply
enable them in your `.overcommit.yml`.
**Note**: Hooks with a `*` are enabled by default.
**Warning**: This list represents the list of hooks available on the `master`
branch. Please consult the [change log](CHANGELOG.md) to view which hooks have
not been released yet.
### CommitMsg
`commit-msg` hooks are run against every commit message you write before a
commit is created. A failed hook prevents a commit from being created. These
hooks are useful for enforcing policies on your commit messages, e.g. ensuring
a task ID is included for tracking purposes, or ensuring your commit messages
follow [proper formatting guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
* [`*`CapitalizedSubject](lib/overcommit/hook/commit_msg/capitalized_subject.rb)
* [`*`EmptyMessage](lib/overcommit/hook/commit_msg/empty_message.rb)
* [GerritChangeId](lib/overcommit/hook/commit_msg/gerrit_change_id.rb)
* [HardTabs](lib/overcommit/hook/commit_msg/hard_tabs.rb)
* [MessageFormat](lib/overcommit/hook/commit_msg/message_format.rb)
* [RussianNovel](lib/overcommit/hook/commit_msg/russian_novel.rb)
* [`*`SingleLineSubject](lib/overcommit/hook/commit_msg/single_line_subject.rb)
* [SpellCheck](lib/overcommit/hook/commit_msg/spell_check.rb)
* [`*`TextWidth](lib/overcommit/hook/commit_msg/text_width.rb)
* [`*`TrailingPeriod](lib/overcommit/hook/commit_msg/trailing_period.rb)
### PostCheckout
`post-checkout` hooks run after a successful `git checkout`, or in other words
any time your `HEAD` changes or a file is explicitly checked out.
* [BowerInstall](lib/overcommit/hook/post_checkout/bower_install.rb)
* [BundleInstall](lib/overcommit/hook/post_checkout/bundle_install.rb)
* [ComposerInstall](lib/overcommit/hook/post_checkout/composer_install.rb)
* [IndexTags](lib/overcommit/hook/post_checkout/index_tags.rb)
* [NpmInstall](lib/overcommit/hook/post_checkout/npm_install.rb)
* [SubmoduleStatus](lib/overcommit/hook/post_checkout/submodule_status.rb)
* [YarnInstall](lib/overcommit/hook/post_checkout/yarn_install.rb)
### PostCommit
`post-commit` hooks run after a commit is successfully created. A hook failing
in this case does not prevent the commit since it has already occurred;
however, it can be used to alert the user to some issue.
* [BowerInstall](lib/overcommit/hook/post_commit/bower_install.rb)
* [BundleInstall](lib/overcommit/hook/post_commit/bundle_install.rb)
* [Commitplease](lib/overcommit/hook/post_commit/commitplease.rb)
* [ComposerInstall](lib/overcommit/hook/post_commit/composer_install.rb)
* [GitGuilt](lib/overcommit/hook/post_commit/git_guilt.rb)
* [IndexTags](lib/overcommit/hook/post_commit/index_tags.rb)
* [NpmInstall](lib/overcommit/hook/post_commit/npm_install.rb)
* [SubmoduleStatus](lib/overcommit/hook/post_commit/submodule_status.rb)
* [YarnInstall](lib/overcommit/hook/post_commit/yarn_install.rb)
### PostMerge
`post-merge` hooks run after a `git merge` executes successfully with no merge
conflicts. A hook failing in this case does not prevent the merge since it has
already occurred; however, it can be used to alert the user to some issue.
* [BowerInstall](lib/overcommit/hook/post_merge/bower_install.rb)
* [BundleInstall](lib/overcommit/hook/post_merge/bundle_install.rb)
* [ComposerInstall](lib/overcommit/hook/post_merge/composer_install.rb)
* [IndexTags](lib/overcommit/hook/post_merge/index_tags.rb)
* [NpmInstall](lib/overcommit/hook/post_merge/npm_install.rb)
* [SubmoduleStatus](lib/overcommit/hook/post_merge/submodule_status.rb)
* [YarnInstall](lib/overcommit/hook/post_merge/yarn_install.rb)
### PostRewrite
`post-rewrite` hooks run after a commit is modified by a `git commit --amend`
or `git rebase`. A hook failing in this case does not prevent the rewrite since
it has already occurred; however, it can be used to alert the user to some
issue.
* [BowerInstall](lib/overcommit/hook/post_rewrite/bower_install.rb)
* [BundleInstall](lib/overcommit/hook/post_rewrite/bundle_install.rb)
* [ComposerInstall](lib/overcommit/hook/post_rewrite/composer_install.rb)
* [IndexTags](lib/overcommit/hook/post_rewrite/index_tags.rb)
* [NpmInstall](lib/overcommit/hook/post_rewrite/npm_install.rb)
* [SubmoduleStatus](lib/overcommit/hook/post_rewrite/submodule_status.rb)
* [YarnInstall](lib/overcommit/hook/post_rewrite/yarn_install.rb)
### PreCommit
`pre-commit` hooks are run after `git commit` is executed, but before the
commit message editor is displayed. If a hook fails, the commit will not be
created. These hooks are ideal for syntax checkers, linters, and other checks
that you want to run before you allow a commit to even be created.
#### WARNING: pre-commit hooks cannot have side effects
`pre-commit` hooks currently do not support hooks with side effects (such as
modifying files and adding them to the index with `git add`). This is a
consequence of Overcommit's pre-commit hook stashing behavior to ensure hooks
are run against _only the changes you are about to commit_.
Without Overcommit, the proper way to write a `pre-commit` hook would be to
extract the staged changes into temporary files and lint those files
instead of whatever contents are in your working tree (as you don't want
unstaged changes to taint your results). Overcommit takes care
of this for you, but to do it in a generalized way introduces this
limitation. See the [thread tracking this
issue](https://github.com/sds/overcommit/issues/238) for more details.
* [`*`AuthorEmail](lib/overcommit/hook/pre_commit/author_email.rb)
* [`*`AuthorName](lib/overcommit/hook/pre_commit/author_name.rb)
* [BerksfileCheck](lib/overcommit/hook/pre_commit/berksfile_check.rb)
* [`*`BrokenSymlinks](lib/overcommit/hook/pre_commit/broken_symlinks.rb)
* [BundleAudit](lib/overcommit/hook/pre_commit/bundle_audit.rb)
* [BundleCheck](lib/overcommit/hook/pre_commit/bundle_check.rb)
* [BundleOutdated](lib/overcommit/hook/pre_commit/bundle_outdated.rb)
* [`*`CaseConflicts](lib/overcommit/hook/pre_commit/case_conflicts.rb)
* [ChamberSecurity](lib/overcommit/hook/pre_commit/chamber_security.rb)
* [CodeSpellCheck](lib/overcommit/hook/pre_commit/code_spell_check.rb)
* [CoffeeLint](lib/overcommit/hook/pre_commit/coffee_lint.rb)
* [Credo](lib/overcommit/hook/pre_commit/credo.rb)
* [CssLint](lib/overcommit/hook/pre_commit/css_lint.rb)
* [DartAnalyzer](lib/overcommit/hook/pre_commit/dart_analyzer.rb)
* [Dogma](lib/overcommit/hook/pre_commit/dogma.rb)
* [ErbLint](lib/overcommit/hook/pre_commit/erb_lint.rb)
* [EsLint](lib/overcommit/hook/pre_commit/es_lint.rb)
* [ExecutePermissions](lib/overcommit/hook/pre_commit/execute_permissions.rb)
* [Fasterer](lib/overcommit/hook/pre_commit/fasterer.rb)
* [FileSize](lib/overcommit/hook/pre_commit/file_size.rb)
* [FixMe](lib/overcommit/hook/pre_commit/fix_me.rb)
* [Flay](lib/overcommit/hook/pre_commit/flay.rb)
* [Foodcritic](lib/overcommit/hook/pre_commit/foodcritic.rb)
* [ForbiddenBranches](lib/overcommit/hook/pre_commit/forbidden_branches.rb)
* [GoLint](lib/overcommit/hook/pre_commit/go_lint.rb)
* [GoVet](lib/overcommit/hook/pre_commit/go_vet.rb)
* [Hadolint](lib/overcommit/hook/pre_commit/hadolint.rb)
* [LicenseFinder](lib/overcommit/hook/pre_commit/license_finder.rb)
* [HamlLint](lib/overcommit/hook/pre_commit/haml_lint.rb)
* [HardTabs](lib/overcommit/hook/pre_commit/hard_tabs.rb)
* [Hlint](lib/overcommit/hook/pre_commit/hlint.rb)
* [HtmlHint](lib/overcommit/hook/pre_commit/html_hint.rb)
* [HtmlTidy](lib/overcommit/hook/pre_commit/html_tidy.rb)
* [ImageOptim](lib/overcommit/hook/pre_commit/image_optim.rb)
* [JavaCheckstyle](lib/overcommit/hook/pre_commit/java_checkstyle.rb)
* [Jscs](lib/overcommit/hook/pre_commit/jscs.rb)
* [JsHint](lib/overcommit/hook/pre_commit/js_hint.rb)
* [JsLint](lib/overcommit/hook/pre_commit/js_lint.rb)
* [Jsl](lib/overcommit/hook/pre_commit/jsl.rb)
* [JsonSyntax](lib/overcommit/hook/pre_commit/json_syntax.rb)
* [KtLint](lib/overcommit/hook/pre_commit/kt_lint.rb)
* [LicenseHeader](lib/overcommit/hook/pre_commit/license_header.rb)
* [LineEndings](lib/overcommit/hook/pre_commit/line_endings.rb)
* [LocalPathsInGemfile](lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb)
* [Mdl](lib/overcommit/hook/pre_commit/mdl.rb)
* [`*`MergeConflicts](lib/overcommit/hook/pre_commit/merge_conflicts.rb)
* [NginxTest](lib/overcommit/hook/pre_commit/nginx_test.rb)
* [PhpCs](lib/overcommit/hook/pre_commit/php_cs.rb)
* [PhpCsFixer](lib/overcommit/hook/pre_commit/php_cs_fixer.rb)
* [PhpLint](lib/overcommit/hook/pre_commit/php_lint.rb)
* [PhpStan](lib/overcommit/hook/pre_commit/php_stan.rb)
* [Pronto](lib/overcommit/hook/pre_commit/pronto.rb)
* [PuppetLint](lib/overcommit/hook/pre_commit/puppet_lint.rb)
* [PuppetMetadataJsonLint](lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb)
* [Pycodestyle](lib/overcommit/hook/pre_commit/pycodestyle.rb)
* [Pydocstyle](lib/overcommit/hook/pre_commit/pydocstyle.rb)
* [Pyflakes](lib/overcommit/hook/pre_commit/pyflakes.rb)
* [Pylint](lib/overcommit/hook/pre_commit/pylint.rb)
* [PythonFlake8](lib/overcommit/hook/pre_commit/python_flake8.rb)
* [RakeTarget](lib/overcommit/hook/pre_commit/rake_target.rb)
* [RailsBestPractices](lib/overcommit/hook/pre_commit/rails_best_practices.rb)
* [RailsSchemaUpToDate](lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb)
* [Reek](lib/overcommit/hook/pre_commit/reek.rb)
* [RuboCop](lib/overcommit/hook/pre_commit/rubo_cop.rb)
* [RubyLint](lib/overcommit/hook/pre_commit/ruby_lint.rb)
* [RubySyntax](lib/overcommit/hook/pre_commit/ruby_syntax.rb)
* [SwiftLint](lib/overcommit/hook/pre_commit/swift_lint.rb)
* [Scalariform](lib/overcommit/hook/pre_commit/scalariform.rb)
* [Scalastyle](lib/overcommit/hook/pre_commit/scalastyle.rb)
* [ScssLint](lib/overcommit/hook/pre_commit/scss_lint.rb)
* [SemiStandard](lib/overcommit/hook/pre_commit/semi_standard.rb)
* [ShellCheck](lib/overcommit/hook/pre_commit/shell_check.rb)
* [SlimLint](lib/overcommit/hook/pre_commit/slim_lint.rb)
* [Sorbet](lib/overcommit/hook/pre_commit/sorbet.rb)
* [Sqlint](lib/overcommit/hook/pre_commit/sqlint.rb)
* [Standard](lib/overcommit/hook/pre_commit/standard.rb)
* [Stylelint](lib/overcommit/hook/pre_commit/stylelint.rb)
* [TrailingWhitespace](lib/overcommit/hook/pre_commit/trailing_whitespace.rb)
* [TravisLint](lib/overcommit/hook/pre_commit/travis_lint.rb)
* [TsLint](lib/overcommit/hook/pre_commit/ts_lint.rb)
* [Vint](lib/overcommit/hook/pre_commit/vint.rb)
* [W3cCss](lib/overcommit/hook/pre_commit/w3c_css.rb)
* [W3cHtml](lib/overcommit/hook/pre_commit/w3c_html.rb)
* [XmlLint](lib/overcommit/hook/pre_commit/xml_lint.rb)
* [XmlSyntax](lib/overcommit/hook/pre_commit/xml_syntax.rb)
* [YamlLint](lib/overcommit/hook/pre_commit/yaml_lint.rb)
* [YamlSyntax](lib/overcommit/hook/pre_commit/yaml_syntax.rb)
* [YardCoverage](lib/overcommit/hook/pre_commit/yard_coverage.rb)
* [YarnCheck](lib/overcommit/hook/pre_commit/yarn_check.rb)
### PrePush
`pre-push` hooks are run during `git push`, after remote refs have been updated
but before any objects have been transferred. If a hook fails, the push is
aborted.
* [Brakeman](lib/overcommit/hook/pre_push/brakeman.rb)
* [FlutterTest](lib/overcommit/hook/pre_push/flutter_test.rb)
* [Minitest](lib/overcommit/hook/pre_push/minitest.rb)
* [PhpUnit](lib/overcommit/hook/pre_push/php_unit.rb)
* [Pronto](lib/overcommit/hook/pre_push/pronto.rb)
* [ProtectedBranches](lib/overcommit/hook/pre_push/protected_branches.rb)
* [PubTest](lib/overcommit/hook/pre_push/pub_test.rb)
* [Pytest](lib/overcommit/hook/pre_push/pytest.rb)
* [PythonNose](lib/overcommit/hook/pre_push/python_nose.rb)
* [RakeTarget](lib/overcommit/hook/pre_push/rake_target.rb)
* [RSpec](lib/overcommit/hook/pre_push/r_spec.rb)
* [TestUnit](lib/overcommit/hook/pre_push/test_unit.rb)
### PreRebase
`pre-rebase` hooks are run during `git rebase`, before any commits are rebased.
If a hook fails, the rebase is aborted.
* [MergedCommits](lib/overcommit/hook/pre_rebase/merged_commits.rb)
## Repo-Specific hooks
Out of the box, `overcommit` comes with a set of hooks that enforce a variety of
styles and lints. However, some hooks only make sense in the context of a
specific repository.
For example, you can have a number of simple checks that run
against your code to catch common errors. For example, if you use
[RSpec](http://rspec.info/), you can make sure all spec files contain the
line `require 'spec_helper'`.
Inside our repository, we can add the file
`.git-hooks/pre_commit/ensure_spec_helper.rb` in order to automatically check
our spec files:
```ruby
module Overcommit::Hook::PreCommit
class EnsureSpecHelper < Base
def run
errors = []
applicable_files.each do |file|
if File.read(file) !~ /^require 'spec_helper'/
errors << "#{file}: missing `require 'spec_helper'`"
end
end
return :fail, errors.join("\n") if errors.any?
:pass
end
end
end
```
The corresponding configuration for this hook would look like:
```yaml
PreCommit:
EnsureSpecHelper:
enabled: true
description: 'Checking for missing inclusion of spec_helper'
include: '**/*_spec.rb'
```
### Adding Existing Git Hooks
You might already have hook scripts written which you'd like to integrate with
Overcommit right away. To make this easy, Overcommit allows you to include
your hook script in your configuration without writing any Ruby code.
For example:
```yaml
PostCheckout:
CustomScript:
enabled: true
required_executable: './bin/custom-script'
```
So long as a command is given (either by specifying the `command` option
directly or specifying `required_executable`) a special hook is created that
executes the command and appends any arguments and standard input stream that
would have been passed to the regular hook. The hook passes or fails based
on the exit status of the command.
The script is executed as if Git were calling the hook directly. If you want
to understand which arguments are passed to the script depending on the type
of hook, see the [git-hooks documentation][GHD].
[GHD]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
## Security
While Overcommit can make managing Git hooks easier and more convenient,
this convenience can come at a cost of being less secure.
Since installing Overcommit hooks will allow arbitrary plugin code in your
repository to be executed, you expose yourself to an attack where checking
out code from a third party can result in malicious code being executed
on your system.
As an example, consider the situation where you have an open source project.
An attacker could submit a pull request which adds a `post-checkout` hook
that executes some malicious code. When you fetch and checkout this pull
request, the `post-checkout` hook will be run on your machine, along with
the malicious code that you just checked out.
Overcommit attempts to address this problem by storing a signature of your
configuration and all hook plugin code since the last time it ran. When the
signature changes, a warning is displayed alerting you to which plugins have
changed. It is then up to you to manually verify that the changes are not
malicious, and then continue running the hooks.
The signature is derived from the contents of the plugin's source code itself
and any configuration for the plugin. Thus a change to the plugin's source
code or your local repo's `.overcommit.yml` file could result in a signature
change.
### Disabling Signature Checking
In typical usage, your plugins usually don't change too often, so this warning
shouldn't become a nuisance. However, users who work within proprietary
repositories where all developers who can push changes to the repository
already have a minimum security clearance may wish to disable this check.
While not recommended, you can disable signature verification by setting
`verify_signatures` to `false` in your `.overcommit.yml` file.
**Regardless of whether you have `verify_signatures` disabled for your project,
if you are running Overcommit for the first time you will need to sign your
configuration with `overcommit --sign`**. This needs to happen once so
Overcommit can record in your local git repo's configuration (outside of source
control) that you intend to enable/disable verification. This way if someone
else changes `verify_signatures` you'll be asked to confirm the change.
## Contributing
We love contributions to Overcommit, be they bug reports, feature ideas, or
pull requests. See our [guidelines for contributing](CONTRIBUTING.md) to best
ensure your thoughts, ideas, or code get merged.
## Community
All major discussion surrounding Overcommit happens on the
[GitHub issues list](https://github.com/sds/overcommit/issues).
## Changelog
If you're interested in seeing the changes and bug fixes between each version
of `overcommit`, read the [Overcommit Changelog](CHANGELOG.md).
## License
This project is released under the [MIT license](MIT-LICENSE).
The Overcommit logo is adapted from the [Git Logo by Jason Long][GL], and
is licensed under the [Creative Commons Attribution 3.0 Unported License][CC3].
[GL]: https://git-scm.com/downloads/logos
[CC3]: http://creativecommons.org/licenses/by/3.0/
================================================
FILE: bin/overcommit
================================================
#!/usr/bin/env ruby
# frozen_string_literal: true
# Check if Overcommit should invoke a Bundler context for loading gems
require 'yaml'
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
begin
# We need to temporarily silence STDERR to remove annoying Gem specification
# warnings that ultimately don't matter, e.g.
# https://github.com/rubygems/rubygems/issues/1070
old_stderr = $stderr
begin
$stderr = File.new(File::NULL, 'w')
Bundler.setup
ensure
$stderr = old_stderr
end
rescue Bundler::BundlerError => e
puts "Problem loading '#{gemfile}': #{e.message}"
puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
exit 78 # EX_CONFIG
rescue Gem::LoadError => e
# Handle case where user is executing overcommit without `bundle exec` and
# whose local Gemfile has a gem requirement that does not match a gem
# requirement of the installed version of Overcommit.
raise unless e.message =~ /already activated/i
exec('bundle', 'exec', $0, *ARGV)
end
end
begin
require 'overcommit/cli'
rescue LoadError
if gemfile
puts 'You have specified the `gemfile` option in your Overcommit ' \
'configuration but have not added the `overcommit` gem to ' \
"#{gemfile}."
else
raise
end
exit 64 # EX_USAGE
end
logger = Overcommit::Logger.new(STDOUT)
Overcommit::CLI.new(ARGV, STDIN, logger).run
================================================
FILE: config/default.yml
================================================
# Default configuration that all Overcommit configurations inherit from.
#
# This is an opinionated list of which hooks are valuable to run and what their
# out-of-the-box settings should be.
#-------------------------------------------------------------------------------
# Loads Bundler context from a Gemfile. If false, does nothing (default).
#
# Specifying a Gemfile for Bundler to load allows you to control which gems are
# available in the load path (i.e. loadable via `require`) within your hook
# runs. Note that having a Gemfile requires you to include `overcommit` itself
# in your Gemfile (otherwise Overcommit can't load itself!).
#
# This is useful if you want to:
#
# - Enforce a specific version of Overcommit to use for all hook runs
# (or to use a version from the master branch that has not been released yet)
# - Enforce a specific version or unreleased branch is used for a gem you want
# to use in your git hooks
#
# WARNING: This makes your hook runs slower, but you can work around this!
#
# Loading a Bundler context necessarily adds a startup delay to your hook runs
# as Bundler parses the Gemfile and checks that the dependencies are satisfied.
# Thus for projects with many gems this can introduce a noticeable delay.
#
# The recommended workaround is to create a separate Gemfile in the root of your
# repository (call it `.overcommit_gems.rb`), and include only the gems that
# your Overcommit hooks need in order to run. This significantly reduces the
# startup delay in your hook runs. Make sure to commit both
# `.overcommit_gems.rb` and the resulting `.overcommit_gems.rb.lock` file to
# your repository, and then set the `gemfile` option below to the name you gave
# the file.
# (Generate lock file by running `bundle install --gemfile=.overcommit_gems.rb`)
#
# NOTE: the following line will be parsed by a regexp rather than a proper YAML
# parser, so avoid any values other than false or a string, and don't use inline
# comments
gemfile: false
# Where to store hook plugins specific to a repository. These are loaded in
# addition to the default hooks Overcommit comes with. The location is relative
# to the root of the repository.
plugin_directory: '.git-hooks'
# Whether to hide hook output by default. This results in completely silent hook
# runs except in the case of warning or failure.
quiet: false
# Number of hooks that can be run concurrently. Typically this won't need to be
# adjusted, but if you know that some of your hooks themselves use multiple
# processors you can lower this value accordingly. You can define
# single-operator mathematical expressions, e.g. '%{processors} * 2', or
# '%{processors} / 2'.
concurrency: '%{processors}'
# Whether to check if a hook plugin has changed since Overcommit last ran it.
# This is a defense mechanism when working with repositories which can contain
# untrusted code (e.g. when you fetch a pull request from a third party).
# See https://github.com/brigade/overcommit#security for more information.
verify_signatures: true
# Hooks that are run against every commit message after a user has written it.
# These hooks are useful for enforcing policies on commit messages written for a
# project.
CommitMsg:
ALL:
requires_files: false
quiet: false
CapitalizedSubject:
enabled: true
description: 'Check subject capitalization'
EmptyMessage:
enabled: true
description: 'Check for empty commit message'
quiet: true
GerritChangeId:
enabled: false
description: 'Ensure Gerrit Change-Id is present'
required: true
HardTabs:
enabled: false
description: 'Check for hard tabs'
MessageFormat:
enabled: false
description: 'Check commit message matches expected pattern'
pattern: '(.+)[|](.+)[|](.+)'
expected_pattern_message: '<Issue Id> | <Commit Message Description> | <Developer(s)>'
sample_message: 'DEFECT-1234 | Refactored Onboarding flow | John Doe'
RussianNovel:
enabled: false
description: 'Check length of commit message'
quiet: true
SingleLineSubject:
enabled: true
description: 'Check subject line'
SpellCheck:
enabled: false
description: 'Check for misspelled words'
required_executable: 'hunspell'
flags: ['-a']
TextWidth:
enabled: true
description: 'Check text width'
max_subject_width: 60
min_subject_width: 0
max_body_width: 72
TrailingPeriod:
enabled: true
description: 'Check for trailing periods in subject'
# Hooks that are run after `git commit` is executed, before the commit message
# editor is displayed. These hooks are ideal for syntax checkers, linters, and
# other checks that you want to run before you allow a commit object to be
# created.
PreCommit:
ALL:
problem_on_unmodified_line: report
requires_files: true
required: false
quiet: false
AuthorEmail:
enabled: true
description: 'Check author email'
requires_files: false
required: true
quiet: true
pattern: '^[^@]+@.*$'
AuthorName:
enabled: true
description: 'Check for author name'
requires_files: false
required: true
quiet: true
BerksfileCheck:
enabled: false
description: 'Check Berksfile lock'
required_executable: 'berks'
flags: ['list', '--quiet']
install_command: 'gem install berks'
include:
- 'Berksfile'
- 'Berksfile.lock'
BrokenSymlinks:
enabled: true
description: 'Check for broken symlinks'
quiet: true
BundleAudit:
enabled: false
description: 'Check for vulnerable versions of gems'
required_executable: 'bundle-audit'
install_command: 'gem install bundler-audit'
BundleCheck:
enabled: false
description: 'Check Gemfile dependencies'
required_executable: 'bundle'
flags: ['check']
install_command: 'gem install bundler'
include:
- 'Gemfile'
- 'Gemfile.lock'
- '*.gemspec'
BundleOutdated:
enabled: false
description: 'List installed gems with newer versions available'
required_executable: 'bundle'
flags: ['outdated', '--strict', '--parseable']
install_command: 'gem install bundler'
CaseConflicts:
enabled: true
description: 'Check for case-insensitivity conflicts'
quiet: true
ChamberCompare:
enabled: false
description: 'Check that settings are equivalent between namespaces'
required_executable: 'chamber'
flags: ['compare']
install_command: 'gem install chamber'
namespaces:
- ['development']
- ['test']
- ['production']
exclusions: []
include: &chamber_settings_files
- 'config/settings*.yml'
- 'config/settings*.yml.erb'
- 'config/settings/**/*.yml'
- 'config/settings/**/*.yml.erb'
- 'settings*.yml'
- 'settings*.yml.erb'
- 'settings/**/*.yml'
- 'settings/**/*.yml.erb'
ChamberSecurity:
enabled: false
description: 'Check that settings have been secured with Chamber'
required_executable: 'chamber'
flags: ['secure', '--files']
install_command: 'gem install chamber'
include: *chamber_settings_files
ChamberVerification:
enabled: false
description: 'Verify that all settings changes have been approved'
required_executable: 'chamber'
flags: ['sign', '--verify']
install_command: 'gem install chamber'
include: *chamber_settings_files
CodeSpellCheck:
enabled: false
description: 'Check if all your code is spell-checked correctly'
command: 'alfonsox'
install_command: 'gem install alfonsox'
include:
- '**/*.rb'
- '**/*.erb'
CoffeeLint:
enabled: false
description: 'Analyze with coffeelint'
required_executable: 'coffeelint'
flags: ['--reporter=csv']
install_command: 'npm install -g coffeelint'
include: '**/*.coffee'
CookStyle:
enabled: false
description: 'Analyze with CookStyle'
required_executable: 'cookstyle'
flags: ['--format=emacs', '--force-exclusion', '--display-cop-names']
install_command: 'gem install cookstyle'
include:
- '**/*.rb'
- '**/*.erb'
Credo:
enabled: false
description: 'Analyze with credo'
required_executable: 'mix'
flags: ['credo', '--all', '--strict', '--format', 'flycheck']
include:
- '**/*.ex'
- '**/*.exs'
CssLint:
enabled: false
description: 'Analyze with csslint'
required_executable: 'csslint'
flags: ['--quiet', '--format=compact']
install_command: 'npm install -g csslint'
include: '**/*.css'
DartAnalyzer:
enabled: false
description: 'Analyze with dartanalyzer'
required_executable: 'dartanalyzer'
flags: []
include:
- '**/*.dart'
Dogma:
enabled: false
description: 'Analyze with dogma'
required_executable: 'mix'
flags: ['dogma']
include:
- '**/*.ex'
- '**/*.exs'
ErbLint:
enabled: false
description: 'Analyze with ERB Lint'
required_executable: 'erblint'
install_command: 'bundle install erb_lint'
include: '**/*.html.erb'
EsLint:
enabled: false
description: 'Analyze with ESLint'
required_executable: 'eslint'
flags: ['--format=compact']
install_command: 'npm install -g eslint'
include: '**/*.js'
ExecutePermissions:
enabled: false
description: 'Check for file execute permissions'
quiet: true
Fasterer:
enabled: false
description: 'Analyzing for potential speed improvements'
required_executable: 'fasterer'
install_command: 'gem install fasterer'
include: '**/*.rb'
FixMe:
enabled: false
description: 'Check for "token" strings'
required_executable: 'grep'
flags: ['-IEHnw']
keywords: ['BROKEN', 'BUG', 'ERROR', 'FIXME', 'HACK', 'NOTE', 'OPTIMIZE', 'REVIEW', 'TODO', 'WTF', 'XXX']
FileSize:
enabled: false
description: 'Check for oversized files'
size_limit_bytes: 1_000_000
Flay:
enabled: false
description: 'Analyze ruby code for structural similarities with Flay'
required_executable: 'flay'
install_command: 'gem install flay'
mass_threshold: 16
fuzzy: 1
liberal: false
include: '**/*.rb'
Foodcritic:
enabled: false
description: 'Analyze with Foodcritic'
required_executable: 'foodcritic'
flags: ['--epic-fail=any']
install_command: 'gem install foodcritic'
ForbiddenBranches:
enabled: false
description: 'Check for commit to forbidden branch'
quiet: true
branch_patterns: ['master']
GinkgoFocus:
enabled: false
description: 'Check for "focused" tests'
required_executable: 'grep'
flags: ['-IEHnw']
keywords: ['FContext','FDescribe','FIt','FMeasure','FSpecify','FWhen']
GoFmt:
enabled: false
description: 'Fix with go fmt'
required_executable: 'go'
command: ['go', 'fmt']
parallelize: false
include: '**/*.go'
GolangciLint:
enabled: false
description: 'Analyze with golangci-lint'
required_executable: 'golangci-lint'
install_command: 'go get github.com/golangci/golangci-lint/cmd/golangci-lint'
flags: ['--out-format=line-number', '--print-issued-lines=false']
command: ['golangci-lint', 'run']
include: '**/*.go'
GoLint:
enabled: false
description: 'Analyze with golint'
required_executable: 'golint'
install_command: 'go get github.com/golang/lint/golint'
include: '**/*.go'
GoVet:
enabled: false
description: 'Analyze with go vet'
required_executable: 'go'
flags: ['tool', 'vet']
install_command: 'go get golang.org/x/tools/cmd/vet'
include: '**/*.go'
Hadolint:
enabled: false
description: 'Analyze with hadolint'
required_executable: 'hadolint'
include:
- '**/Dockerfile*'
HamlLint:
enabled: false
description: 'Analyze with haml-lint'
required_executable: 'haml-lint'
install_command: 'gem install haml-lint'
flags: ['--no-summary']
include: '**/*.haml'
HardTabs:
enabled: false
description: 'Check for hard tabs'
quiet: true
required_executable: 'grep'
flags: ['-IHn', "\t"]
exclude:
- '**/Makefile'
- '**/*.go'
Hlint:
enabled: false
description: 'Analyze with hlint'
required_executable: 'hlint'
install_command: 'cabal install hlint'
include: '**/*.hs'
HtmlHint:
enabled: false
description: 'Analyze with HTMLHint'
required_executable: 'htmlhint'
install_command: 'npm install -g htmlhint'
include: '**/*.html'
HtmlTidy:
enabled: false
description: 'Analyze HTML with tidy'
required_executable: 'tidy'
flags: ['-errors', '-quiet', '-utf8']
include: '**/*.html'
ImageOptim:
enabled: false
description: 'Check for optimizable images'
required_executable: 'image_optim'
install_command: 'gem install image_optim'
include:
- '**/*.gif'
- '**/*.jpeg'
- '**/*.jpg'
- '**/*.png'
- '**/*.svg'
JavaCheckstyle:
enabled: false
description: 'Analyze with checkstyle'
required_executable: 'checkstyle'
flags: ['-c', '/sun_checks.xml']
include: '**/*.java'
Jscs:
enabled: false
description: 'Analyze with JSCS'
required_executable: 'jscs'
flags: ['--reporter=inline']
install_command: 'npm install -g jscs'
include: '**/*.js'
JsHint:
enabled: false
description: 'Analyze with JSHint'
required_executable: 'jshint'
flags: ['--verbose']
install_command: 'npm install -g jshint'
include: '**/*.js'
JsLint:
enabled: false
description: 'Analyze with JSLint'
required_executable: 'jslint'
flags: ['--terse']
install_command: 'npm install -g jslint'
include: '**/*.js'
Jsl:
enabled: false
description: 'Analyze with JSL'
required_executable: 'jsl'
flags: ['-nologo', '-nofilelisting', '-nocontext', '-nosummary']
include: '**/*.js'
JsonSyntax:
enabled: false
description: 'Validate JSON syntax'
required_library: 'json'
install_command: 'gem install json'
include: '**/*.json'
KtLint:
enabled: false
description: 'Analyze with KtLint'
required_executable: 'ktlint'
flags: []
include: '**/*.kt'
LicenseFinder:
enabled: false
description: 'Analyze with LicenseFinder'
required_executable: 'license_finder'
install_command: 'gem install license_finder'
include:
- 'Gemfile'
- 'requirements.txt'
- 'package.json'
- 'pom.xml'
- 'build.gradle'
- 'bower.json'
- 'Podfile'
- 'rebar.config'
LicenseHeader:
enabled: false
license_file: 'LICENSE.txt'
description: 'Check source files for license headers'
LocalPathsInGemfile:
enabled: false
description: 'Check for local paths in Gemfile'
required_executable: 'grep'
flags: ['-IHnE', "^[^#]*((\\bpath:)|(:path[ \t]*=>))"]
include: '**/Gemfile'
Mdl:
enabled: false
description: 'Analyze markdown files with mdl'
required_executable: 'mdl'
flags: ['--json']
install_command: 'gem install mdl'
include: '**/*.md'
MergeConflicts:
enabled: true
description: 'Check for merge conflicts'
quiet: true
required_executable: 'grep'
flags: ['-IHn', "^<<<<<<<[ \t]"]
MixFormat:
enabled: false
description: 'Check formatting with mix format'
required_executable: 'mix'
flags: ['format', '--check-formatted']
include:
- '**/*.ex'
- '**/*.heex'
- '**/*.exs'
PuppetMetadataJsonLint:
enabled: false
description: 'Checking module metadata'
flags: ['--strict-license', '--strict-dependencies', '--fail-on-warning']
include: 'metadata.json'
required_executable: 'metadata-json-lint'
install_command: 'gem install metadata-json-lint'
NginxTest:
enabled: false
description: 'Test nginx configs'
required_executable: 'nginx'
flags: ['-t']
include: '**/nginx.conf'
Pep257: # Deprecated – use Pydocstyle instead.
enabled: false
description: 'Analyze docstrings with pep257'
required_executable: 'pep257'
install_command: 'pip install pep257'
include: '**/*.py'
Pep8: # Deprecated – use Pycodestyle instead.
enabled: false
description: 'Analyze with pep8'
required_executable: 'pep8'
install_command: 'pip install pep8'
include: '**/*.py'
PhpLint:
enabled: false
description: 'Testing with PHP lint'
required_executable: 'php'
command: 'php'
flags: ['-l']
include: '**/*.php'
PhpCs:
enabled: false
description: 'Analyze with PHP_CodeSniffer'
command: 'vendor/bin/phpcs'
flags: ['--standard=PSR2', '--report=csv']
include: '**/*.php'
PhpCsFixer:
enabled: false
description: 'Fix non compliant PHP files'
required_executable: 'php-cs-fixer'
command: 'vendor/bin/php-cs-fixer'
flags: ['fix', '-v', '--path-mode=intersection']
install_command: 'composer global require friendsofphp/php-cs-fixer'
include: '**/*.php'
PhpStan:
description: 'Analyze with phpstan'
enabled: false
command: 'phpstan'
flags: ['analyze', '--errorFormat=raw']
include:
- '**/*.php'
Pronto:
enabled: false
description: 'Analyzing with pronto'
required_executable: 'pronto'
install_command: 'gem install pronto'
flags: ['run', '--staged', '--exit-code']
PuppetLint:
enabled: false
description: 'Analyze with puppet-lint'
required_executable: 'puppet-lint'
install_command: 'gem install puppet-lint'
flags:
- '--log-format="%{fullpath}:%{line}:%{column}:%{KIND}: %{message} (%{check})"'
- '--fail-on-warnings'
- '--error-level=all'
include: '**/*.pp'
Pycodestyle:
enabled: false
description: 'Analyze with pycodestyle'
required_executable: 'pycodestyle'
install_command: 'pip install pycodestyle'
include: '**/*.py'
Pydocstyle:
enabled: false
description: 'Analyze docstrings with pydocstyle'
required_executable: 'pydocstyle'
install_command: 'pip install pydocstyle'
include: '**/*.py'
Pyflakes:
enabled: false
description: 'Analyze with pyflakes'
required_executable: 'pyflakes'
install_command: 'pip install pyflakes'
include: '**/*.py'
Pylint:
enabled: false
description: 'Analyze with Pylint'
required_executable: 'pylint'
install_command: 'pip install pylint'
flags:
- '--msg-template="{path}:{line}:{C}: {msg} ({symbol})"'
- '--reports=n'
- '--persistent=n'
include: '**/*.py'
PythonFlake8:
enabled: false
description: 'Analyze with flake8'
required_executable: 'flake8'
install_command: 'pip install flake8'
include: '**/*.py'
RakeTarget:
enabled: false
description: 'Run rake targets'
# targets:
# - 'lint'
# - 'validate'
# - '...'
required_executable: 'rake'
install_command: 'gem install rake'
RailsBestPractices:
enabled: false
description: 'Analyze with RailsBestPractices'
required_executable: 'rails_best_practices'
flags: ['--without-color']
install_command: 'gem install rails_best_practices'
RailsSchemaUpToDate:
enabled: false
description: 'Check if database schema is up to date'
include:
- 'db/migrate/*.rb'
- 'db/schema.rb'
- 'db/structure.sql'
Reek:
enabled: false
description: 'Analyze with Reek'
required_executable: 'reek'
flags: ['--single-line', '--no-color', '--force-exclusion']
install_command: 'gem install reek'
include:
- '**/*.gemspec'
- '**/*.rake'
- '**/*.rb'
- '**/Gemfile'
- '**/Rakefile'
RstLint:
enabled: false
description: 'Analyze reStructuredText files with rst-lint'
required_executable: 'rst-lint'
install_command: 'pip install restructuredtext_lint'
include: '**/*.rst'
RSpec:
enabled: false
description: 'Run tests with Rspec'
required_executable: 'rspec'
RuboCop:
enabled: false
description: 'Analyze with RuboCop'
required_executable: 'rubocop'
flags: ['--format=emacs', '--force-exclusion', '--display-cop-names']
install_command: 'gem install rubocop'
include:
- '**/*.gemspec'
- '**/*.rake'
- '**/*.rb'
- '**/*.ru'
- '**/Gemfile'
- '**/Rakefile'
RubyLint:
enabled: false
description: 'Analyze with ruby-lint'
required_executable: 'ruby-lint'
flags: ['--presenter=syntastic', '--levels=error,warning']
install_command: 'gem install ruby-lint'
include:
- '**/*.gemspec'
- '**/*.rb'
RubySyntax:
enabled: false
description: 'Check ruby syntax'
required_executable: 'ruby'
command: [
'ruby',
'-e',
'ARGV.each { |applicable_file| ruby_c_output = `ruby -c #{applicable_file}`; puts ruby_c_output unless $?.success? }'
]
include:
- '**/*.gemspec'
- '**/*.rb'
Scalariform:
enabled: false
description: 'Check formatting with Scalariform'
required_executable: 'scalariform'
flags: ['--test']
include: '**/*.scala'
Scalastyle:
enabled: false
description: 'Analyze with Scalastyle'
required_executable: 'scalastyle'
include: '**/*.scala'
ScssLint:
enabled: false
description: 'Analyze with scss-lint'
required_library: 'json'
required_executable: 'scss-lint'
flags: ['--format', 'JSON']
install_command: 'gem install scss_lint'
include: '**/*.scss'
SemiStandard:
enabled: false
description: 'Analyze with semistandard'
required_executable: 'semistandard'
flags: ['--verbose']
install_command: 'npm install -g semistandard'
include: '**/*.js'
ShellCheck:
enabled: false
description: 'Analyze with ShellCheck'
required_executable: 'shellcheck'
flags: ['--format=gcc']
include: '**/*.sh'
SlimLint:
enabled: false
description: 'Analyze with slim-lint'
required_executable: 'slim-lint'
install_command: 'gem install slim_lint'
include: '**/*.slim'
Solargraph:
enabled: false
description: 'Typecheck with Solargraph'
requires_files: true
required_executable: 'solargraph'
install_command: 'gem install solargraph'
flags: ['typecheck', '--level', 'strong']
include: '**/*.rb'
exclude:
- 'spec/**/*.rb'
- 'test/**/*.rb'
- 'vendor/**/*.rb'
- '.bundle/**/*.rb'
Sorbet:
enabled: false
description: 'Analyze with Sorbet'
required_executable: 'srb'
install_command: 'gem install sorbet'
command: ['srb', 'tc']
include: '**/*.rb'
Sqlint:
enabled: false
description: 'Analyze with sqlint'
required_executable: 'sqlint'
install_command: 'gem install sqlint'
include: '**/*.sql'
Standard:
enabled: false
description: 'Analyze with standard'
required_executable: 'standard'
flags: ['--verbose']
install_command: 'npm install -g standard'
include: '**/*.js'
Stylelint:
enabled: false
description: 'Check styles with Stylelint'
required_executable: 'stylelint'
flags: ['-f', 'compact']
install_command: 'npm install -g stylelint'
include:
- '**/*.scss'
- '**/*.css'
- '**/*.less'
SwiftLint:
enabled: false
description: 'Analyze with SwiftLint'
required_executable: 'swiftlint'
flags: ['lint', '--strict']
install_command: 'brew install swiftlint'
include: '**/*.swift'
TerraformFormat:
enabled: false
description: 'Analyze with Terraform'
required_executable: 'terraform'
flags: ['fmt', '-check=true', '-diff=false']
include: '**/*.tf'
TsLint:
enabled: false
description: 'Analyze with TSLint'
required_executable: 'tslint'
install_command: 'npm install -g tslint typescript'
include: '**/*.ts'
TrailingWhitespace:
enabled: false
description: 'Check for trailing whitespace'
required_executable: 'grep'
flags: ['-IHn', "[ \t]$"]
TravisLint:
enabled: false
description: 'Check Travis CI configuration'
required_executable: 'travis'
flags: ['lint']
install_command: 'gem install travis'
include: '.travis.yml'
Vint:
enabled: false
description: 'Analyze with Vint'
required_executable: 'vint'
install_command: 'pip install vim-vint'
include:
- '**/*.vim'
- '**/*.vimrc'
W3cCss:
enabled: false
description: 'Analyze with W3C CSS validation service'
required_library: 'w3c_validators'
install_command: 'gem install w3c_validators'
validator_uri: 'http://jigsaw.w3.org/css-validator/validator'
language: 'en'
profile: 'css3'
warn_level: 2
include:
- '**/*.css'
W3cHtml:
enabled: false
description: 'Analyze with W3C HTML validation service'
required_library: 'w3c_validators'
install_command: 'gem install w3c_validators'
validator_uri: 'https://validator.w3.org/nu'
charset: 'utf-8'
doctype: 'HTML5'
include:
- '**/*.html'
LineEndings:
description: 'Check line endings'
enabled: false
eol: "\n" # or "\r\n" for Windows-style newlines
XmlLint:
enabled: false
description: 'Analyze with xmllint'
required_executable: 'xmllint'
flags: ['--noout']
include:
- '**/*.xml'
- '**/*.svg'
XmlSyntax:
enabled: false
description: 'Check XML syntax'
required_library: 'rexml/document'
include:
- '**/*.xml'
- '**/*.svg'
YamlLint:
enabled: false
description: 'Analyze with YAMLlint'
required_executable: 'yamllint'
flags: ['--format=parsable', '--strict']
install_command: 'pip install yamllint'
include:
- '**/*.yaml'
- '**/*.yml'
YamlSyntax:
enabled: false
description: 'Check YAML syntax'
required_library: 'yaml'
include:
- '**/*.yaml'
- '**/*.yml'
YardCoverage:
enabled: false
description: 'Checking for yard coverage'
command: ['yard', 'stats', '--list-undoc', '--compact']
flags: ['--private', '--protected']
required_executable: 'yard'
install_command: 'gem install yard'
min_coverage_percentage: 100
include:
- '/**/*.rb'
YarnCheck:
enabled: false
description: 'Check yarn.lock dependencies'
required_executable: 'yarn'
flags: ['check', '--silent', '--no-progress', '--non-interactive']
install_command: 'npm install --global yarn'
include:
- 'package.json'
- 'yarn.lock'
# Hooks that run after HEAD changes or a file is explicitly checked out.
PostCheckout:
ALL:
required: false
quiet: false
skip_file_checkout: true
BowerInstall:
enabled: false
description: 'Install bower dependencies'
requires_files: true
required_executable: 'bower'
install_command: 'npm install -g bower'
flags: ['install']
include: 'bower.json'
BundleInstall:
enabled: false
description: 'Install Bundler dependencies'
requires_files: true
required_executable: 'bundle'
install_command: 'gem install bundler'
flags: ['install']
include:
- 'Gemfile'
- 'Gemfile.lock'
- '*.gemspec'
ComposerInstall:
enabled: false
description: 'Install composer dependencies'
requires_files: true
required_executable: 'composer'
install_command: 'curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer'
flags: ['install']
include: 'composer.json'
GitLfs:
enabled: false
description: 'Check status of lockable files tracked by Git LFS'
required_executable: 'git-lfs'
install_command: 'brew install git-lfs'
IndexTags:
enabled: false
description: 'Generate tags file from source'
quiet: true
required_executable: 'ctags'
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requires_files: true
required_executable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
SubmoduleStatus:
enabled: false
description: 'Check submodule status'
quiet: true
recursive: false
YarnInstall:
enabled: false
description: 'Install Yarn dependencies'
requires_files: true
required_executable: 'yarn'
flags: ['install']
include:
- 'package.json'
- 'yarn.lock'
# Hooks that run after a commit is created.
PostCommit:
ALL:
requires_files: false
required: false
quiet: false
BowerInstall:
enabled: false
description: 'Install bower dependencies'
requires_files: true
required_executable: 'bower'
install_command: 'npm install -g bower'
flags: ['install']
include: 'bower.json'
BundleInstall:
enabled: false
description: 'Install Bundler dependencies'
requires_files: true
required_executable: 'bundle'
install_command: 'gem install bundler'
flags: ['install']
include:
- 'Gemfile'
- 'Gemfile.lock'
- '*.gemspec'
Commitplease:
enabled: false
description: 'Analyze with Commitplease'
required_executable: './node_modules/.bin/commitplease'
install_command: 'npm install --save-dev commitplease'
flags: ['-1']
ComposerInstall:
enabled: false
description: 'Install composer dependencies'
requires_files: true
required_executable: 'composer'
install_command: 'curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer'
flags: ['install']
include: 'composer.json'
GitGuilt:
enabled: false
description: 'Calculate changes in blame since last commit'
requires_files: true
required_executable: 'git-guilt'
flags: ['HEAD~', 'HEAD']
install_command: 'npm install -g git-guilt'
GitLfs:
enabled: false
description: 'Check status of lockable files tracked by Git LFS'
required_executable: 'git-lfs'
install_command: 'brew install git-lfs'
IndexTags:
enabled: false
description: 'Generate tags file from source'
quiet: true
required_executable: 'ctags'
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requires_files: true
required_executable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
SubmoduleStatus:
enabled: false
description: 'Check submodule status'
quiet: true
recursive: false
YarnInstall:
enabled: false
description: 'Install Yarn dependencies'
requires_files: true
required_executable: 'yarn'
flags: ['install']
include:
- 'package.json'
- 'yarn.lock'
# Hooks that run after `git merge` executes successfully (no merge conflicts).
PostMerge:
ALL:
requires_files: false
quiet: false
BowerInstall:
enabled: false
description: 'Install bower dependencies'
requires_files: true
required_executable: 'bower'
install_command: 'npm install -g bower'
flags: ['install']
include: 'bower.json'
BundleInstall:
enabled: false
description: 'Install Bundler dependencies'
requires_files: true
required_executable: 'bundle'
install_command: 'gem install bundler'
flags: ['install']
include:
- 'Gemfile'
- 'Gemfile.lock'
- '*.gemspec'
ComposerInstall:
enabled: false
description: 'Install composer dependencies'
requires_files: true
required_executable: 'composer'
install_command: 'curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer'
flags: ['install']
include: 'composer.json'
GitLfs:
enabled: false
description: 'Check status of lockable files tracked by Git LFS'
required_executable: 'git-lfs'
install_command: 'brew install git-lfs'
IndexTags:
enabled: false
description: 'Generate tags file from source'
quiet: true
required_executable: 'ctags'
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requires_files: true
required_executable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
SubmoduleStatus:
enabled: false
description: 'Check submodule status'
quiet: true
recursive: false
YarnInstall:
enabled: false
description: 'Install Yarn dependencies'
requires_files: true
required_executable: 'yarn'
flags: ['install']
include:
- 'package.json'
- 'yarn.lock'
# Hooks that run after a commit is modified by an amend or rebase.
PostRewrite:
ALL:
requires_files: false
quiet: false
BowerInstall:
enabled: false
description: 'Install bower dependencies'
requires_files: true
required_executable: 'bower'
install_command: 'npm install -g bower'
flags: ['install']
include: 'bower.json'
BundleInstall:
enabled: false
description: 'Install Bundler dependencies'
requires_files: true
required_executable: 'bundle'
install_command: 'gem install bundler'
flags: ['install']
include:
- 'Gemfile'
- 'Gemfile.lock'
- '*.gemspec'
ComposerInstall:
enabled: false
description: 'Install composer dependencies'
requires_files: true
required_executable: 'composer'
install_command: 'curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer'
flags: ['install']
include: 'composer.json'
IndexTags:
enabled: false
description: 'Generate tags file from source'
quiet: true
required_executable: 'ctags'
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requires_files: true
required_executable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
SubmoduleStatus:
enabled: false
description: 'Check submodule status'
quiet: true
recursive: false
YarnInstall:
enabled: false
description: 'Install Yarn dependencies'
requires_files: true
required_executable: 'yarn'
flags: ['install']
include:
- 'package.json'
- 'yarn.lock'
# Hooks that run during the `prepare-commit-msg` hook.
PrepareCommitMsg:
ALL:
requires_files: false
required: false
quiet: false
ReplaceBranch:
enabled: false
description: 'Prepends the commit message with text based on the branch name'
branch_pattern: '\A(\d+)-(\w+).*\z'
replacement_text: '[#\1]'
skipped_commit_types:
- 'message' # if message is given via `-m`, `-F`
- 'template' # if `-t` is given or `commit.template` is set
- 'commit' # if `-c`, `-C`, or `--amend` is given
- 'merge' # if merging
- 'squash' # if squashing
on_fail: warn
# Hooks that run during `git push`, after remote refs have been updated but
# before any objects have been transferred.
PrePush:
ALL:
requires_files: false
required: false
quiet: false
Brakeman:
enabled: false
description: 'Check for security vulnerabilities'
required_executable: 'brakeman'
flags: ['--exit-on-warn', '--quiet', '--summary']
install_command: 'gem install brakeman'
CargoTest:
enabled: false
description: 'Run tests with cargo'
required_executable: 'cargo'
flags: ['test']
include: 'src/**/*.rs'
FlutterTest:
enabled: false
description: 'Run flutter test suite'
required_executable: 'flutter'
flags: ['test']
GitLfs:
enabled: false
description: 'Upload files tracked by Git LFS'
required_executable: 'git-lfs'
install_command: 'brew install git-lfs'
GolangciLint:
enabled: false
description: 'Analyze with golangci-lint'
required_executable: 'golangci-lint'
install_command: 'go get github.com/golangci/golangci-lint/cmd/golangci-lint'
flags: ['--out-format=line-number', '--print-issued-lines=false']
command: ['golangci-lint', 'run']
GoTest:
enabled: false
description: 'Run go test suite'
required_executable: 'go'
command: ['go', 'test', './...']
Minitest:
enabled: false
description: 'Run Minitest test suite'
command: ['ruby', '-Ilib:test', '-rminitest', "-e 'exit! Minitest.run'"]
include: 'test/**/*_test.rb'
MixTest:
enabled: false
description: 'Run mix test suite'
required_executable: 'mix'
flags: ['test']
PhpUnit:
enabled: false
description: 'Run PhpUnit test suite'
command: 'vendor/bin/phpunit'
flags: ['--bootstrap', 'vendor/autoload.php', 'tests']
install_command: 'composer require --dev phpunit/phpunit'
Pronto:
enabled: false
description: 'Analyzing with pronto'
required_executable: 'pronto'
install_command: 'gem install pronto'
flags: ['run', '--exit-code']
ProtectedBranches:
enabled: false
description: 'Check for illegal pushes to protected branches'
destructive_only: true
branches: ['master']
PubTest:
enabled: false
description: 'Run pub test suite'
required_executable: 'pub'
flags: ['run', 'test']
Pytest:
enabled: false
description: 'Run pytest test suite'
required_executable: 'pytest'
install_command: 'pip install -U pytest'
PythonNose:
enabled: false
description: 'Run nose test suite'
required_executable: 'nosetests'
install_command: 'pip install -U nose'
RSpec:
enabled: false
description: 'Run RSpec test suite'
required_executable: 'rspec'
RakeTarget:
enabled: false
description: 'Run rake targets'
# targets:
# - 'lint'
# - 'validate'
# - '...'
required_executable: 'rake'
install_command: 'gem install rake'
TestUnit:
enabled: false
description: 'Run Test::Unit test suite'
command: ['ruby', '-Ilib:test', '-rtest/unit', "-e 'exit! Test::Unit::AutoRunner.run'"]
# Hooks that run during `git rebase`, before any commits are rebased.
# If a hook fails, the rebase is aborted.
PreRebase:
ALL:
requires_files: false
required: false
quiet: false
MergedCommits:
enabled: false
description: 'Check for commits that have already been merged'
branches: ['master']
================================================
FILE: config/starter.yml
================================================
# Use this file to configure the Overcommit hooks you wish to use. This will
# extend the default configuration defined in:
# https://github.com/sds/overcommit/blob/master/config/default.yml
#
# At the topmost level of this YAML file is a key representing type of hook
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
# customize each hook, such as whether to only run it on certain files (via
# `include`), whether to only display output if it fails (via `quiet`), etc.
#
# For a complete list of hooks, see:
# https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
#
# For a complete list of options that you can use to customize hooks, see:
# https://github.com/sds/overcommit#configuration
#
# Uncomment the following lines to make the configuration take effect.
#PreCommit:
# RuboCop:
# enabled: true
# on_warn: fail # Treat all warnings as failures
#
# TrailingWhitespace:
# enabled: true
# exclude:
# - '**/db/structure.sql' # Ignore trailing whitespace in generated files
#
#PostCheckout:
# ALL: # Special hook name that customizes all hooks of this type
# quiet: true # Change all post-checkout hooks to only display output on failure
#
# IndexTags:
# enabled: true # Generate a tags file with `ctags` each time HEAD changes
================================================
FILE: lib/overcommit/cli.rb
================================================
# frozen_string_literal: true
require 'overcommit'
require 'optparse'
module Overcommit
# Responsible for parsing command-line options and executing appropriate
# application logic based on those options.
class CLI # rubocop:disable Metrics/ClassLength
def initialize(arguments, input, logger)
@arguments = arguments
@cli_options = {}
@input = input
@log = logger
@options = {}
Overcommit::Utils.log = logger
end
def run
parse_arguments
case @options[:action]
when :install, :uninstall
install_or_uninstall
when :template_dir
print_template_directory_path
when :sign
sign
when :run_all
run_all
when :diff
diff
end
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
puts e
exit 78 # EX_CONFIG
rescue Overcommit::Exceptions::HookContextLoadError => e
puts e
exit 64 # EX_USAGE
end
private
attr_reader :log
def parse_arguments
@parser = create_option_parser
begin
@parser.parse!(@arguments, into: @cli_options)
# Default action is to install
@options[:action] ||= :install
# Unconsumed arguments are our targets
@options[:targets] = @arguments
rescue OptionParser::InvalidOption => e
print_help @parser.help, e
end
end
def create_option_parser
OptionParser.new do |opts|
opts.banner = "Usage: #{opts.program_name} [options] [target-repo]"
add_information_options(opts)
add_installation_options(opts)
add_other_options(opts)
end
end
def add_information_options(opts)
opts.on_tail('-h', '--help', 'Show this message') do
print_help opts.help
end
opts.on_tail('-v', '--version', 'Show version') do
print_version(opts.program_name)
end
opts.on_tail('-l', '--list-hooks', 'List installed hooks') do
print_installed_hooks
end
end
def add_installation_options(opts)
opts.on('-u', '--uninstall', 'Remove Overcommit hooks from a repository') do
@options[:action] = :uninstall
end
opts.on('-i', '--install', 'Install Overcommit hooks in a repository') do
@options[:action] = :install
end
opts.on('-f', '--force', 'Overwrite any previously installed hooks') do
@options[:force] = true
end
opts.on('-r [hook]', '--run [hook]', 'Run specified hook against all git tracked files. Defaults to `pre_commit`.') do |arg| # rubocop:disable Layout/LineLength
@options[:action] = :run_all
@options[:hook_to_run] = arg ? arg.to_s : 'run-all'
end
opts.on('--diff [ref]', 'Run pre_commit hooks against the diff between a given ref. Defaults to `main`.') do |arg| # rubocop:disable Layout/LineLength
@options[:action] = :diff
arg
end
end
def add_other_options(opts)
opts.on('-s', '--sign [hook]', 'Update hook signatures', String) do |hook_to_sign|
@options[:hook_to_sign] = hook_to_sign if hook_to_sign.is_a?(String)
@options[:action] = :sign
end
opts.on('-t', '--template-dir', 'Print location of template directory') do
@options[:action] = :template_dir
end
end
def install_or_uninstall
if Array(@options[:targets]).empty?
@options[:targets] = [Overcommit::Utils.repo_root].compact
end
if @options[:targets].empty?
log.warning 'You are not in a git repository.'
log.log 'You must either specify the path to a repository or ' \
'change your current directory to a repository.'
halt 64 # EX_USAGE
end
@options[:targets].each do |target|
Installer.new(log).run(target, @options)
rescue Overcommit::Exceptions::InvalidGitRepo => e
log.warning "Invalid repo #{target}: #{e}"
halt 69 # EX_UNAVAILABLE
rescue Overcommit::Exceptions::PreExistingHooks => e
log.warning "Unable to install into #{target}: #{e}"
halt 73 # EX_CANTCREAT
end
end
def print_template_directory_path
puts File.join(Overcommit::HOME, 'template-dir')
halt
end
def print_help(message, error = nil)
log.error "#{error}\n" if error
log.log message
halt(error ? 64 : 0) # 64 = EX_USAGE
end
def print_version(program_name)
log.log "#{program_name} #{Overcommit::VERSION}"
halt
end
# Prints the hooks available in the current repo and whether they're
# enabled/disabled.
def print_installed_hooks
config.all_hook_configs.each do |hook_type, hook_configs|
print_hooks_for_hook_type(config, hook_configs, hook_type)
end
halt
end
def print_hooks_for_hook_type(repo_config, hook_configs, hook_type)
log.log "#{hook_type}:"
hook_configs.each do |hook_name, config|
log.partial " #{hook_name}: "
if config['enabled']
log.success('enabled', true)
else
log.error('disabled', true)
end
if repo_config.plugin_hook?(hook_type, hook_name)
log.warning(' (plugin)')
else
log.newline
end
end
end
def sign
if @options[:hook_to_sign]
context = Overcommit::HookContext.create(@options[:hook_to_sign],
config,
@arguments,
@input)
Overcommit::HookLoader::PluginHookLoader.new(config,
context,
log).update_signatures
else
log.log 'Updating signature for configuration file...'
config(verify: false).update_signature!
end
halt
end
def run_all
empty_stdin = File.open(File::NULL) # pre-commit hooks don't take input
context = Overcommit::HookContext.create(@options[:hook_to_run], config, @arguments, empty_stdin) # rubocop:disable Layout/LineLength
config.apply_environment!(context, ENV)
printer = Overcommit::Printer.new(config, log, context)
runner = Overcommit::HookRunner.new(config, log, context, printer)
status = runner.run
halt(status ? 0 : 65)
end
def diff
empty_stdin = File.open(File::NULL) # pre-commit hooks don't take input
context = Overcommit::HookContext.create('diff', config, @arguments, empty_stdin, **@cli_options) # rubocop:disable Layout/LineLength
config.apply_environment!(context, ENV)
printer = Overcommit::Printer.new(config, log, context)
runner = Overcommit::HookRunner.new(config, log, context, printer)
status = runner.run
halt(status ? 0 : 65)
end
# Used for ease of stubbing in tests
def halt(status = 0)
exit status
end
# Returns the configuration for this repository.
def config(options = {})
@config ||= Overcommit::ConfigurationLoader.new(log, options).load_repo_config
end
end
end
================================================
FILE: lib/overcommit/command_splitter.rb
================================================
# frozen_string_literal: true
module Overcommit
# Distributes a list of arguments over multiple invocations of a command.
#
# This accomplishes the same functionality provided by `xargs` but in a
# cross-platform way that does not require any pre-existing tools.
#
# One of the tradeoffs with this approach is that we no longer deal with a
# single exit status from a command, but multiple (one for each invocation).
#
# This will return a struct similar to `Subprocess::Result` but with
# additional `statuses`, `stdouts`, and `stderrs` fields so hook authors can
# actually see the results of each invocation. If they don't care, the
# standard `status`, `stdout`, and `stderr` will still work but be a
# aggregation/concatenation of all statuses/outputs.
class CommandSplitter
# Encapsulates the result of a split argument run.
#
# @attr_reader statuses [Array<Integer>] status codes for invocations
# @attr_reader stdouts [Array<String>] standard outputs from invocations
# @attr_reader stderrs [Array<String>] standard error outputs from invocations
Result = Struct.new(:statuses, :stdouts, :stderrs) do
# Returns whether all invocations were successful.
#
# @return [true,false]
def success?
status == 0
end
# Returns `0` if all invocations returned `0`; `1` otherwise.
#
# @return [true,false]
def status
statuses.all? { |code| code == 0 } ? 0 : 1
end
# Returns concatenated standard output streams of all invocations in the
# order they were executed.
#
# @return [String]
def stdout
stdouts.join
end
# Returns concatenated standard error streams of all invocations in the
# order they were executed.
#
# @return [String]
def stderr
stderrs.join
end
end
class << self
def execute(initial_args, options)
options = options.dup
if (splittable_args = (options.delete(:args) { [] })).empty?
raise Overcommit::Exceptions::InvalidCommandArgs,
'Must specify list of arguments to split on'
end
# Execute each chunk of arguments in serial. We don't parallelize (yet)
# since in theory we want to support parallelization at the hook level
# and not within individual hooks.
results = extract_argument_lists(initial_args, splittable_args).map do |arg_list|
Overcommit::Subprocess.spawn(arg_list, options)
end
Result.new(results.map(&:status), results.map(&:stdout), results.map(&:stderr))
end
private
# Given a list of prefix arguments and suffix arguments that can be split,
# returns a list of argument lists that are executable on the current OS
# without exceeding command line limitations.
def extract_argument_lists(args, splittable_args)
# Total number of bytes needed to contain the prefix command
# (including byte separators between each argument)
prefix_bytes = (args.size - 1) + args.reduce(0) { |sum, arg| sum + arg.bytesize }
if prefix_bytes >= max_command_length
raise Overcommit::Exceptions::InvalidCommandArgs,
"Command `#{args.take(5).join(' ')} ...` is longer than the " \
'maximum number of bytes allowed by the operating system ' \
"(#{max_command_length})"
end
arg_lists = []
index = 0
while index <= splittable_args.length - 1
arg_list, index = arguments_under_limit(splittable_args,
index,
max_command_length - prefix_bytes)
arg_lists << args + arg_list
end
arg_lists
end
# @return [Array<Array<String>, Integer>] tuple of arguments and new index
def arguments_under_limit(splittable_args, start_index, byte_limit)
index = start_index
total_bytes = 0
loop do
break if index > splittable_args.length - 1
total_bytes += splittable_args[index].bytesize
break if total_bytes > byte_limit # Not enough room
index += 1
end
if index == start_index
# No argument was consumed; perhaps a really long argument?
raise Overcommit::Exceptions::InvalidCommandArgs,
"Argument `#{splittable_args[index][0..5]}...` exceeds the " \
'maximum command length when appended to command prefix and ' \
"can't be split further"
end
[splittable_args[start_index...index], index]
end
# Returns the maximum number of arguments allowed in a single command on
# this system.
#
# @return [Integer]
def max_command_length
@max_command_length ||=
if Gem.win_platform?
# Windows is limited to 2048 since that is a worst-case scenario.
# http://blogs.msdn.com/b/oldnewthing/archive/2003/12/10/56028.aspx
2048
else
# We fudge factor this by halving the buffer size since *nix systems
# usually have pretty large limits, and the actual limit changes
# depending on how much of your stack is environment variables.
# Definitely erring on the side of overly cautious.
`getconf ARG_MAX`.to_i / 2
end
end
end
end
end
================================================
FILE: lib/overcommit/configuration.rb
================================================
# frozen_string_literal: true
require 'digest'
require 'json'
module Overcommit
# Stores configuration for Overcommit and the hooks it runs.
class Configuration # rubocop:disable Metrics/ClassLength
# Creates a configuration from the given hash.
#
# @param hash [Hash] loaded YAML config file as a hash
# @param options [Hash]
# @option default [Boolean] whether this is the default built-in configuration
# @option logger [Overcommit::Logger]
def initialize(hash, options = {})
@options = options.dup
@options[:logger] ||= Overcommit::Logger.silent
@hash = hash # Assign so validator can read original values
unless options[:validate] == false
@hash = Overcommit::ConfigurationValidator.new.validate(self, hash, options)
end
end
def ==(other)
super || @hash == other.hash
end
# Access the configuration as if it were a hash.
#
# @param key [String]
# @return [Array,Hash,Number,String]
def [](key)
@hash[key]
end
# Returns absolute path to the directory that external hook plugins should
# be loaded from.
def plugin_directory
File.join(Overcommit::Utils.repo_root, @hash['plugin_directory'] || '.git-hooks')
end
def concurrency
@concurrency ||=
begin
cores = Overcommit::Utils.processor_count
content = @hash.fetch('concurrency') { '%<processors>d' }
if content.is_a?(String)
concurrency_expr = content % { processors: cores }
a, op, b = concurrency_expr.scan(%r{(\d+)\s*([+\-*\/])\s*(\d+)})[0]
if a
a.to_i.send(op, b.to_i)
else
concurrency_expr.to_i
end
else
content.to_i
end
end
end
# Returns configuration for all hooks in each hook type.
#
# @return [Hash]
def all_hook_configs
smart_merge(all_builtin_hook_configs, all_plugin_hook_configs)
end
# Returns configuration for all built-in hooks in each hook type.
#
# @return [Hash]
def all_builtin_hook_configs
hook_configs = {}
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
hook_names = @hash[hook_type].keys.reject { |name| name == 'ALL' }
hook_configs[hook_type] = Hash[
hook_names.map do |hook_name|
[hook_name, for_hook(hook_name, hook_type)]
end
]
end
hook_configs
end
# Returns configuration for all plugin hooks in each hook type.
#
# @return [Hash]
def all_plugin_hook_configs
hook_configs = {}
Overcommit::Utils.supported_hook_types.each do |hook_type|
hook_type_class_name = Overcommit::Utils.camel_case(hook_type)
directory = File.join(plugin_directory, hook_type.tr('-', '_'))
plugin_paths = Dir[File.join(directory, '*.rb')].sort
hook_names = plugin_paths.map do |path|
Overcommit::Utils.camel_case(File.basename(path, '.rb'))
end
hook_configs[hook_type_class_name] = Hash[
hook_names.map do |hook_name|
[hook_name, for_hook(hook_name, Overcommit::Utils.camel_case(hook_type))]
end
]
end
hook_configs
end
# Returns the built-in hooks that have been enabled for a hook type.
def enabled_builtin_hooks(hook_context)
@hash[hook_context.hook_class_name].keys.
reject { |hook_name| hook_name == 'ALL' }.
select { |hook_name| built_in_hook?(hook_context, hook_name) }.
select { |hook_name| hook_enabled?(hook_context, hook_name) }
end
# Returns the ad hoc hooks that have been enabled for a hook type.
def enabled_ad_hoc_hooks(hook_context)
@hash[hook_context.hook_class_name].keys.
reject { |hook_name| hook_name == 'ALL' }.
select { |hook_name| ad_hoc_hook?(hook_context, hook_name) }.
select { |hook_name| hook_enabled?(hook_context, hook_name) }
end
# Returns a non-modifiable configuration for a hook.
def for_hook(hook, hook_type = nil)
unless hook_type
components = hook.class.name.split('::')
hook = components.last
hook_type = components[-2]
end
# Merge hook configuration with special 'ALL' config
hook_config = smart_merge(@hash[hook_type]['ALL'], @hash[hook_type][hook] || {})
# Need to specially handle `enabled` option since not setting it does not
# necessarily mean the hook is disabled
hook_config['enabled'] = hook_enabled?(hook_type, hook)
hook_config.freeze
end
# Merges the given configuration with this one, returning a new
# {Configuration}. The provided configuration will either add to or replace
# any options defined in this configuration.
def merge(config)
self.class.new(smart_merge(@hash, config.hash))
end
# Applies additional configuration settings based on the provided
# environment variables.
def apply_environment!(hook_context, env)
skipped_hooks = "#{env['SKIP']} #{env['SKIP_CHECKS']} #{env['SKIP_HOOKS']}".split(/[:, ]/)
only_hooks = env.fetch('ONLY') { '' }.split(/[:, ]/)
hook_type = hook_context.hook_class_name
if only_hooks.any? || skipped_hooks.include?('all') || skipped_hooks.include?('ALL')
@hash[hook_type]['ALL']['skip'] = true
end
only_hooks.select { |hook_name| hook_exists?(hook_context, hook_name) }.
map { |hook_name| Overcommit::Utils.camel_case(hook_name) }.
each do |hook_name|
@hash[hook_type][hook_name] ||= {}
@hash[hook_type][hook_name]['skip'] = false
end
skipped_hooks.select { |hook_name| hook_exists?(hook_context, hook_name) }.
map { |hook_name| Overcommit::Utils.camel_case(hook_name) }.
each do |hook_name|
@hash[hook_type][hook_name] ||= {}
@hash[hook_type][hook_name]['skip'] = true
end
end
def plugin_hook?(hook_context_or_type, hook_name)
hook_type_name =
if hook_context_or_type.is_a?(String)
Overcommit::Utils.snake_case(hook_context_or_type)
else
hook_context_or_type.hook_type_name
end
hook_name = Overcommit::Utils.snake_case(hook_name)
File.exist?(File.join(plugin_directory, hook_type_name, "#{hook_name}.rb"))
end
# Return whether the signature for this configuration has changed since it
# was last calculated.
#
# @return [true,false]
def signature_changed?
signature != stored_signature
end
# Return whether a previous signature has been recorded for this
# configuration.
#
# @return [true,false]
def previous_signature?
!stored_signature.empty?
end
# Returns whether this configuration should verify itself by checking the
# stored configuration for the repo.
#
# @return [true,false]
def verify_signatures?
return false if ENV['OVERCOMMIT_NO_VERIFY']
return true if @hash['verify_signatures'] != false
result = Overcommit::Utils.execute(
%W[git config --local --get #{verify_signature_config_key}]
)
if result.status == 1 # Key doesn't exist
return true
elsif result.status != 0
raise Overcommit::Exceptions::GitConfigError,
"Unable to read from local repo git config: #{result.stderr}"
end
# We don't cast since we want to allow anything to count as "true" except
# a literal zero
result.stdout.strip != '0'
end
# Update the currently stored signature for this hook.
def update_signature!
result = Overcommit::Utils.execute(
%w[git config --local] + [signature_config_key, signature]
)
verify_signature_value = @hash['verify_signatures'] ? 1 : 0
result &&= Overcommit::Utils.execute(
%W[git config --local #{verify_signature_config_key} #{verify_signature_value}]
)
unless result.success?
raise Overcommit::Exceptions::GitConfigError,
"Unable to write to local repo git config: #{result.stderr}"
end
end
protected
attr_reader :hash
private
def ad_hoc_hook?(hook_context, hook_name)
ad_hoc_conf = @hash.fetch(hook_context.hook_class_name) { {} }.fetch(hook_name) { {} }
# Ad hoc hooks are neither built-in nor have a plugin file written but
# still have a `command` specified to be run
!built_in_hook?(hook_context, hook_name) &&
!plugin_hook?(hook_context, hook_name) &&
(ad_hoc_conf['command'] || ad_hoc_conf['required_executable'])
end
def built_in_hook?(hook_context, hook_name)
hook_name = Overcommit::Utils.snake_case(hook_name)
File.exist?(File.join(Overcommit::HOME, 'lib', 'overcommit', 'hook',
hook_context.hook_type_name, "#{hook_name}.rb"))
end
def hook_exists?(hook_context, hook_name)
built_in_hook?(hook_context, hook_name) ||
plugin_hook?(hook_context, hook_name) ||
ad_hoc_hook?(hook_context, hook_name)
end
def hook_enabled?(hook_context_or_type, hook_name)
hook_type =
if hook_context_or_type.is_a?(String)
hook_context_or_type
else
hook_context_or_type.hook_class_name
end
individual_enabled = @hash[hook_type].fetch(hook_name) { {} }['enabled']
return individual_enabled unless individual_enabled.nil?
all_enabled = @hash[hook_type]['ALL']['enabled']
return all_enabled unless all_enabled.nil?
false
end
def smart_merge(parent, child)
# Treat the ALL hook specially so that it overrides any configuration
# specified by the default configuration.
child_all = child['ALL']
unless child_all.nil?
parent = Hash[parent.collect { |k, v| [k, smart_merge(v, child_all)] }]
end
parent.merge(child) do |_key, old, new|
case old
when Hash
smart_merge(old, new)
else
new
end
end
end
# Returns the unique signature of this configuration.
#
# @return [String]
def signature
Digest::SHA256.hexdigest(@hash.to_json)
end
# Returns the stored signature of this repo's Overcommit configuration.
#
# This is intended to be compared against the current signature of this
# configuration object.
#
# @return [String]
def stored_signature
result = Overcommit::Utils.execute(
%w[git config --local --get] + [signature_config_key]
)
if result.status == 1 # Key doesn't exist
return ''
elsif result.status != 0
raise Overcommit::Exceptions::GitConfigError,
"Unable to read from local repo git config: #{result.stderr}"
end
result.stdout.chomp
end
def signature_config_key
'overcommit.configuration.signature'
end
def verify_signature_config_key
'overcommit.configuration.verifysignatures'
end
end
end
================================================
FILE: lib/overcommit/configuration_loader.rb
================================================
# frozen_string_literal: true
require 'yaml'
module Overcommit
# Manages configuration file loading.
class ConfigurationLoader
DEFAULT_CONFIG_PATH = File.join(Overcommit::HOME, 'config', 'default.yml')
class << self
# Loads and returns the default configuration.
#
# @return [Overcommit::Configuration]
def default_configuration
@default_configuration ||= load_from_file(DEFAULT_CONFIG_PATH, default: true, verify: false)
end
# Loads configuration from file.
#
# @param file [String] path to file
# @param options [Hash]
# @option default [Boolean] whether this is the default built-in configuration
# @option verify [Boolean] whether to verify the signature of the configuration
# @option logger [Overcommit::Logger]
# @return [Overcommit::Configuration]
def load_from_file(file, options = {})
# Psych 4 introduced breaking behavior that doesn't support aliases by
# default. Explicitly enable aliases if the option is available.
yaml =
begin
YAML.load_file(file, aliases: true)
rescue ArgumentError
YAML.load_file(file)
end
hash = yaml ? yaml.to_hash : {}
Overcommit::Configuration.new(hash, options)
end
end
# Create a configuration loader which writes warnings/errors to the given
# {Overcommit::Logger} instance.
#
# @param logger [Overcommit::Logger]
# @param options [Hash]
# @option verify [Boolean] whether to verify signatures
def initialize(logger, options = {})
@log = logger
@options = options
end
# Loads and returns the configuration for the repository we're running in.
#
# @return [Overcommit::Configuration]
def load_repo_config
overcommit_local_yml = File.join(Overcommit::Utils.repo_root,
Overcommit::LOCAL_CONFIG_FILE_NAME)
overcommit_yml = File.join(Overcommit::Utils.repo_root,
Overcommit::CONFIG_FILE_NAME)
if File.exist?(overcommit_local_yml) && File.exist?(overcommit_yml)
load_file(overcommit_yml, overcommit_local_yml)
elsif File.exist?(overcommit_yml)
load_file(overcommit_yml)
else
self.class.default_configuration
end
end
# Loads a configuration, ensuring it extends the default configuration.
def load_file(file, local_file = nil)
overcommit_config = self.class.load_from_file(file, default: false, logger: @log)
l_config = self.class.load_from_file(local_file, default: false, logger: @log) if local_file
config = self.class.default_configuration.merge(overcommit_config)
config = config.merge(l_config) if l_config
if @options.fetch(:verify) { config.verify_signatures? }
verify_signatures(config)
end
config
rescue Overcommit::Exceptions::ConfigurationSignatureChanged
raise
rescue StandardError => e
raise Overcommit::Exceptions::ConfigurationError,
"Unable to load configuration from '#{file}': #{e}",
e.backtrace
end
private
def verify_signatures(config)
if !config.previous_signature?
raise Overcommit::Exceptions::ConfigurationSignatureChanged,
"No previously recorded signature for configuration file.\n" \
'Run `overcommit --sign` if you trust the hooks in this repository.'
elsif config.signature_changed?
raise Overcommit::Exceptions::ConfigurationSignatureChanged,
"Signature of configuration file has changed!\n" \
"Run `overcommit --sign` once you've verified the configuration changes."
end
end
end
end
================================================
FILE: lib/overcommit/configuration_validator.rb
================================================
# frozen_string_literal: true
# rubocop:disable Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/MethodLength
module Overcommit
# Validates and normalizes a configuration.
class ConfigurationValidator
# Validates hash for any invalid options, normalizing where possible.
#
# @param config [Overcommit::Configuration]
# @param hash [Hash] hash representation of YAML config
# @param options[Hash]
# @option default [Boolean] whether hash represents the default built-in config
# @option logger [Overcommit::Logger] logger to output warnings to
# @return [Hash] validated hash (potentially modified)
def validate(config, hash, options)
@options = options.dup
@log = options[:logger]
hash = convert_nils_to_empty_hashes(hash)
ensure_hook_type_sections_exist(hash)
check_hook_name_format(hash)
check_hook_env(hash)
check_for_missing_enabled_option(hash) unless @options[:default]
check_for_too_many_processors(config, hash)
check_for_verify_plugin_signatures_option(hash)
hash
end
private
# Ensures that keys for all supported hook types exist (PreCommit,
# CommitMsg, etc.)
def ensure_hook_type_sections_exist(hash)
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
hash[hook_type] ||= {}
hash[hook_type]['ALL'] ||= {}
end
end
# Normalizes `nil` values to empty hashes.
#
# This is useful for when we want to merge two configuration hashes
# together, since it's easier to merge two hashes than to have to check if
# one of the values is nil.
def convert_nils_to_empty_hashes(hash)
hash.each_with_object({}) do |(key, value), h|
h[key] =
case value
when nil then {}
when Hash then convert_nils_to_empty_hashes(value)
else
value
end
end
end
def check_hook_env(hash)
errors = []
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
hash.fetch(hook_type) { {} }.each do |hook_name, hook_config|
hook_env = hook_config.fetch('env') { {} }
unless hook_env.is_a?(Hash)
errors << "#{hook_type}::#{hook_name} has an invalid `env` specified: " \
'must be a hash of environment variable name to string value.'
next
end
hook_env.each do |var_name, var_value|
if var_name.include?('=')
errors << "#{hook_type}::#{hook_name} has an invalid `env` specified: " \
"variable name `#{var_name}` cannot contain `=`."
end
unless var_value.nil? || var_value.is_a?(String)
errors << "#{hook_type}::#{hook_name} has an invalid `env` specified: " \
"value of `#{var_name}` must be a string or `nil`, but was " \
"#{var_value.inspect} (#{var_value.class})"
end
end
end
end
if errors.any?
if @log
@log.error errors.join("\n")
@log.newline
end
raise Overcommit::Exceptions::ConfigurationError,
'One or more hooks had an invalid `env` configuration option'
end
end
# Prints an error message and raises an exception if a hook has an
# invalid name, since this can result in strange errors elsewhere.
def check_hook_name_format(hash)
errors = []
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
hash.fetch(hook_type) { {} }.each_key do |hook_name|
next if hook_name == 'ALL'
unless hook_name.match?(/\A[A-Za-z0-9]+\z/)
errors << "#{hook_type}::#{hook_name} has an invalid name " \
"#{hook_name}. It must contain only alphanumeric " \
'characters (no underscores or dashes, etc.)'
end
end
end
if errors.any?
if @log
@log.error errors.join("\n")
@log.newline
end
raise Overcommit::Exceptions::ConfigurationError,
'One or more hooks had invalid names'
end
end
# Prints a warning if there are any hooks listed in the configuration
# without `enabled` explicitly set.
def check_for_missing_enabled_option(hash)
return unless @log
any_warnings = false
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
hash.fetch(hook_type) { {} }.each do |hook_name, hook_config|
next if hook_name == 'ALL'
if hook_config['enabled'].nil?
@log.warning "#{hook_type}::#{hook_name} hook does not explicitly " \
'set `enabled` option in .overcommit.yml'
any_warnings = true
end
end
end
@log.newline if any_warnings
end
# Prints a warning if any hook has a number of processors larger than the
# global `concurrency` setting.
def check_for_too_many_processors(config, hash)
concurrency = config.concurrency
errors = []
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
hash.fetch(hook_type) { {} }.each do |hook_name, hook_config|
processors = hook_config.fetch('processors') { 1 }
if processors > concurrency
errors << "#{hook_type}::#{hook_name} `processors` value " \
"(#{processors}) is larger than the global `concurrency` " \
"option (#{concurrency})"
end
end
end
if errors.any?
if @log
@log.error errors.join("\n")
@log.newline
end
raise Overcommit::Exceptions::ConfigurationError,
'One or more hooks had invalid `processor` value configured'
end
end
# Prints a warning if the `verify_plugin_signatures` option is used instead
# of the new `verify_signatures` option.
def check_for_verify_plugin_signatures_option(hash)
return unless @log
if hash.key?('verify_plugin_signatures')
@log.warning '`verify_plugin_signatures` has been renamed to ' \
'`verify_signatures`. Defaulting to verifying signatures.'
@log.warning "See change log at #{REPO_URL}/blob/v0.29.0/CHANGELOG.md for details."
@log.newline
end
end
end
end
# rubocop:enable Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/MethodLength
================================================
FILE: lib/overcommit/constants.rb
================================================
# frozen_string_literal: true
# Global application constants.
module Overcommit
HOME = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
CONFIG_FILE_NAME = '.overcommit.yml'
LOCAL_CONFIG_FILE_NAME = '.local-overcommit.yml'
HOOK_DIRECTORY = File.join(HOME, 'lib', 'overcommit', 'hook').freeze
REPO_URL = 'https://github.com/sds/overcommit'
BUG_REPORT_URL = "#{REPO_URL}/issues"
end
================================================
FILE: lib/overcommit/exceptions.rb
================================================
# frozen_string_literal: true
module Overcommit::Exceptions
# Base error class.
class Error < StandardError; end
# Raised when a {Configuration} could not be loaded from a file.
class ConfigurationError < Error; end
# Raised when the Overcommit configuration file signature has changed.
class ConfigurationSignatureChanged < Error; end
# Raised when trying to read/write to/from the local repo git config fails.
class GitConfigError < Error; end
# Raised when there was a problem reading submodule information for a repo.
class GitSubmoduleError < Error; end
# Raised when there was a problem reading git revision information with `rev-list`.
class GitRevListError < Error; end
# Raised when a {HookContext} is unable to setup the environment before a run.
class HookSetupFailed < Error; end
# Raised when a {HookContext} is unable to clean the environment after a run.
class HookCleanupFailed < Error; end
# Raised when a hook run was cancelled by the user.
class HookCancelled < Error; end
# Raised when a hook could not be loaded by a {HookRunner}.
class HookLoadError < Error; end
# Raised when a {HookRunner} could not be loaded.
class HookContextLoadError < Error; end
# Raised when a pipe character is used in the `execute` helper, as this was
# likely used in error.
class InvalidCommandArgs < Error; end
# Raised when an installation target is not a valid git repository.
class InvalidGitRepo < Error; end
# Raised when a hook was defined incorrectly.
class InvalidHookDefinition < Error; end
# Raised when one or more hook plugin signatures have changed.
class InvalidHookSignature < Error; end
# Raised when there is a problem processing output into {Hook::Messages}s.
class MessageProcessingError < Error; end
# Raised when an installation target already contains non-Overcommit hooks.
class PreExistingHooks < Error; end
end
================================================
FILE: lib/overcommit/git_config.rb
================================================
# frozen_string_literal: true
require 'overcommit/utils'
module Overcommit
# Get configuration options from git
module GitConfig
module_function
def comment_character
char = `git config --get core.commentchar`.chomp
char = '#' if char == ''
char
end
def hooks_path
path = `git config --get core.hooksPath`.chomp
return File.join(Overcommit::Utils.git_dir, 'hooks') if path.empty?
File.expand_path(path, Dir.pwd)
end
end
end
================================================
FILE: lib/overcommit/git_repo.rb
================================================
# frozen_string_literal: true
require 'iniparse'
require 'shellwords'
module Overcommit
# Provide a set of utilities for certain interactions with `git`.
module GitRepo
module_function
# Regular expression used to extract diff ranges from hunks of diff output.
DIFF_HUNK_REGEX = /
^@@\s
[^\s]+\s # Ignore old file range
\+(\d+)(?:,(\d+))? # Extract range of hunk containing start line and number of lines
\s@@.*$
/x.freeze
# Regular expression used to extract information from lines of
# `git submodule status` output
SUBMODULE_STATUS_REGEX = /
^\s*(?<prefix>[-+U]?)(?<sha1>\w+)
\s(?<path>[^\s]+?)
(?:\s\((?<describe>.+)\))?$
/x.freeze
# Struct encapsulating submodule information extracted from the
# output of `git submodule status`
SubmoduleStatus = Struct.new(:prefix, :sha1, :path, :describe) do
# Returns whether the submodule has not been initialized
def uninitialized?
prefix == '-'
end
# Returns whether the submodule is out of date with the current
# index, i.e. its checked-out commit differs from that stored in
# the index of the parent repo
def outdated?
prefix == '+'
end
# Returns whether the submodule reference has a merge conflict
def merge_conflict?
prefix == 'U'
end
end
# Returns a list of SubmoduleStatus objects, one for each submodule in the
# parent repository.
#
# @option options [Boolean] recursive check submodules recursively
# @return [Array<SubmoduleStatus>]
def submodule_statuses(options = {})
flags = '--recursive' if options[:recursive]
`git submodule status #{flags}`.
scan(SUBMODULE_STATUS_REGEX).
map do |prefix, sha1, path, describe|
SubmoduleStatus.new(prefix, sha1, path, describe)
end
end
# Extract the set of modified lines from a given file.
#
# @param file_path [String]
# @param options [Hash]
# @return [Set] line numbers that have been modified in file
def extract_modified_lines(file_path, options)
lines = Set.new
flags = '--cached' if options[:staged]
refs = options[:refs]
subcmd = options[:subcmd] || 'diff'
`git #{subcmd} --no-color --no-ext-diff -U0 #{flags} #{refs} -- "#{file_path}"`.
scan(DIFF_HUNK_REGEX) do |start_line, lines_added|
lines_added = (lines_added || 1).to_i # When blank, one line was added
cur_line = start_line.to_i
lines_added.times do
lines.add cur_line
cur_line += 1
end
end
lines
end
# Returns the names of all files that have been modified compared to HEAD.
#
# @param options [Hash]
# @return [Array<String>] list of absolute file paths
def modified_files(options)
flags = '--cached' if options[:staged]
refs = options[:refs]
subcmd = options[:subcmd] || 'diff'
`git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.
split("\0").
map(&:strip).
reject(&:empty?).
map { |relative_file| File.expand_path(relative_file) }
end
# Returns the names of files in the given paths that are tracked by git.
#
# @param paths [Array<String>] list of paths to check
# @option options [String] ref ('HEAD') Git ref to check
# @return [Array<String>] list of absolute file paths
def list_files(paths = [], options = {})
ref = options[:ref] || 'HEAD'
result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)
unless result.success?
raise Overcommit::Exceptions::Error,
"Error listing files. EXIT STATUS(es): #{result.statuses}.\n" \
"STDOUT(s): #{result.stdouts}.\n" \
"STDERR(s): #{result.stderrs}."
end
result.stdout.split(/\n/).
map { |relative_file| File.expand_path(relative_file) }.
reject { |file| File.directory?(file) } # Exclude submodule directories
end
# Returns whether the specified file/path is tracked by this repository.
#
# @param path [String]
# @return [true,false]
def tracked?(path)
Overcommit::Utils.execute(%W[git ls-files #{path} --error-unmatch]).success?
end
# Returns the names of all files that are tracked by git.
#
# @return [Array<String>] list of absolute file paths
def all_files
`git ls-files`.
split(/\n/).
map { |relative_file| File.expand_path(relative_file) }.
reject { |file| File.directory?(file) } # Exclude submodule directories
end
# Returns whether the current git branch is empty (has no commits).
# @return [true,false]
def initial_commit?
!Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?
end
# Store any relevant files that are present when repo is in the middle of a
# merge.
#
# Restored via [#restore_merge_state].
def store_merge_state
merge_head = `git rev-parse MERGE_HEAD 2> #{File::NULL}`.chomp
# Store the merge state if we're in the middle of resolving a merge
# conflict. This is necessary since stashing removes the merge state.
if merge_head != 'MERGE_HEAD'
@merge_head = merge_head
end
merge_msg_file = File.expand_path('MERGE_MSG', Overcommit::Utils.git_dir)
@merge_msg = File.open(merge_msg_file).read if File.exist?(merge_msg_file)
end
# Store any relevant files that are present when repo is in the middle of a
# cherry-pick.
#
# Restored via [#restore_cherry_pick_state].
def store_cherry_pick_state
cherry_head = `git rev-parse CHERRY_PICK_HEAD 2> #{File::NULL}`.chomp
# Store the merge state if we're in the middle of resolving a merge
# conflict. This is necessary since stashing removes the merge state.
if cherry_head != 'CHERRY_PICK_HEAD'
@cherry_head = cherry_head
end
end
# Restore any relevant files that were present when repo was in the middle
# of a merge.
def restore_merge_state
if @merge_head
FileUtils.touch(File.expand_path('MERGE_MODE', Overcommit::Utils.git_dir))
File.open(File.expand_path('MERGE_HEAD', Overcommit::Utils.git_dir), 'w') do |f|
f.write(@merge_head)
end
@merge_head = nil
end
if @merge_msg
File.open(File.expand_path('MERGE_MSG', Overcommit::Utils.git_dir), 'w') do |f|
f.write("#{@merge_msg}\n")
end
@merge_msg = nil
end
end
# Restore any relevant files that were present when repo was in the middle
# of a cherry-pick.
def restore_cherry_pick_state
if @cherry_head
File.open(File.expand_path('CHERRY_PICK_HEAD',
Overcommit::Utils.git_dir), 'w') do |f|
f.write(@cherry_head)
end
@cherry_head = nil
end
end
# Contains information about a registered submodule.
Submodule = Struct.new(:path, :url)
# Returns the submodules that have been staged for removal.
#
# `git` has an unexpected behavior where removing a submodule without
# committing (i.e. such that the submodule directory is removed and the
# changes to the index are staged) and then doing a hard reset results in
# the index being wiped but the empty directory of the once existent
# submodule being restored (but with no content).
#
# This prevents restoration of the stash of the submodule index changes,
# which breaks pre-commit hook restorations of the working index.
#
# Thus we expose this helper so the restoration code can manually delete the
# directory.
#
# @raise [Overcommit::Exceptions::GitSubmoduleError] when
def staged_submodule_removals
# There were no submodules before, so none could have been removed
return [] if `git ls-files .gitmodules`.empty?
previous = submodules(ref: 'HEAD')
current = submodules
previous - current
end
# Returns the current set of registered submodules.
#
# @param options [Hash]
# @return [Array<Overcommit::GitRepo::Submodule>]
def submodules(options = {})
ref = options[:ref]
modules = []
IniParse.parse(`git show #{ref}:.gitmodules 2> #{File::NULL}`).each do |section|
# git < 1.8.5 does not update the .gitmodules file with submodule
# changes, so when we are looking at the current state of the work tree,
# we need to check if the submodule actually exists via another method,
# since the .gitmodules file we parsed does not represent reality.
if ref.nil? && GIT_VERSION < '1.8.5'
result = Overcommit::Utils.execute(%W[
git submodule status #{section['path']}
])
next unless result.success?
end
modules << Submodule.new(section['path'], section['url'])
end
modules
rescue IniParse::IniParseError => e
raise Overcommit::Exceptions::GitSubmoduleError,
"Unable to read submodule information from #{ref}:.gitmodules file: #{e.message}"
end
# Returns the names of all branches containing the given commit.
#
# @param commit_ref [String] git tree ref that resolves to a commit
# @return [Array<String>] list of branches containing the given commit
def branches_containing_commit(commit_ref)
`git branch --column=dense --contains #{commit_ref}`.
sub(/\((HEAD )?detached (from|at) .*?\)/, ''). # ignore detached HEAD
split(/\s+/).
reject { |s| s.empty? || s == '*' }
end
# Returns the name of the currently checked out branch.
# @return [String]
def current_branch
`git symbolic-ref --short -q HEAD`.chomp
end
end
end
================================================
FILE: lib/overcommit/git_version.rb
================================================
# frozen_string_literal: true
# Returns the version of the available git binary.
#
# This is intended to be used to conveniently execute code based on a specific
# git version. Simply compare to a version string:
#
# @example
# if GIT_VERSION <= '1.8.5'
# ...
# end
module Overcommit
GIT_VERSION = begin
version = `git --version`.chomp[/\d+(\.\d+)+/, 0]
Overcommit::Utils::Version.new(version)
end
end
================================================
FILE: lib/overcommit/hook/base.rb
================================================
# 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
def to_s
content
end
end
# Possible types of messages.
MESSAGE_TYPES = [:error, :warning].freeze
# Functionality common to all hooks.
class Base # rubocop:disable Metrics/ClassLength
extend Forwardable
def_delegators :@context, :all_files, :modified_files
attr_reader :config
# @param config [Overcommit::Configuration]
# @param context [Overcommit::HookContext]
def initialize(config, context)
@config = config.for_hook(self)
@context = context
end
# Runs the hook.
def run
raise NotImplementedError, 'Hook must define `run`'
end
# Runs the hook and transforms the status returned based on the hook's
# configuration.
#
# Poorly named because we already have a bunch of hooks in the wild that
# implement `#run`, and we needed a wrapper step to transform the status
# based on any custom configuration.
def run_and_transform
if output = check_for_requirements
status = :fail
else
result = Overcommit::Utils.with_environment(@config.fetch('env') { {} }) { run }
status, output = process_hook_return_value(result)
end
[transform_status(status), output]
end
def name
self.class.name.split('::').last
end
def description
@config['description'] || "Run #{name}"
end
def required?
@config['required']
end
def parallelize?
@config['parallelize'] != false
end
def processors
@config.fetch('processors') { 1 }
end
def quiet?
@config['quiet']
end
def enabled?
@config['enabled'] != false
end
def excluded?
exclude_branches.any? { |p| File.fnmatch(p, current_branch) }
end
def skip?
@config['skip'] ||
(@config['skip_if'] ? execute(@config['skip_if']).success? : false)
end
def run?
enabled? &&
!excluded? &&
!(@config['requires_files'] && applicable_files.empty?)
end
def in_path?(cmd)
Overcommit::Utils.in_path?(cmd)
end
# Execute a command in a separate process.
#
# If `splittable_args` is specified, ensures that those arguments are
# concatenated onto the end of the `cmd` arguments, but split up so that the
# operating system's maximum command length is not exceeded. This is useful
# for splitting up long file lists.
#
# @param cmd [Array<String>] command arguments
# @param options [Hash]
# @option options [Array<String>] :args arguments that can be split up over
# multiple invocations (usually a list of files)
# @option options [String] :input string to pass to process' standard input
# stream
# @return [#status,#stdout,#stderr] struct containing result of invocation
def execute(cmd, options = {})
Overcommit::Utils.execute(cmd, options)
end
def execute_in_background(cmd)
Overcommit::Utils.execute_in_background(cmd)
end
def required_executable
@config['required_executable']
end
def required_libraries
Array(@config['required_library'] || @config['required_libraries'])
end
# Return command to execute for this hook.
#
# This is intended to be configurable so hooks can prefix their commands
# with `bundle exec` or similar. It will appends the command line flags
# specified by the `flags` option after.
#
# Note that any files intended to be passed must be handled by the hook
# itself.
#
# @return [Array<String>]
def command
Array(@config['command'] || required_executable) + flags
end
# Return command line flags to be passed to the command.
#
# This excludes the list of files, as that must be handled by the hook
# itself.
#
# The intention here is to provide flexibility for when a tool
# removes/renames its flags. Rather than wait for Overcommit to update the
# flags it uses, you can update your configuration to use the new flags
# right away without being blocked.
#
# Also note that any flags containing dynamic content must be passed in the
# hook's {#run} method.
#
# @return [Array<String>]
def flags
Array(@config['flags'])
end
# Gets a list of staged files that apply to this hook based on its
# configured `include` and `exclude` lists.
def applicable_files
@applicable_files ||= select_applicable(modified_files)
end
# Gets a list of all files that apply to this hook based on its
# configured `include` and `exclude` lists.
def included_files
@included_files ||= select_applicable(all_files)
end
private
def select_applicable(list)
list.select { |file| applicable_file?(file) }.sort
end
def applicable_file?(file)
includes = Array(@config['include']).flatten.map do |glob|
Overcommit::Utils.convert_glob_to_absolute(glob)
end
included = includes.empty? || includes.any? do |glob|
Overcommit::Utils.matches_path?(glob, file)
end
excludes = Array(@config['exclude']).flatten.map do |glob|
Overcommit::Utils.convert_glob_to_absolute(glob)
end
excluded = excludes.any? do |glob|
Overcommit::Utils.matches_path?(glob, file)
end
included && !excluded
end
# Check for any required executables or libraries.
#
# Returns output if any requirements are not met.
def check_for_requirements
check_for_executable || check_for_libraries
end
# If the hook defines a required executable, check if it's in the path and
# display the install command if one exists.
def check_for_executable
return unless required_executable && !in_path?(required_executable)
"'#{required_executable}' is not installed, not in your PATH, " \
"or does not have execute permissions#{install_command_prompt}"
end
def install_command_prompt
if install_command = @config['install_command']
"\nInstall it by running: #{install_command}"
else
''
end
end
# If the hook defines required library paths that it wants to load, attempt
# to load them.
def check_for_libraries
output = []
required_libraries.each do |library|
require library
rescue LoadError
install_command = @config['install_command']
install_command = " -- install via #{install_command}" if install_command
output << "Unable to load '#{library}'#{install_command}"
end
return if output.empty?
output.join("\n")
end
# Converts the hook's return value into a canonical form of a tuple
# containing status (pass/warn/fail) and output.
#
# This is intended to support various shortcuts for writing hooks so that
# hook authors don't need to work with {Overcommit::Hook::Message} objects
# for simple pass/fail hooks. It also saves you from needing to manually
# encode logic like "if there are errors, fail; if there are warnings, warn,
# otherwise pass." by simply returning an array of
# {Overcommit::Hook::Message} objects.
#
# @param hook_return_value [Symbol, Array<Symbol,String>, Array<Message>]
# @return [Array<Symbol,String>] tuple of status and output
def process_hook_return_value(hook_return_value)
if hook_return_value.is_a?(Array) &&
(hook_return_value.first.is_a?(Message) || hook_return_value.empty?)
# Process messages into a status and output
Overcommit::MessageProcessor.new(
self,
@config['problem_on_unmodified_line'],
).hook_result(hook_return_value)
else
# Otherwise return as-is
hook_return_value
end
end
# Transforms the hook's status based on custom configuration.
#
# This allows users to change failures into warnings, or vice versa.
def transform_status(status)
case status
when :fail
@config.fetch('on_fail') { :fail }.to_sym
when :warn
@config.fetch('on_warn') { :warn }.to_sym
else
status
end
end
def exclude_branches
@config['exclude_branches'] || []
end
def current_branch
@current_branch ||= Overcommit::GitRepo.current_branch
end
end
end
================================================
FILE: 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_message_lines,
:commit_message_file, :modified_lines_in_file
end
end
================================================
FILE: 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 { |line| !line.strip.empty? }.to_s
first_letter = subject.match(/^[[:punct:]]*(.)/)[1]
unless special_prefix?(subject) || first_letter =~ /[[:upper:]]/
return :warn, 'Subject should start with a capital letter'
end
:pass
end
private
def special_prefix?(subject)
subject =~ /^(fixup|squash)!/
end
end
end
================================================
FILE: 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 un
gitextract_l2gjobnw/
├── .editorconfig
├── .git-hooks/
│ └── pre_commit/
│ └── master_hooks_match.rb
├── .github/
│ └── workflows/
│ ├── lint.yml
│ └── tests.yml
├── .gitignore
├── .overcommit.yml
├── .rubocop.yml
├── .rubocop_todo.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Gemfile
├── MIT-LICENSE
├── README.md
├── bin/
│ └── overcommit
├── config/
│ ├── default.yml
│ └── starter.yml
├── lib/
│ ├── overcommit/
│ │ ├── cli.rb
│ │ ├── command_splitter.rb
│ │ ├── configuration.rb
│ │ ├── configuration_loader.rb
│ │ ├── configuration_validator.rb
│ │ ├── constants.rb
│ │ ├── exceptions.rb
│ │ ├── git_config.rb
│ │ ├── git_repo.rb
│ │ ├── git_version.rb
│ │ ├── hook/
│ │ │ ├── base.rb
│ │ │ ├── commit_msg/
│ │ │ │ ├── base.rb
│ │ │ │ ├── capitalized_subject.rb
│ │ │ │ ├── empty_message.rb
│ │ │ │ ├── gerrit_change_id.rb
│ │ │ │ ├── hard_tabs.rb
│ │ │ │ ├── message_format.rb
│ │ │ │ ├── russian_novel.rb
│ │ │ │ ├── single_line_subject.rb
│ │ │ │ ├── spell_check.rb
│ │ │ │ ├── text_width.rb
│ │ │ │ └── trailing_period.rb
│ │ │ ├── post_checkout/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── post_commit/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── commitplease.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── git_guilt.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── post_merge/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── post_rewrite/
│ │ │ │ ├── base.rb
│ │ │ │ ├── bower_install.rb
│ │ │ │ ├── bundle_install.rb
│ │ │ │ ├── composer_install.rb
│ │ │ │ ├── index_tags.rb
│ │ │ │ ├── npm_install.rb
│ │ │ │ ├── submodule_status.rb
│ │ │ │ └── yarn_install.rb
│ │ │ ├── pre_commit/
│ │ │ │ ├── author_email.rb
│ │ │ │ ├── author_name.rb
│ │ │ │ ├── base.rb
│ │ │ │ ├── berksfile_check.rb
│ │ │ │ ├── broken_symlinks.rb
│ │ │ │ ├── bundle_audit.rb
│ │ │ │ ├── bundle_check.rb
│ │ │ │ ├── bundle_outdated.rb
│ │ │ │ ├── case_conflicts.rb
│ │ │ │ ├── chamber_compare.rb
│ │ │ │ ├── chamber_security.rb
│ │ │ │ ├── chamber_verification.rb
│ │ │ │ ├── code_spell_check.rb
│ │ │ │ ├── coffee_lint.rb
│ │ │ │ ├── cook_style.rb
│ │ │ │ ├── credo.rb
│ │ │ │ ├── css_lint.rb
│ │ │ │ ├── dart_analyzer.rb
│ │ │ │ ├── dogma.rb
│ │ │ │ ├── erb_lint.rb
│ │ │ │ ├── es_lint.rb
│ │ │ │ ├── execute_permissions.rb
│ │ │ │ ├── fasterer.rb
│ │ │ │ ├── file_size.rb
│ │ │ │ ├── fix_me.rb
│ │ │ │ ├── flay.rb
│ │ │ │ ├── foodcritic.rb
│ │ │ │ ├── forbidden_branches.rb
│ │ │ │ ├── ginkgo_focus.rb
│ │ │ │ ├── go_fmt.rb
│ │ │ │ ├── go_lint.rb
│ │ │ │ ├── go_vet.rb
│ │ │ │ ├── golangci_lint.rb
│ │ │ │ ├── hadolint.rb
│ │ │ │ ├── haml_lint.rb
│ │ │ │ ├── hard_tabs.rb
│ │ │ │ ├── hlint.rb
│ │ │ │ ├── html_hint.rb
│ │ │ │ ├── html_tidy.rb
│ │ │ │ ├── image_optim.rb
│ │ │ │ ├── java_checkstyle.rb
│ │ │ │ ├── js_hint.rb
│ │ │ │ ├── js_lint.rb
│ │ │ │ ├── jscs.rb
│ │ │ │ ├── jsl.rb
│ │ │ │ ├── json_syntax.rb
│ │ │ │ ├── kt_lint.rb
│ │ │ │ ├── license_finder.rb
│ │ │ │ ├── license_header.rb
│ │ │ │ ├── line_endings.rb
│ │ │ │ ├── local_paths_in_gemfile.rb
│ │ │ │ ├── mdl.rb
│ │ │ │ ├── merge_conflicts.rb
│ │ │ │ ├── mix_format.rb
│ │ │ │ ├── nginx_test.rb
│ │ │ │ ├── pep257.rb
│ │ │ │ ├── pep8.rb
│ │ │ │ ├── php_cs.rb
│ │ │ │ ├── php_cs_fixer.rb
│ │ │ │ ├── php_lint.rb
│ │ │ │ ├── php_stan.rb
│ │ │ │ ├── pronto.rb
│ │ │ │ ├── puppet_lint.rb
│ │ │ │ ├── puppet_metadata_json_lint.rb
│ │ │ │ ├── pycodestyle.rb
│ │ │ │ ├── pydocstyle.rb
│ │ │ │ ├── pyflakes.rb
│ │ │ │ ├── pylint.rb
│ │ │ │ ├── python_flake8.rb
│ │ │ │ ├── r_spec.rb
│ │ │ │ ├── rails_best_practices.rb
│ │ │ │ ├── rails_schema_up_to_date.rb
│ │ │ │ ├── rake_target.rb
│ │ │ │ ├── reek.rb
│ │ │ │ ├── rst_lint.rb
│ │ │ │ ├── rubo_cop.rb
│ │ │ │ ├── ruby_lint.rb
│ │ │ │ ├── ruby_syntax.rb
│ │ │ │ ├── scalariform.rb
│ │ │ │ ├── scalastyle.rb
│ │ │ │ ├── scss_lint.rb
│ │ │ │ ├── semi_standard.rb
│ │ │ │ ├── shell_check.rb
│ │ │ │ ├── slim_lint.rb
│ │ │ │ ├── solargraph.rb
│ │ │ │ ├── sorbet.rb
│ │ │ │ ├── sqlint.rb
│ │ │ │ ├── standard.rb
│ │ │ │ ├── stylelint.rb
│ │ │ │ ├── swift_lint.rb
│ │ │ │ ├── terraform_format.rb
│ │ │ │ ├── trailing_whitespace.rb
│ │ │ │ ├── travis_lint.rb
│ │ │ │ ├── ts_lint.rb
│ │ │ │ ├── vint.rb
│ │ │ │ ├── w3c_css.rb
│ │ │ │ ├── w3c_html.rb
│ │ │ │ ├── xml_lint.rb
│ │ │ │ ├── xml_syntax.rb
│ │ │ │ ├── yaml_lint.rb
│ │ │ │ ├── yaml_syntax.rb
│ │ │ │ ├── yard_coverage.rb
│ │ │ │ └── yarn_check.rb
│ │ │ ├── pre_push/
│ │ │ │ ├── base.rb
│ │ │ │ ├── brakeman.rb
│ │ │ │ ├── cargo_test.rb
│ │ │ │ ├── flutter_test.rb
│ │ │ │ ├── go_test.rb
│ │ │ │ ├── golangci_lint.rb
│ │ │ │ ├── minitest.rb
│ │ │ │ ├── mix_test.rb
│ │ │ │ ├── php_unit.rb
│ │ │ │ ├── pronto.rb
│ │ │ │ ├── protected_branches.rb
│ │ │ │ ├── pub_test.rb
│ │ │ │ ├── pytest.rb
│ │ │ │ ├── python_nose.rb
│ │ │ │ ├── r_spec.rb
│ │ │ │ ├── rake_target.rb
│ │ │ │ └── test_unit.rb
│ │ │ ├── pre_rebase/
│ │ │ │ ├── base.rb
│ │ │ │ └── merged_commits.rb
│ │ │ ├── prepare_commit_msg/
│ │ │ │ ├── base.rb
│ │ │ │ └── replace_branch.rb
│ │ │ └── shared/
│ │ │ ├── bower_install.rb
│ │ │ ├── bundle_install.rb
│ │ │ ├── composer_install.rb
│ │ │ ├── index_tags.rb
│ │ │ ├── npm_install.rb
│ │ │ ├── pronto.rb
│ │ │ ├── r_spec.rb
│ │ │ ├── rake_target.rb
│ │ │ ├── submodule_status.rb
│ │ │ └── yarn_install.rb
│ │ ├── hook_context/
│ │ │ ├── base.rb
│ │ │ ├── commit_msg.rb
│ │ │ ├── diff.rb
│ │ │ ├── helpers/
│ │ │ │ ├── file_modifications.rb
│ │ │ │ └── stash_unstaged_changes.rb
│ │ │ ├── post_checkout.rb
│ │ │ ├── post_commit.rb
│ │ │ ├── post_merge.rb
│ │ │ ├── post_rewrite.rb
│ │ │ ├── pre_commit.rb
│ │ │ ├── pre_push.rb
│ │ │ ├── pre_rebase.rb
│ │ │ ├── prepare_commit_msg.rb
│ │ │ └── run_all.rb
│ │ ├── hook_context.rb
│ │ ├── hook_loader/
│ │ │ ├── base.rb
│ │ │ ├── built_in_hook_loader.rb
│ │ │ └── plugin_hook_loader.rb
│ │ ├── hook_runner.rb
│ │ ├── hook_signer.rb
│ │ ├── installer.rb
│ │ ├── interrupt_handler.rb
│ │ ├── logger.rb
│ │ ├── message_processor.rb
│ │ ├── os.rb
│ │ ├── printer.rb
│ │ ├── subprocess.rb
│ │ ├── utils/
│ │ │ ├── file_utils.rb
│ │ │ └── messages_utils.rb
│ │ ├── utils.rb
│ │ └── version.rb
│ └── overcommit.rb
├── libexec/
│ ├── gerrit-change-id
│ └── index-tags
├── overcommit.gemspec
├── spec/
│ ├── integration/
│ │ ├── committing_spec.rb
│ │ ├── configuration_signing_spec.rb
│ │ ├── diff_flag_spec.rb
│ │ ├── disable_overcommit_spec.rb
│ │ ├── gemfile_option_spec.rb
│ │ ├── hook_signing_spec.rb
│ │ ├── installing_overcommit_spec.rb
│ │ ├── parallelize_spec.rb
│ │ ├── protected_branches_spec.rb
│ │ ├── resolving_cherry_pick_conflict_spec.rb
│ │ ├── resolving_merge_conflict_spec.rb
│ │ ├── run_flag_spec.rb
│ │ └── template_dir_spec.rb
│ ├── overcommit/
│ │ ├── cli_spec.rb
│ │ ├── command_splitter_spec.rb
│ │ ├── configuration_loader_spec.rb
│ │ ├── configuration_spec.rb
│ │ ├── configuration_validator_spec.rb
│ │ ├── default_configuration_spec.rb
│ │ ├── git_config_spec.rb
│ │ ├── git_repo_spec.rb
│ │ ├── hook/
│ │ │ ├── base_spec.rb
│ │ │ ├── commit_msg/
│ │ │ │ ├── capitalized_subject_spec.rb
│ │ │ │ ├── empty_message_spec.rb
│ │ │ │ ├── gerrit_change_id_spec.rb
│ │ │ │ ├── hard_tabs_spec.rb
│ │ │ │ ├── message_format_spec.rb
│ │ │ │ ├── russian_novel_spec.rb
│ │ │ │ ├── single_line_subject_spec.rb
│ │ │ │ ├── spell_check_spec.rb
│ │ │ │ ├── text_width_spec.rb
│ │ │ │ └── trailing_period_spec.rb
│ │ │ ├── post_checkout/
│ │ │ │ ├── base_spec.rb
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── post_commit/
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── commitplease_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── git_guilt_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── post_merge/
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── post_rewrite/
│ │ │ │ ├── bower_install_spec.rb
│ │ │ │ ├── bundle_install_spec.rb
│ │ │ │ ├── composer_install_spec.rb
│ │ │ │ ├── index_tags_spec.rb
│ │ │ │ ├── npm_install_spec.rb
│ │ │ │ ├── submodule_status_spec.rb
│ │ │ │ └── yarn_install_spec.rb
│ │ │ ├── pre_commit/
│ │ │ │ ├── author_email_spec.rb
│ │ │ │ ├── author_name_spec.rb
│ │ │ │ ├── berksfile_check_spec.rb
│ │ │ │ ├── broken_symlinks_spec.rb
│ │ │ │ ├── bundle_audit_spec.rb
│ │ │ │ ├── bundle_check_spec.rb
│ │ │ │ ├── bundle_outdated_spec.rb
│ │ │ │ ├── case_conflicts_spec.rb
│ │ │ │ ├── chamber_compare_spec.rb
│ │ │ │ ├── chamber_security_spec.rb
│ │ │ │ ├── chamber_verification_spec.rb
│ │ │ │ ├── code_spell_check_spec.rb
│ │ │ │ ├── coffee_lint_spec.rb
│ │ │ │ ├── cook_style_spec.rb
│ │ │ │ ├── credo_spec.rb
│ │ │ │ ├── css_lint_spec.rb
│ │ │ │ ├── dart_analyzer_spec.rb
│ │ │ │ ├── dogma_spec.rb
│ │ │ │ ├── erb_lint_spec.rb
│ │ │ │ ├── es_lint_spec.rb
│ │ │ │ ├── execute_permissions_spec.rb
│ │ │ │ ├── fasterer_spec.rb
│ │ │ │ ├── file_size_spec.rb
│ │ │ │ ├── fix_me_spec.rb
│ │ │ │ ├── flay_spec.rb
│ │ │ │ ├── foodcritic_spec.rb
│ │ │ │ ├── forbidden_branches_spec.rb
│ │ │ │ ├── go_fmt_spec.rb
│ │ │ │ ├── go_lint_spec.rb
│ │ │ │ ├── go_vet_spec.rb
│ │ │ │ ├── golangci_lint_spec.rb
│ │ │ │ ├── hadolint_spec.rb
│ │ │ │ ├── haml_lint_spec.rb
│ │ │ │ ├── hard_tabs_spec.rb
│ │ │ │ ├── hlint_spec.rb
│ │ │ │ ├── html_hint_spec.rb
│ │ │ │ ├── html_tidy_spec.rb
│ │ │ │ ├── image_optim_spec.rb
│ │ │ │ ├── java_checkstyle_spec.rb
│ │ │ │ ├── js_hint_spec.rb
│ │ │ │ ├── js_lint_spec.rb
│ │ │ │ ├── jscs_spec.rb
│ │ │ │ ├── jsl_spec.rb
│ │ │ │ ├── json_syntax_spec.rb
│ │ │ │ ├── kt_lint_spec.rb
│ │ │ │ ├── license_finder_spec.rb
│ │ │ │ ├── license_header_spec.rb
│ │ │ │ ├── line_endings_spec.rb
│ │ │ │ ├── local_paths_in_gemfile_spec.rb
│ │ │ │ ├── mdl_spec.rb
│ │ │ │ ├── merge_conflicts_spec.rb
│ │ │ │ ├── mix_format_spec.rb
│ │ │ │ ├── nginx_test_spec.rb
│ │ │ │ ├── pep257_spec.rb
│ │ │ │ ├── pep8_spec.rb
│ │ │ │ ├── php_lint_spec.rb
│ │ │ │ ├── php_stan_spec.rb
│ │ │ │ ├── phpcs_fixer_spec.rb
│ │ │ │ ├── phpcs_spec.rb
│ │ │ │ ├── pronto_spec.rb
│ │ │ │ ├── puppet_lint_spec.rb
│ │ │ │ ├── puppet_metadata_json_lint_spec.rb
│ │ │ │ ├── pycodestyle_spec.rb
│ │ │ │ ├── pydocstyle_spec.rb
│ │ │ │ ├── pyflakes_spec.rb
│ │ │ │ ├── pylint_spec.rb
│ │ │ │ ├── python_flake8_spec.rb
│ │ │ │ ├── r_spec_spec.rb
│ │ │ │ ├── rails_best_practices_spec.rb
│ │ │ │ ├── rails_schema_up_to_date_spec.rb
│ │ │ │ ├── rake_target_spec.rb
│ │ │ │ ├── reek_spec.rb
│ │ │ │ ├── rst_lint_spec.rb
│ │ │ │ ├── rubo_cop_spec.rb
│ │ │ │ ├── ruby_lint_spec.rb
│ │ │ │ ├── ruby_syntax_spec.rb
│ │ │ │ ├── scalariform_spec.rb
│ │ │ │ ├── scalastyle_spec.rb
│ │ │ │ ├── scss_lint_spec.rb
│ │ │ │ ├── semi_standard_spec.rb
│ │ │ │ ├── shell_check_spec.rb
│ │ │ │ ├── slim_lint_spec.rb
│ │ │ │ ├── solargraph_spec.rb
│ │ │ │ ├── sorbet_spec.rb
│ │ │ │ ├── sqlint_spec.rb
│ │ │ │ ├── standard_spec.rb
│ │ │ │ ├── stylelint_spec.rb
│ │ │ │ ├── swift_lint_spec.rb
│ │ │ │ ├── terraform_format_spec.rb
│ │ │ │ ├── trailing_whitespace_spec.rb
│ │ │ │ ├── travis_lint_spec.rb
│ │ │ │ ├── ts_lint_spec.rb
│ │ │ │ ├── vint_spec.rb
│ │ │ │ ├── w3c_css_spec.rb
│ │ │ │ ├── w3c_html_spec.rb
│ │ │ │ ├── xml_lint_spec.rb
│ │ │ │ ├── xml_syntax_spec.rb
│ │ │ │ ├── yaml_lint_spec.rb
│ │ │ │ ├── yaml_syntax_spec.rb
│ │ │ │ ├── yard_coverage_spec.rb
│ │ │ │ └── yarn_check_spec.rb
│ │ │ ├── pre_push/
│ │ │ │ ├── base_spec.rb
│ │ │ │ ├── brakeman_spec.rb
│ │ │ │ ├── cargo_test_spec.rb
│ │ │ │ ├── flutter_test_spec.rb
│ │ │ │ ├── go_test_spec.rb
│ │ │ │ ├── golangci_lint_spec.rb
│ │ │ │ ├── minitest_spec.rb
│ │ │ │ ├── mix_test_spec.rb
│ │ │ │ ├── php_unit_spec.rb
│ │ │ │ ├── pronto_spec.rb
│ │ │ │ ├── protected_branches_spec.rb
│ │ │ │ ├── pub_test_spec.rb
│ │ │ │ ├── pytest_spec.rb
│ │ │ │ ├── python_nose_spec.rb
│ │ │ │ ├── r_spec_spec.rb
│ │ │ │ ├── rake_target_spec.rb
│ │ │ │ └── test_unit_spec.rb
│ │ │ ├── pre_rebase/
│ │ │ │ └── merged_commits_spec.rb
│ │ │ └── prepare_commit_msg/
│ │ │ ├── base_spec.rb
│ │ │ └── replace_branch_spec.rb
│ │ ├── hook_context/
│ │ │ ├── base_spec.rb
│ │ │ ├── commit_msg_spec.rb
│ │ │ ├── diff_spec.rb
│ │ │ ├── post_checkout_spec.rb
│ │ │ ├── post_commit_spec.rb
│ │ │ ├── post_merge_spec.rb
│ │ │ ├── post_rewrite_spec.rb
│ │ │ ├── pre_commit_spec.rb
│ │ │ ├── pre_push_spec.rb
│ │ │ ├── pre_rebase_spec.rb
│ │ │ ├── prepare_commit_msg_spec.rb
│ │ │ └── run_all_spec.rb
│ │ ├── hook_signer_spec.rb
│ │ ├── installer_spec.rb
│ │ ├── logger_spec.rb
│ │ ├── message_processor_spec.rb
│ │ └── utils_spec.rb
│ ├── spec_helper.rb
│ └── support/
│ ├── git_spec_helpers.rb
│ ├── matchers/
│ │ └── hook.rb
│ ├── normalize_indent.rb
│ ├── output_helpers.rb
│ └── shell_helpers.rb
└── template-dir/
└── hooks/
├── commit-msg
├── overcommit-hook
├── post-checkout
├── post-commit
├── post-merge
├── post-rewrite
├── pre-commit
├── pre-push
├── pre-rebase
└── prepare-commit-msg
SYMBOL INDEX (1071 symbols across 231 files)
FILE: .git-hooks/pre_commit/master_hooks_match.rb
type Overcommit::Hook::PreCommit (line 5) | module Overcommit::Hook::PreCommit
class MasterHooksMatch (line 11) | class MasterHooksMatch < Base
method run (line 12) | def run
FILE: lib/overcommit/cli.rb
type Overcommit (line 6) | module Overcommit
class CLI (line 9) | class CLI # rubocop:disable Metrics/ClassLength
method initialize (line 10) | def initialize(arguments, input, logger)
method run (line 20) | def run
method parse_arguments (line 47) | def parse_arguments
method create_option_parser (line 63) | def create_option_parser
method add_information_options (line 73) | def add_information_options(opts)
method add_installation_options (line 87) | def add_installation_options(opts)
method add_other_options (line 111) | def add_other_options(opts)
method install_or_uninstall (line 122) | def install_or_uninstall
method print_template_directory_path (line 145) | def print_template_directory_path
method print_help (line 150) | def print_help(message, error = nil)
method print_version (line 156) | def print_version(program_name)
method print_installed_hooks (line 163) | def print_installed_hooks
method print_hooks_for_hook_type (line 171) | def print_hooks_for_hook_type(repo_config, hook_configs, hook_type)
method sign (line 190) | def sign
method run_all (line 207) | def run_all
method diff (line 220) | def diff
method halt (line 234) | def halt(status = 0)
method config (line 239) | def config(options = {})
FILE: lib/overcommit/command_splitter.rb
type Overcommit (line 3) | module Overcommit
class CommandSplitter (line 17) | class CommandSplitter
method success? (line 27) | def success?
method status (line 34) | def status
method stdout (line 42) | def stdout
method stderr (line 50) | def stderr
method execute (line 56) | def execute(initial_args, options)
method extract_argument_lists (line 79) | def extract_argument_lists(args, splittable_args)
method arguments_under_limit (line 104) | def arguments_under_limit(splittable_args, start_index, byte_limit)
method max_command_length (line 132) | def max_command_length
FILE: lib/overcommit/configuration.rb
type Overcommit (line 6) | module Overcommit
class Configuration (line 8) | class Configuration # rubocop:disable Metrics/ClassLength
method initialize (line 15) | def initialize(hash, options = {})
method == (line 24) | def ==(other)
method [] (line 32) | def [](key)
method plugin_directory (line 38) | def plugin_directory
method concurrency (line 42) | def concurrency
method all_hook_configs (line 65) | def all_hook_configs
method all_builtin_hook_configs (line 72) | def all_builtin_hook_configs
method all_plugin_hook_configs (line 91) | def all_plugin_hook_configs
method enabled_builtin_hooks (line 115) | def enabled_builtin_hooks(hook_context)
method enabled_ad_hoc_hooks (line 123) | def enabled_ad_hoc_hooks(hook_context)
method for_hook (line 131) | def for_hook(hook, hook_type = nil)
method merge (line 151) | def merge(config)
method apply_environment! (line 157) | def apply_environment!(hook_context, env)
method plugin_hook? (line 181) | def plugin_hook?(hook_context_or_type, hook_name)
method signature_changed? (line 197) | def signature_changed?
method previous_signature? (line 205) | def previous_signature?
method verify_signatures? (line 213) | def verify_signatures?
method update_signature! (line 234) | def update_signature!
method ad_hoc_hook? (line 256) | def ad_hoc_hook?(hook_context, hook_name)
method built_in_hook? (line 266) | def built_in_hook?(hook_context, hook_name)
method hook_exists? (line 273) | def hook_exists?(hook_context, hook_name)
method hook_enabled? (line 279) | def hook_enabled?(hook_context_or_type, hook_name)
method smart_merge (line 296) | def smart_merge(parent, child)
method signature (line 317) | def signature
method stored_signature (line 327) | def stored_signature
method signature_config_key (line 342) | def signature_config_key
method verify_signature_config_key (line 346) | def verify_signature_config_key
FILE: lib/overcommit/configuration_loader.rb
type Overcommit (line 5) | module Overcommit
class ConfigurationLoader (line 7) | class ConfigurationLoader
method default_configuration (line 14) | def default_configuration
method load_from_file (line 26) | def load_from_file(file, options = {})
method initialize (line 47) | def initialize(logger, options = {})
method load_repo_config (line 55) | def load_repo_config
method load_file (line 71) | def load_file(file, local_file = nil)
method verify_signatures (line 92) | def verify_signatures(config)
FILE: lib/overcommit/configuration_validator.rb
type Overcommit (line 4) | module Overcommit
class ConfigurationValidator (line 6) | class ConfigurationValidator
method validate (line 15) | def validate(config, hash, options)
method ensure_hook_type_sections_exist (line 34) | def ensure_hook_type_sections_exist(hash)
method convert_nils_to_empty_hashes (line 46) | def convert_nils_to_empty_hashes(hash)
method check_hook_env (line 58) | def check_hook_env(hash)
method check_hook_name_format (line 98) | def check_hook_name_format(hash)
method check_for_missing_enabled_option (line 125) | def check_for_missing_enabled_option(hash)
method check_for_too_many_processors (line 147) | def check_for_too_many_processors(config, hash)
method check_for_verify_plugin_signatures_option (line 174) | def check_for_verify_plugin_signatures_option(hash)
FILE: lib/overcommit/constants.rb
type Overcommit (line 4) | module Overcommit
FILE: lib/overcommit/exceptions.rb
type Overcommit::Exceptions (line 3) | module Overcommit::Exceptions
class Error (line 5) | class Error < StandardError; end
class ConfigurationError (line 8) | class ConfigurationError < Error; end
class ConfigurationSignatureChanged (line 11) | class ConfigurationSignatureChanged < Error; end
class GitConfigError (line 14) | class GitConfigError < Error; end
class GitSubmoduleError (line 17) | class GitSubmoduleError < Error; end
class GitRevListError (line 20) | class GitRevListError < Error; end
class HookSetupFailed (line 23) | class HookSetupFailed < Error; end
class HookCleanupFailed (line 26) | class HookCleanupFailed < Error; end
class HookCancelled (line 29) | class HookCancelled < Error; end
class HookLoadError (line 32) | class HookLoadError < Error; end
class HookContextLoadError (line 35) | class HookContextLoadError < Error; end
class InvalidCommandArgs (line 39) | class InvalidCommandArgs < Error; end
class InvalidGitRepo (line 42) | class InvalidGitRepo < Error; end
class InvalidHookDefinition (line 45) | class InvalidHookDefinition < Error; end
class InvalidHookSignature (line 48) | class InvalidHookSignature < Error; end
class MessageProcessingError (line 51) | class MessageProcessingError < Error; end
class PreExistingHooks (line 54) | class PreExistingHooks < Error; end
FILE: lib/overcommit/git_config.rb
type Overcommit (line 5) | module Overcommit
type GitConfig (line 7) | module GitConfig
function comment_character (line 10) | def comment_character
function hooks_path (line 16) | def hooks_path
FILE: lib/overcommit/git_repo.rb
type Overcommit (line 6) | module Overcommit
type GitRepo (line 8) | module GitRepo
function uninitialized? (line 31) | def uninitialized?
function outdated? (line 38) | def outdated?
function merge_conflict? (line 43) | def merge_conflict?
function submodule_statuses (line 53) | def submodule_statuses(options = {})
function extract_modified_lines (line 68) | def extract_modified_lines(file_path, options)
function modified_files (line 93) | def modified_files(options)
function list_files (line 110) | def list_files(paths = [], options = {})
function tracked? (line 130) | def tracked?(path)
function all_files (line 137) | def all_files
function initial_commit? (line 146) | def initial_commit?
function store_merge_state (line 154) | def store_merge_state
function store_cherry_pick_state (line 171) | def store_cherry_pick_state
function restore_merge_state (line 183) | def restore_merge_state
function restore_cherry_pick_state (line 203) | def restore_cherry_pick_state
function staged_submodule_removals (line 231) | def staged_submodule_removals
function submodules (line 245) | def submodules(options = {})
function branches_containing_commit (line 274) | def branches_containing_commit(commit_ref)
function current_branch (line 283) | def current_branch
FILE: lib/overcommit/git_version.rb
type Overcommit (line 12) | module Overcommit
FILE: lib/overcommit/hook/base.rb
type Overcommit::Hook (line 7) | module Overcommit::Hook
function to_s (line 10) | def to_s
class Base (line 19) | class Base # rubocop:disable Metrics/ClassLength
method initialize (line 27) | def initialize(config, context)
method run (line 33) | def run
method run_and_transform (line 43) | def run_and_transform
method name (line 54) | def name
method description (line 58) | def description
method required? (line 62) | def required?
method parallelize? (line 66) | def parallelize?
method processors (line 70) | def processors
method quiet? (line 74) | def quiet?
method enabled? (line 78) | def enabled?
method excluded? (line 82) | def excluded?
method skip? (line 86) | def skip?
method run? (line 91) | def run?
method in_path? (line 97) | def in_path?(cmd)
method execute (line 115) | def execute(cmd, options = {})
method execute_in_background (line 119) | def execute_in_background(cmd)
method required_executable (line 123) | def required_executable
method required_libraries (line 127) | def required_libraries
method command (line 141) | def command
method flags (line 159) | def flags
method applicable_files (line 165) | def applicable_files
method included_files (line 171) | def included_files
method select_applicable (line 177) | def select_applicable(list)
method applicable_file? (line 181) | def applicable_file?(file)
method check_for_requirements (line 204) | def check_for_requirements
method check_for_executable (line 210) | def check_for_executable
method install_command_prompt (line 217) | def install_command_prompt
method check_for_libraries (line 227) | def check_for_libraries
method process_hook_return_value (line 256) | def process_hook_return_value(hook_return_value)
method transform_status (line 273) | def transform_status(status)
method exclude_branches (line 284) | def exclude_branches
method current_branch (line 288) | def current_branch
FILE: lib/overcommit/hook/commit_msg/base.rb
type Overcommit::Hook::CommitMsg (line 5) | module Overcommit::Hook::CommitMsg
class Base (line 7) | class Base < Overcommit::Hook::Base
FILE: lib/overcommit/hook/commit_msg/capitalized_subject.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class CapitalizedSubject (line 5) | class CapitalizedSubject < Base
method run (line 6) | def run
method special_prefix? (line 21) | def special_prefix?(subject)
FILE: lib/overcommit/hook/commit_msg/empty_message.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class EmptyMessage (line 5) | class EmptyMessage < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/commit_msg/gerrit_change_id.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class GerritChangeId (line 12) | class GerritChangeId < Base
method run (line 15) | def run
FILE: lib/overcommit/hook/commit_msg/hard_tabs.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class HardTabs (line 5) | class HardTabs < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/commit_msg/message_format.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class MessageFormat (line 5) | class MessageFormat < Base
method run (line 6) | def run
method validate_pattern (line 15) | def validate_pattern(message)
FILE: lib/overcommit/hook/commit_msg/russian_novel.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class RussianNovel (line 5) | class RussianNovel < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/commit_msg/single_line_subject.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class SingleLineSubject (line 5) | class SingleLineSubject < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/commit_msg/spell_check.rb
type Overcommit::Hook::CommitMsg (line 5) | module Overcommit::Hook::CommitMsg
class SpellCheck (line 9) | class SpellCheck < Base
method run (line 14) | def run
method uncommented_commit_msg_file (line 32) | def uncommented_commit_msg_file
method parse_misspellings (line 39) | def parse_misspellings(output)
FILE: lib/overcommit/hook/commit_msg/text_width.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class TextWidth (line 6) | class TextWidth < Base
method run (line 7) | def run
method find_errors_in_subject (line 22) | def find_errors_in_subject(subject)
method find_errors_in_body (line 39) | def find_errors_in_body(lines)
method special_prefix_length (line 52) | def special_prefix_length(subject)
FILE: lib/overcommit/hook/commit_msg/trailing_period.rb
type Overcommit::Hook::CommitMsg (line 3) | module Overcommit::Hook::CommitMsg
class TrailingPeriod (line 5) | class TrailingPeriod < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/post_checkout/base.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class Base (line 7) | class Base < Overcommit::Hook::Base
method skip_file_checkout? (line 13) | def skip_file_checkout?
method enabled? (line 17) | def enabled?
FILE: lib/overcommit/hook/post_checkout/bower_install.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class BowerInstall (line 10) | class BowerInstall < Base
FILE: lib/overcommit/hook/post_checkout/bundle_install.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class BundleInstall (line 10) | class BundleInstall < Base
FILE: lib/overcommit/hook/post_checkout/composer_install.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class ComposerInstall (line 10) | class ComposerInstall < Base
FILE: lib/overcommit/hook/post_checkout/index_tags.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class IndexTags (line 9) | class IndexTags < Base
FILE: lib/overcommit/hook/post_checkout/npm_install.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class NpmInstall (line 10) | class NpmInstall < Base
FILE: lib/overcommit/hook/post_checkout/submodule_status.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class SubmoduleStatus (line 9) | class SubmoduleStatus < Base
FILE: lib/overcommit/hook/post_checkout/yarn_install.rb
type Overcommit::Hook::PostCheckout (line 5) | module Overcommit::Hook::PostCheckout
class YarnInstall (line 10) | class YarnInstall < Base
FILE: lib/overcommit/hook/post_commit/base.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class Base (line 7) | class Base < Overcommit::Hook::Base
FILE: lib/overcommit/hook/post_commit/bower_install.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class BowerInstall (line 10) | class BowerInstall < Base
FILE: lib/overcommit/hook/post_commit/bundle_install.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class BundleInstall (line 10) | class BundleInstall < Base
FILE: lib/overcommit/hook/post_commit/commitplease.rb
type Overcommit::Hook::PostCommit (line 3) | module Overcommit::Hook::PostCommit
class Commitplease (line 7) | class Commitplease < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/post_commit/composer_install.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class ComposerInstall (line 10) | class ComposerInstall < Base
FILE: lib/overcommit/hook/post_commit/git_guilt.rb
type Overcommit::Hook::PostCommit (line 3) | module Overcommit::Hook::PostCommit
class GitGuilt (line 7) | class GitGuilt < Base
method run (line 12) | def run
method color (line 40) | def color(code, str)
FILE: lib/overcommit/hook/post_commit/index_tags.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class IndexTags (line 9) | class IndexTags < Base
FILE: lib/overcommit/hook/post_commit/npm_install.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class NpmInstall (line 10) | class NpmInstall < Base
FILE: lib/overcommit/hook/post_commit/submodule_status.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class SubmoduleStatus (line 9) | class SubmoduleStatus < Base
FILE: lib/overcommit/hook/post_commit/yarn_install.rb
type Overcommit::Hook::PostCommit (line 5) | module Overcommit::Hook::PostCommit
class YarnInstall (line 10) | class YarnInstall < Base
FILE: lib/overcommit/hook/post_merge/base.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class Base (line 7) | class Base < Overcommit::Hook::Base
FILE: lib/overcommit/hook/post_merge/bower_install.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class BowerInstall (line 10) | class BowerInstall < Base
FILE: lib/overcommit/hook/post_merge/bundle_install.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class BundleInstall (line 10) | class BundleInstall < Base
FILE: lib/overcommit/hook/post_merge/composer_install.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class ComposerInstall (line 10) | class ComposerInstall < Base
FILE: lib/overcommit/hook/post_merge/index_tags.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class IndexTags (line 9) | class IndexTags < Base
FILE: lib/overcommit/hook/post_merge/npm_install.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class NpmInstall (line 10) | class NpmInstall < Base
FILE: lib/overcommit/hook/post_merge/submodule_status.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class SubmoduleStatus (line 9) | class SubmoduleStatus < Base
FILE: lib/overcommit/hook/post_merge/yarn_install.rb
type Overcommit::Hook::PostMerge (line 5) | module Overcommit::Hook::PostMerge
class YarnInstall (line 10) | class YarnInstall < Base
FILE: lib/overcommit/hook/post_rewrite/base.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class Base (line 7) | class Base < Overcommit::Hook::Base
FILE: lib/overcommit/hook/post_rewrite/bower_install.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class BowerInstall (line 10) | class BowerInstall < Base
FILE: lib/overcommit/hook/post_rewrite/bundle_install.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class BundleInstall (line 10) | class BundleInstall < Base
FILE: lib/overcommit/hook/post_rewrite/composer_install.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class ComposerInstall (line 10) | class ComposerInstall < Base
FILE: lib/overcommit/hook/post_rewrite/index_tags.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class IndexTags (line 9) | class IndexTags < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/post_rewrite/npm_install.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class NpmInstall (line 10) | class NpmInstall < Base
FILE: lib/overcommit/hook/post_rewrite/submodule_status.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class SubmoduleStatus (line 9) | class SubmoduleStatus < Base
FILE: lib/overcommit/hook/post_rewrite/yarn_install.rb
type Overcommit::Hook::PostRewrite (line 5) | module Overcommit::Hook::PostRewrite
class YarnInstall (line 10) | class YarnInstall < Base
FILE: lib/overcommit/hook/pre_commit/author_email.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class AuthorEmail (line 5) | class AuthorEmail < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/author_name.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class AuthorName (line 5) | class AuthorName < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/base.rb
type Overcommit::Hook::PreCommit (line 6) | module Overcommit::Hook::PreCommit
class Base (line 8) | class Base < Overcommit::Hook::Base
method extract_messages (line 15) | def extract_messages(*args)
FILE: lib/overcommit/hook/pre_commit/berksfile_check.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class BerksfileCheck (line 8) | class BerksfileCheck < Base
method run (line 11) | def run
FILE: lib/overcommit/hook/pre_commit/broken_symlinks.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class BrokenSymlinks (line 5) | class BrokenSymlinks < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/bundle_audit.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class BundleAudit (line 7) | class BundleAudit < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/bundle_check.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class BundleCheck (line 8) | class BundleCheck < Base
method run (line 11) | def run
FILE: lib/overcommit/hook/pre_commit/bundle_outdated.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class BundleOutdated (line 8) | class BundleOutdated < Base
method run (line 11) | def run
FILE: lib/overcommit/hook/pre_commit/case_conflicts.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class CaseConflicts (line 6) | class CaseConflicts < Base
method run (line 7) | def run
FILE: lib/overcommit/hook/pre_commit/chamber_compare.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ChamberCompare (line 8) | class ChamberCompare < Base
method run (line 9) | def run
FILE: lib/overcommit/hook/pre_commit/chamber_security.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ChamberSecurity (line 7) | class ChamberSecurity < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/chamber_verification.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ChamberVerification (line 8) | class ChamberVerification < Base
method run (line 9) | def run
FILE: lib/overcommit/hook/pre_commit/code_spell_check.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class CodeSpellCheck (line 7) | class CodeSpellCheck < Base
method run (line 8) | def run
method error_messages (line 24) | def error_messages(spellchecking_errors)
FILE: lib/overcommit/hook/pre_commit/coffee_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class CoffeeLint (line 7) | class CoffeeLint < Base
method run (line 19) | def run
method parse_messages (line 26) | def parse_messages(output)
FILE: lib/overcommit/hook/pre_commit/cook_style.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class CookStyle (line 7) | class CookStyle < Base
method run (line 16) | def run
FILE: lib/overcommit/hook/pre_commit/credo.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Credo (line 7) | class Credo < Base
method run (line 12) | def run
method message (line 22) | def message(error)
FILE: lib/overcommit/hook/pre_commit/css_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class CssLint (line 7) | class CssLint < Base
method run (line 14) | def run
FILE: lib/overcommit/hook/pre_commit/dart_analyzer.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class DartAnalyzer (line 6) | class DartAnalyzer < Base
method run (line 9) | def run
FILE: lib/overcommit/hook/pre_commit/dogma.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Dogma (line 7) | class Dogma < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/erb_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ErbLint (line 7) | class ErbLint < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/es_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class EsLint (line 20) | class EsLint < Base
method run (line 21) | def run
FILE: lib/overcommit/hook/pre_commit/execute_permissions.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ExecutePermissions (line 17) | class ExecutePermissions < Base
method run (line 18) | def run
method extract_from_git_tree (line 46) | def extract_from_git_tree(file_modes)
method extract_from_git_index (line 56) | def extract_from_git_index(file_modes)
method execute_permissions? (line 72) | def execute_permissions?(mode)
FILE: lib/overcommit/hook/pre_commit/fasterer.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Fasterer (line 7) | class Fasterer < Base
method run (line 8) | def run
method extract_offense_num (line 21) | def extract_offense_num(raw_output)
FILE: lib/overcommit/hook/pre_commit/file_size.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class FileSize (line 5) | class FileSize < Base
method run (line 6) | def run
method description (line 14) | def description
method oversized_files (line 20) | def oversized_files
method build_oversized_file_list (line 24) | def build_oversized_file_list
method size_limit_bytes (line 30) | def size_limit_bytes
method error_message_for (line 34) | def error_message_for(file)
method file_size (line 43) | def file_size(file)
FILE: lib/overcommit/hook/pre_commit/fix_me.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class FixMe (line 5) | class FixMe < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/flay.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Flay (line 7) | class Flay < Base
method run (line 19) | def run
FILE: lib/overcommit/hook/pre_commit/foodcritic.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Foodcritic (line 97) | class Foodcritic < Base
method run (line 98) | def run
method directories_changed (line 111) | def directories_changed(dir_prefix)
method modified_environments_args (line 120) | def modified_environments_args
method modified_roles_args (line 124) | def modified_roles_args
method modified_cookbooks_args (line 128) | def modified_cookbooks_args
method modified (line 138) | def modified(type)
method full_directory_path (line 145) | def full_directory_path(config_option)
FILE: lib/overcommit/hook/pre_commit/forbidden_branches.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ForbiddenBranches (line 5) | class ForbiddenBranches < Base
method run (line 6) | def run
method forbidden_commit? (line 14) | def forbidden_commit?
method forbidden_branch_patterns (line 18) | def forbidden_branch_patterns
method current_branch (line 22) | def current_branch
FILE: lib/overcommit/hook/pre_commit/ginkgo_focus.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class GinkgoFocus (line 5) | class GinkgoFocus < Base
method run (line 6) | def run
method applicable_test_files (line 17) | def applicable_test_files
FILE: lib/overcommit/hook/pre_commit/go_fmt.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class GoFmt (line 5) | class GoFmt < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/go_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class GoLint (line 7) | class GoLint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/go_vet.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class GoVet (line 7) | class GoVet < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/golangci_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class GolangciLint (line 7) | class GolangciLint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/hadolint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Hadolint (line 7) | class Hadolint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/haml_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class HamlLint (line 7) | class HamlLint < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/pre_commit/hard_tabs.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class HardTabs (line 5) | class HardTabs < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/hlint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Hlint (line 7) | class Hlint < Base
method run (line 19) | def run
FILE: lib/overcommit/hook/pre_commit/html_hint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class HtmlHint (line 7) | class HtmlHint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/html_tidy.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class HtmlTidy (line 7) | class HtmlTidy < Base
method run (line 15) | def run
FILE: lib/overcommit/hook/pre_commit/image_optim.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ImageOptim (line 7) | class ImageOptim < Base
method run (line 8) | def run
method extract_optimized_files (line 22) | def extract_optimized_files(output)
FILE: lib/overcommit/hook/pre_commit/java_checkstyle.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class JavaCheckstyle (line 7) | class JavaCheckstyle < Base
method run (line 14) | def run
FILE: lib/overcommit/hook/pre_commit/js_hint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class JsHint (line 7) | class JsHint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/js_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class JsLint (line 7) | class JsLint < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/jscs.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Jscs (line 8) | class Jscs < Base
method run (line 9) | def run
FILE: lib/overcommit/hook/pre_commit/jsl.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Jsl (line 7) | class Jsl < Base
method run (line 14) | def run
FILE: lib/overcommit/hook/pre_commit/json_syntax.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class JsonSyntax (line 5) | class JsonSyntax < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/kt_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class KtLint (line 6) | class KtLint < Base
method run (line 9) | def run
FILE: lib/overcommit/hook/pre_commit/license_finder.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class LicenseFinder (line 6) | class LicenseFinder < Base
method run (line 7) | def run
FILE: lib/overcommit/hook/pre_commit/license_header.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class LicenseHeader (line 5) | class LicenseHeader < Base
method run (line 6) | def run
method check_file (line 22) | def check_file(file, license_contents)
method license_file (line 37) | def license_file
method license_lines (line 41) | def license_lines
FILE: lib/overcommit/hook/pre_commit/line_endings.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class LineEndings (line 7) | class LineEndings < Base
method run (line 8) | def run
method check_file (line 32) | def check_file(file, file_name)
method offending_files (line 53) | def offending_files
method eol (line 67) | def eol
FILE: lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class LocalPathsInGemfile (line 5) | class LocalPathsInGemfile < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/mdl.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Mdl (line 7) | class Mdl < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/merge_conflicts.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class MergeConflicts (line 5) | class MergeConflicts < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/mix_format.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class MixFormat (line 7) | class MixFormat < Base
method run (line 16) | def run
method message (line 26) | def message(file)
FILE: lib/overcommit/hook/pre_commit/nginx_test.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class NginxTest (line 7) | class NginxTest < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/pep257.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Pep257 (line 7) | class Pep257 < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/pep8.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Pep8 (line 7) | class Pep8 < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/php_cs.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class PhpCs (line 5) | class PhpCs < Base
method run (line 12) | def run
method parse_messages (line 29) | def parse_messages(messages)
FILE: lib/overcommit/hook/pre_commit/php_cs_fixer.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class PhpCsFixer (line 5) | class PhpCsFixer < Base
method run (line 8) | def run
method parse_messages (line 35) | def parse_messages(messages)
FILE: lib/overcommit/hook/pre_commit/php_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class PhpLint (line 5) | class PhpLint < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/pre_commit/php_stan.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class PhpStan (line 10) | class PhpStan < Base
method run (line 13) | def run
FILE: lib/overcommit/hook/pre_commit/pronto.rb
type Overcommit::Hook::PreCommit (line 5) | module Overcommit::Hook::PreCommit
class Pronto (line 9) | class Pronto < Base
FILE: lib/overcommit/hook/pre_commit/puppet_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class PuppetLint (line 7) | class PuppetLint < Base
method run (line 14) | def run
FILE: lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class PuppetMetadataJsonLint (line 10) | class PuppetMetadataJsonLint < Base
method run (line 17) | def run
FILE: lib/overcommit/hook/pre_commit/pycodestyle.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Pycodestyle (line 7) | class Pycodestyle < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/pydocstyle.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Pydocstyle (line 7) | class Pydocstyle < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/pyflakes.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Pyflakes (line 7) | class Pyflakes < Base
method run (line 10) | def run
method get_messages (line 22) | def get_messages(output, type)
FILE: lib/overcommit/hook/pre_commit/pylint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Pylint (line 7) | class Pylint < Base
method run (line 17) | def run
FILE: lib/overcommit/hook/pre_commit/python_flake8.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class PythonFlake8 (line 7) | class PythonFlake8 < Base
method run (line 17) | def run
FILE: lib/overcommit/hook/pre_commit/r_spec.rb
type Overcommit::Hook::PreCommit (line 5) | module Overcommit::Hook::PreCommit
class RSpec (line 9) | class RSpec < Base
FILE: lib/overcommit/hook/pre_commit/rails_best_practices.rb
type Overcommit (line 3) | module Overcommit
type Hook (line 4) | module Hook
type PreCommit (line 5) | module PreCommit
class RailsBestPractices (line 9) | class RailsBestPractices < Base
method run (line 12) | def run
method filter_output (line 26) | def filter_output(stdout)
FILE: lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class RailsSchemaUpToDate (line 8) | class RailsSchemaUpToDate < Base
method run (line 9) | def run # rubocop:disable Metrics/CyclomaticComplexity, Metrics/Perc...
method encoding (line 37) | def encoding
method migration_files (line 43) | def migration_files
method schema_files (line 49) | def schema_files
method schema (line 55) | def schema
method non_zero_schema_version? (line 60) | def non_zero_schema_version?
FILE: lib/overcommit/hook/pre_commit/rake_target.rb
type Overcommit::Hook::PreCommit (line 5) | module Overcommit::Hook::PreCommit
class RakeTarget (line 9) | class RakeTarget < Base
FILE: lib/overcommit/hook/pre_commit/reek.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Reek (line 7) | class Reek < Base
method run (line 8) | def run
method scrub_output (line 22) | def scrub_output(raw_output)
FILE: lib/overcommit/hook/pre_commit/rst_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class RstLint (line 7) | class RstLint < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/pre_commit/rubo_cop.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class RuboCop (line 7) | class RuboCop < Base
method run (line 16) | def run
FILE: lib/overcommit/hook/pre_commit/ruby_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class RubyLint (line 7) | class RubyLint < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/pre_commit/ruby_syntax.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class RubySyntax (line 6) | class RubySyntax < Base
method run (line 11) | def run
FILE: lib/overcommit/hook/pre_commit/scalariform.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Scalariform (line 7) | class Scalariform < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/scalastyle.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Scalastyle (line 7) | class Scalastyle < Base
method run (line 15) | def run
FILE: lib/overcommit/hook/pre_commit/scss_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ScssLint (line 7) | class ScssLint < Base
method run (line 8) | def run
method collect_lint_messages (line 29) | def collect_lint_messages(files_to_lints)
FILE: lib/overcommit/hook/pre_commit/semi_standard.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class SemiStandard (line 7) | class SemiStandard < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/shell_check.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class ShellCheck (line 7) | class ShellCheck < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/pre_commit/slim_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class SlimLint (line 7) | class SlimLint < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/pre_commit/solargraph.rb
type Overcommit (line 6) | module Overcommit
type Hook (line 7) | module Hook
type PreCommit (line 8) | module PreCommit
class Solargraph (line 12) | class Solargraph < Base
method run (line 15) | def run
method remove_harmless_glitches (line 38) | def remove_harmless_glitches(stderr)
FILE: lib/overcommit/hook/pre_commit/sorbet.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Sorbet (line 7) | class Sorbet < Base
method run (line 12) | def run
FILE: lib/overcommit/hook/pre_commit/sqlint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Sqlint (line 7) | class Sqlint < Base
method run (line 14) | def run
FILE: lib/overcommit/hook/pre_commit/standard.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Standard (line 7) | class Standard < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/stylelint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Stylelint (line 7) | class Stylelint < Base
method run (line 13) | def run
FILE: lib/overcommit/hook/pre_commit/swift_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class SwiftLint (line 6) | class SwiftLint < Base
method run (line 9) | def run
FILE: lib/overcommit/hook/pre_commit/terraform_format.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class TerraformFormat (line 7) | class TerraformFormat < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/trailing_whitespace.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class TrailingWhitespace (line 5) | class TrailingWhitespace < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/travis_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class TravisLint (line 7) | class TravisLint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/ts_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class TsLint (line 6) | class TsLint < Base
method run (line 13) | def run
FILE: lib/overcommit/hook/pre_commit/vint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class Vint (line 7) | class Vint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_commit/w3c_css.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class W3cCss (line 7) | class W3cCss < Base
method run (line 8) | def run
method collect_messages (line 17) | def collect_messages
method validator (line 32) | def validator
method opts (line 42) | def opts
method language (line 52) | def language
method profile (line 58) | def profile
method warn_level (line 63) | def warn_level
FILE: lib/overcommit/hook/pre_commit/w3c_html.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class W3cHtml (line 7) | class W3cHtml < Base
method run (line 8) | def run
method collect_messages (line 17) | def collect_messages
method validator (line 32) | def validator
method opts (line 42) | def opts
method charset (line 54) | def charset
method doctype (line 60) | def doctype
FILE: lib/overcommit/hook/pre_commit/xml_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class XmlLint (line 7) | class XmlLint < Base
method run (line 10) | def run
FILE: lib/overcommit/hook/pre_commit/xml_syntax.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class XmlSyntax (line 5) | class XmlSyntax < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_commit/yaml_lint.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class YamlLint (line 7) | class YamlLint < Base
method run (line 16) | def run
method parse_messages (line 23) | def parse_messages(output)
FILE: lib/overcommit/hook/pre_commit/yaml_syntax.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class YamlSyntax (line 5) | class YamlSyntax < Base
method run (line 6) | def run
method error_message (line 26) | def error_message(file, error)
FILE: lib/overcommit/hook/pre_commit/yard_coverage.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class YardCoverage (line 9) | class YardCoverage < Base
method run (line 10) | def run
method check_yard_coverage (line 48) | def check_yard_coverage(stat_lines)
method error_messages (line 65) | def error_messages(yard_coverage, error_text)
FILE: lib/overcommit/hook/pre_commit/yarn_check.rb
type Overcommit::Hook::PreCommit (line 3) | module Overcommit::Hook::PreCommit
class YarnCheck (line 8) | class YarnCheck < Base
method run (line 18) | def run
FILE: lib/overcommit/hook/pre_push/base.rb
type Overcommit::Hook::PrePush (line 6) | module Overcommit::Hook::PrePush
class Base (line 8) | class Base < Overcommit::Hook::Base
method run? (line 13) | def run?
method extract_messages (line 21) | def extract_messages(*args)
method exclude_remotes (line 25) | def exclude_remotes
method include_remote_ref_deletions? (line 29) | def include_remote_ref_deletions?
FILE: lib/overcommit/hook/pre_push/brakeman.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class Brakeman (line 7) | class Brakeman < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/cargo_test.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class CargoTest (line 5) | class CargoTest < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_push/flutter_test.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class FlutterTest (line 7) | class FlutterTest < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/go_test.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class GoTest (line 5) | class GoTest < Base
method run (line 6) | def run
FILE: lib/overcommit/hook/pre_push/golangci_lint.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class GolangciLint (line 7) | class GolangciLint < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/minitest.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class Minitest (line 7) | class Minitest < Base
method run (line 8) | def run
method command (line 16) | def command
FILE: lib/overcommit/hook/pre_push/mix_test.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class MixTest (line 7) | class MixTest < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/php_unit.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class PhpUnit (line 7) | class PhpUnit < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/pronto.rb
type Overcommit::Hook::PrePush (line 5) | module Overcommit::Hook::PrePush
class Pronto (line 9) | class Pronto < Base
FILE: lib/overcommit/hook/pre_push/protected_branches.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class ProtectedBranches (line 7) | class ProtectedBranches < Base
method run (line 8) | def run
method illegal_pushes (line 20) | def illegal_pushes
method protected? (line 26) | def protected?(ref)
method find_pattern (line 30) | def find_pattern(remote_ref)
method patterns (line 39) | def patterns
method fetch_patterns (line 43) | def fetch_patterns
method branch_configurations (line 53) | def branch_configurations
method global_destructive_only? (line 57) | def global_destructive_only?
method destructive? (line 65) | def destructive?(ref)
FILE: lib/overcommit/hook/pre_push/pub_test.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class PubTest (line 7) | class PubTest < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/pytest.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class Pytest (line 7) | class Pytest < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/python_nose.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class PythonNose (line 7) | class PythonNose < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_push/r_spec.rb
type Overcommit::Hook::PrePush (line 5) | module Overcommit::Hook::PrePush
class RSpec (line 9) | class RSpec < Base
FILE: lib/overcommit/hook/pre_push/rake_target.rb
type Overcommit::Hook::PrePush (line 5) | module Overcommit::Hook::PrePush
class RakeTarget (line 9) | class RakeTarget < Base
FILE: lib/overcommit/hook/pre_push/test_unit.rb
type Overcommit::Hook::PrePush (line 3) | module Overcommit::Hook::PrePush
class TestUnit (line 7) | class TestUnit < Base
method run (line 8) | def run
FILE: lib/overcommit/hook/pre_rebase/base.rb
type Overcommit::Hook::PreRebase (line 5) | module Overcommit::Hook::PreRebase
class Base (line 7) | class Base < Overcommit::Hook::Base
FILE: lib/overcommit/hook/pre_rebase/merged_commits.rb
type Overcommit::Hook::PreRebase (line 3) | module Overcommit::Hook::PreRebase
class MergedCommits (line 6) | class MergedCommits < Base
method run (line 7) | def run
method branches (line 19) | def branches
method illegal_commits (line 23) | def illegal_commits
FILE: lib/overcommit/hook/prepare_commit_msg/base.rb
type Overcommit::Hook::PrepareCommitMsg (line 5) | module Overcommit::Hook::PrepareCommitMsg
class Base (line 7) | class Base < Overcommit::Hook::Base
method modify_commit_message (line 13) | def modify_commit_message
FILE: lib/overcommit/hook/prepare_commit_msg/replace_branch.rb
type Overcommit::Hook::PrepareCommitMsg (line 3) | module Overcommit::Hook::PrepareCommitMsg
class ReplaceBranch (line 31) | class ReplaceBranch < Base
method run (line 34) | def run
method new_template (line 52) | def new_template
method branch_pattern (line 60) | def branch_pattern
method replacement_text (line 68) | def replacement_text
method replacement_text_config (line 79) | def replacement_text_config
method skipped_commit_types (line 83) | def skipped_commit_types
method skip? (line 87) | def skip?
FILE: lib/overcommit/hook/shared/bower_install.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type BowerInstall (line 8) | module BowerInstall
function run (line 9) | def run
FILE: lib/overcommit/hook/shared/bundle_install.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type BundleInstall (line 8) | module BundleInstall
function run (line 9) | def run
FILE: lib/overcommit/hook/shared/composer_install.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type ComposerInstall (line 8) | module ComposerInstall
function run (line 9) | def run
FILE: lib/overcommit/hook/shared/index_tags.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type IndexTags (line 8) | module IndexTags
function run (line 9) | def run
FILE: lib/overcommit/hook/shared/npm_install.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type NpmInstall (line 8) | module NpmInstall
function run (line 9) | def run
FILE: lib/overcommit/hook/shared/pronto.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type Pronto (line 7) | module Pronto
function run (line 14) | def run
FILE: lib/overcommit/hook/shared/r_spec.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type RSpec (line 7) | module RSpec
function run (line 8) | def run
FILE: lib/overcommit/hook/shared/rake_target.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type RakeTarget (line 7) | module RakeTarget
function run (line 8) | def run
FILE: lib/overcommit/hook/shared/submodule_status.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type SubmoduleStatus (line 7) | module SubmoduleStatus
function run (line 8) | def run
function submodule_statuses (line 28) | def submodule_statuses
FILE: lib/overcommit/hook/shared/yarn_install.rb
type Overcommit::Hook::Shared (line 3) | module Overcommit::Hook::Shared
type YarnInstall (line 8) | module YarnInstall
function run (line 9) | def run
FILE: lib/overcommit/hook_context.rb
type Overcommit::HookContext (line 4) | module Overcommit::HookContext
function create (line 5) | def self.create(hook_type, config, args, input, **cli_options)
FILE: lib/overcommit/hook_context/base.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class Base (line 15) | class Base
method initialize (line 22) | def initialize(config, args, input, **options)
method execute_hook (line 34) | def execute_hook(command)
method hook_class_name (line 41) | def hook_class_name
method hook_type_name (line 48) | def hook_type_name
method hook_script_name (line 55) | def hook_script_name
method setup_environment (line 63) | def setup_environment
method cleanup_environment (line 72) | def cleanup_environment
method modified_files (line 82) | def modified_files
method all_files (line 89) | def all_files
method input_string (line 97) | def input_string
method input_lines (line 105) | def input_lines
method post_fail_message (line 112) | def post_fail_message
method filter_modified_files (line 118) | def filter_modified_files(modified_files)
method filter_nonexistent (line 126) | def filter_nonexistent(modified_files)
method filter_directories (line 135) | def filter_directories(modified_files)
FILE: lib/overcommit/hook_context/commit_msg.rb
type Overcommit::HookContext (line 7) | module Overcommit::HookContext
class CommitMsg (line 9) | class CommitMsg < Base
method empty_message? (line 13) | def empty_message?
method commit_message (line 18) | def commit_message
method update_commit_message (line 23) | def update_commit_message(message)
method commit_message_lines (line 29) | def commit_message_lines
method comment_character (line 35) | def comment_character
method commit_message_file (line 39) | def commit_message_file
method post_fail_message (line 43) | def post_fail_message
method raw_commit_message_lines (line 51) | def raw_commit_message_lines
FILE: lib/overcommit/hook_context/diff.rb
type Overcommit::HookContext (line 7) | module Overcommit::HookContext
class Diff (line 12) | class Diff < Base
method modified_files (line 13) | def modified_files
method modified_lines_in_file (line 17) | def modified_lines_in_file(file)
method hook_class_name (line 23) | def hook_class_name
method hook_type_name (line 27) | def hook_type_name
method hook_script_name (line 31) | def hook_script_name
method initial_commit? (line 35) | def initial_commit?
FILE: lib/overcommit/hook_context/helpers/file_modifications.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
type Helpers (line 4) | module Helpers
type FileModifications (line 7) | module FileModifications
function amendment? (line 9) | def amendment?
function modified_files (line 45) | def modified_files
function modified_lines_in_file (line 62) | def modified_lines_in_file(file)
FILE: lib/overcommit/hook_context/helpers/stash_unstaged_changes.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
type Helpers (line 4) | module Helpers
type StashUnstagedChanges (line 7) | module StashUnstagedChanges
function setup_environment (line 10) | def setup_environment
function initial_commit? (line 27) | def initial_commit?
function cleanup_environment (line 40) | def cleanup_environment
function store_modified_times (line 58) | def store_modified_times
function unstaged_changes? (line 74) | def unstaged_changes?
function stash_changes (line 79) | def stash_changes
function restore_modified_times (line 102) | def restore_modified_times
function clear_working_tree (line 112) | def clear_working_tree
function restore_working_tree (line 134) | def restore_working_tree
FILE: lib/overcommit/hook_context/post_checkout.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class PostCheckout (line 6) | class PostCheckout < Base
method previous_head (line 8) | def previous_head
method new_head (line 13) | def new_head
method branch_checkout? (line 19) | def branch_checkout?
method file_checkout? (line 24) | def file_checkout?
method modified_files (line 31) | def modified_files
FILE: lib/overcommit/hook_context/post_commit.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class PostCommit (line 6) | class PostCommit < Base
method modified_files (line 10) | def modified_files
method modified_lines_in_file (line 17) | def modified_lines_in_file(file)
method initial_commit? (line 28) | def initial_commit?
FILE: lib/overcommit/hook_context/post_merge.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class PostMerge (line 6) | class PostMerge < Base
method modified_files (line 11) | def modified_files
method modified_lines_in_file (line 19) | def modified_lines_in_file(file)
method squash? (line 28) | def squash?
method merge_commit? (line 33) | def merge_commit?
FILE: lib/overcommit/hook_context/post_rewrite.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class PostRewrite (line 5) | class PostRewrite < Base
method amend? (line 9) | def amend?
method rebase? (line 16) | def rebase?
method rewritten_commits (line 24) | def rewritten_commits
method modified_files (line 33) | def modified_files
FILE: lib/overcommit/hook_context/pre_commit.rb
type Overcommit::HookContext (line 8) | module Overcommit::HookContext
class PreCommit (line 14) | class PreCommit < Base
FILE: lib/overcommit/hook_context/pre_push.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class PrePush (line 5) | class PrePush < Base
method remote_name (line 8) | def remote_name
method remote_url (line 12) | def remote_url
method remote_ref_deletion? (line 16) | def remote_ref_deletion?
method pushed_refs (line 25) | def pushed_refs
method modified_files (line 31) | def modified_files
method modified_lines_in_file (line 35) | def modified_lines_in_file(file)
method forced? (line 43) | def forced?
method created? (line 47) | def created?
method deleted? (line 51) | def deleted?
method destructive? (line 55) | def destructive?
method modified_files (line 59) | def modified_files
method modified_lines_in_file (line 63) | def modified_lines_in_file(file)
method to_s (line 67) | def to_s
method ref_range (line 73) | def ref_range
method overwritten_commits (line 77) | def overwritten_commits
FILE: lib/overcommit/hook_context/pre_rebase.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class PreRebase (line 6) | class PreRebase < Base
method upstream_branch (line 8) | def upstream_branch
method rebased_branch (line 14) | def rebased_branch
method detached_head? (line 20) | def detached_head?
method fast_forward? (line 25) | def fast_forward?
method rebased_commits (line 31) | def rebased_commits
FILE: lib/overcommit/hook_context/prepare_commit_msg.rb
type Overcommit::HookContext (line 3) | module Overcommit::HookContext
class PrepareCommitMsg (line 6) | class PrepareCommitMsg < Base
method commit_message_filename (line 8) | def commit_message_filename
method commit_message_source (line 18) | def commit_message_source
method commit_message_source_ref (line 24) | def commit_message_source_ref
method lock (line 30) | def lock
FILE: lib/overcommit/hook_context/run_all.rb
type Overcommit::HookContext (line 5) | module Overcommit::HookContext
class RunAll (line 10) | class RunAll < Base
method modified_files (line 11) | def modified_files
method modified_lines_in_file (line 20) | def modified_lines_in_file(file)
method hook_class_name (line 25) | def hook_class_name
method hook_type_name (line 29) | def hook_type_name
method hook_script_name (line 33) | def hook_script_name
method initial_commit? (line 37) | def initial_commit?
method count_lines (line 45) | def count_lines(file)
FILE: lib/overcommit/hook_loader/base.rb
type Overcommit::HookLoader (line 3) | module Overcommit::HookLoader
class Base (line 5) | class Base
method initialize (line 9) | def initialize(config, context, logger)
method load_hooks (line 19) | def load_hooks
method create_hook (line 28) | def create_hook(hook_name)
FILE: lib/overcommit/hook_loader/built_in_hook_loader.rb
type Overcommit::HookLoader (line 3) | module Overcommit::HookLoader
class BuiltInHookLoader (line 5) | class BuiltInHookLoader < Base
method load_hooks (line 6) | def load_hooks
FILE: lib/overcommit/hook_loader/plugin_hook_loader.rb
type Overcommit::HookLoader (line 5) | module Overcommit::HookLoader
class PluginHookLoader (line 8) | class PluginHookLoader < Base
method load_hooks (line 9) | def load_hooks
method update_signatures (line 24) | def update_signatures
method plugin_paths (line 35) | def plugin_paths
method plugin_hook_names (line 40) | def plugin_hook_names
method ad_hoc_hook_names (line 46) | def ad_hoc_hook_names
method modified_plugins (line 50) | def modified_plugins
method check_for_modified_plugins (line 56) | def check_for_modified_plugins
method create_ad_hoc_hook (line 77) | def create_ad_hoc_hook(hook_name)
FILE: lib/overcommit/hook_runner.rb
type Overcommit (line 3) | module Overcommit
class HookRunner (line 6) | class HookRunner # rubocop:disable Metrics/ClassLength
method initialize (line 11) | def initialize(config, logger, context, printer)
method run (line 24) | def run
method run_hooks (line 56) | def run_hooks # rubocop:disable Metrics/MethodLength
method consume (line 93) | def consume
method wait_for_slot (line 102) | def wait_for_slot(hook)
method release_slot (line 128) | def release_slot(hook)
method processors_for_hook (line 139) | def processors_for_hook(hook)
method print_results (line 143) | def print_results
method run_hook (line 155) | def run_hook(hook) # rubocop:disable Metrics/CyclomaticComplexity
method should_skip? (line 183) | def should_skip?(hook)
method load_hooks (line 199) | def load_hooks
FILE: lib/overcommit/hook_signer.rb
type Overcommit (line 3) | module Overcommit
class HookSigner (line 5) | class HookSigner
method initialize (line 15) | def initialize(hook_name, config, context)
method hook_path (line 25) | def hook_path
method signable_file? (line 53) | def signable_file?(file)
method signature_changed? (line 65) | def signature_changed?
method update_signature! (line 70) | def update_signature!
method signature (line 88) | def signature
method hook_contents (line 101) | def hook_contents
method stored_signature (line 105) | def stored_signature
method signature_config_key (line 120) | def signature_config_key
FILE: lib/overcommit/installer.rb
type Overcommit (line 5) | module Overcommit
class Installer (line 7) | class Installer # rubocop:disable Metrics/ClassLength
method initialize (line 11) | def initialize(logger)
method run (line 15) | def run(target, options)
method install (line 32) | def install
method uninstall (line 47) | def uninstall
method update (line 58) | def update
method hooks_path (line 69) | def hooks_path
method old_hooks_path (line 73) | def old_hooks_path
method master_hook_install_path (line 77) | def master_hook_install_path
method ensure_directory (line 81) | def ensure_directory(path)
method validate_target (line 85) | def validate_target
method install_master_hook (line 101) | def install_master_hook
method uninstall_master_hook (line 106) | def uninstall_master_hook
method install_hook_files (line 110) | def install_hook_files
method can_replace_file? (line 125) | def can_replace_file?(file)
method preserve_old_hooks (line 131) | def preserve_old_hooks
method restore_old_hooks (line 147) | def restore_old_hooks
method uninstall_hook_files (line 163) | def uninstall_hook_files
method install_starter_config (line 173) | def install_starter_config
method overcommit_hook? (line 181) | def overcommit_hook?(file)
method config (line 190) | def config(options = {})
FILE: lib/overcommit/interrupt_handler.rb
class InterruptHandler (line 7) | class InterruptHandler
method initialize (line 13) | def initialize
method disable_until_finished_or_interrupted (line 62) | def disable_until_finished_or_interrupted
method disable! (line 71) | def disable!
method enable! (line 76) | def enable!
method isolate_from_interrupts (line 83) | def isolate_from_interrupts
FILE: lib/overcommit/logger.rb
type Overcommit (line 3) | module Overcommit
class Logger (line 5) | class Logger
method silent (line 7) | def self.silent
method initialize (line 14) | def initialize(out)
method partial (line 25) | def partial(*args)
method newline (line 30) | def newline
method flush (line 35) | def flush
method log (line 42) | def log(*args)
method debug (line 47) | def debug(*args)
method bold (line 52) | def bold(*args)
method error (line 57) | def error(*args)
method bold_error (line 63) | def bold_error(*args)
method success (line 68) | def success(*args)
method warning (line 74) | def warning(*args)
method bold_warning (line 80) | def bold_warning(*args)
method color (line 92) | def color(code, str, partial = false)
FILE: lib/overcommit/message_processor.rb
type Overcommit (line 3) | module Overcommit
class MessageProcessor (line 10) | class MessageProcessor
method initialize (line 21) | def initialize(hook, unmodified_lines_setting)
method hook_result (line 30) | def hook_result(messages)
method handle_modified_lines (line 44) | def handle_modified_lines(messages, status)
method transform_status (line 73) | def transform_status(status, messages_on_modified_lines)
method can_upgrade_to_warning? (line 91) | def can_upgrade_to_warning?(status, error_messages)
method can_upgrade_to_passing? (line 95) | def can_upgrade_to_passing?(status, warning_messages)
method basic_status_and_output (line 101) | def basic_status_and_output(messages)
method print_messages (line 119) | def print_messages(messages, error_heading, warning_heading)
method remove_ignored_messages (line 134) | def remove_ignored_messages(messages)
method message_on_modified_line? (line 141) | def message_on_modified_line?(message)
FILE: lib/overcommit/os.rb
type Overcommit (line 5) | module Overcommit
type OS (line 7) | module OS
function windows? (line 9) | def windows?
function cygwin? (line 13) | def cygwin?
function mac? (line 17) | def mac?
function unix? (line 21) | def unix?
function linux? (line 25) | def linux?
function host_os (line 31) | def host_os
FILE: lib/overcommit/printer.rb
type Overcommit (line 5) | module Overcommit
class Printer (line 8) | class Printer
method initialize (line 11) | def initialize(config, logger, context)
method start_run (line 20) | def start_run
method nothing_to_run (line 24) | def nothing_to_run
method hook_skipped (line 28) | def hook_skipped(hook)
method required_hook_not_skipped (line 32) | def required_hook_not_skipped(hook)
method end_hook (line 37) | def end_hook(hook, status, output)
method interrupt_triggered (line 45) | def interrupt_triggered
method run_interrupted (line 50) | def run_interrupted
method run_failed (line 57) | def run_failed
method run_warned (line 64) | def run_warned
method run_succeeded (line 71) | def run_succeeded
method hook_run_failed (line 79) | def hook_run_failed(message)
method print_header (line 87) | def print_header(hook)
method print_result (line 95) | def print_result(hook, status, output) # rubocop:disable Metrics/Cyc...
method print_report (line 115) | def print_report(output, format = :log)
method hook_script_name (line 119) | def hook_script_name
method synchronize_all_methods (line 126) | def synchronize_all_methods
FILE: lib/overcommit/subprocess.rb
type Overcommit (line 7) | module Overcommit
class Subprocess (line 10) | class Subprocess
method success? (line 17) | def success?
method spawn (line 30) | def spawn(args, options = {})
method spawn_detached (line 60) | def spawn_detached(args)
method win32_prepare_args (line 75) | def win32_prepare_args(args)
method assign_output_streams (line 89) | def assign_output_streams(process)
FILE: lib/overcommit/utils.rb
type Overcommit (line 9) | module Overcommit
type Utils (line 11) | module Utils
class Version (line 15) | class Version < Gem::Version
function script_path (line 34) | def script_path(script)
function repo_root (line 45) | def repo_root
function git_dir (line 61) | def git_dir
function strip_color_codes (line 82) | def strip_color_codes(text)
function snake_case (line 88) | def snake_case(str)
function camel_case (line 97) | def camel_case(str)
function supported_hook_types (line 102) | def supported_hook_types
function supported_hook_type_classes (line 110) | def supported_hook_type_classes
function in_path? (line 119) | def in_path?(cmd)
function parent_command (line 138) | def parent_command
function execute (line 175) | def execute(initial_args, options = {})
function execute_in_background (line 204) | def execute_in_background(args)
function processor_count (line 217) | def processor_count # rubocop:disable all
function with_environment (line 253) | def with_environment(env)
function broken_symlink? (line 268) | def broken_symlink?(file)
function convert_glob_to_absolute (line 279) | def convert_glob_to_absolute(glob)
function matches_path? (line 287) | def matches_path?(pattern, path)
function debug (line 304) | def debug(*args)
FILE: lib/overcommit/utils/file_utils.rb
type Overcommit::Utils (line 6) | module Overcommit::Utils
type FileUtils (line 8) | module FileUtils
function symlink (line 13) | def symlink(old_name, new_name)
function symlink? (line 23) | def symlink?(file_name)
function readlink (line 34) | def readlink(link_name)
function win32_dir_cmd (line 50) | def win32_dir_cmd(file_name)
function win32_mklink_cmd (line 56) | def win32_mklink_cmd(old_name, new_name)
function win32_fix_pathsep (line 62) | def win32_fix_pathsep(path)
function win32_symlink? (line 66) | def win32_symlink?(dir_output)
FILE: lib/overcommit/utils/messages_utils.rb
type Overcommit::Utils (line 3) | module Overcommit::Utils
type MessagesUtils (line 5) | module MessagesUtils
function extract_messages (line 23) | def extract_messages(output_messages, regex, type_categorizer = nil)
function extract_file (line 42) | def extract_file(match, message)
function extract_line (line 53) | def extract_line(match, message)
function extract_type (line 62) | def extract_type(match, message, type_categorizer)
FILE: lib/overcommit/version.rb
type Overcommit (line 4) | module Overcommit
FILE: spec/overcommit/hook/pre_commit/execute_permissions_spec.rb
function make_executable_and_add (line 11) | def make_executable_and_add(file, exec_bit)
FILE: spec/overcommit/hook/prepare_commit_msg/replace_branch_spec.rb
function checkout_branch (line 7) | def checkout_branch(branch)
function new_config (line 11) | def new_config(opts = {})
function new_context (line 25) | def new_context(config, argv)
function hook_for (line 29) | def hook_for(config, context)
function add_file (line 33) | def add_file(name, contents)
function remove_file (line 37) | def remove_file(name)
FILE: spec/overcommit/installer_spec.rb
function hook_files_installed? (line 9) | def hook_files_installed?(hooks_dir)
FILE: spec/overcommit/message_processor_spec.rb
function error (line 34) | def error(file = nil, line = nil)
function warning (line 38) | def warning(file = nil, line = nil)
FILE: spec/support/git_spec_helpers.rb
type GitSpecHelpers (line 6) | module GitSpecHelpers
function repo (line 14) | def repo(options = {})
function get_sha1 (line 37) | def get_sha1(ref)
function directory (line 46) | def directory(name = 'some-dir', &block)
function random_hash (line 60) | def random_hash
FILE: spec/support/matchers/hook.rb
class HookMatcher (line 4) | class HookMatcher
method initialize (line 5) | def initialize(status, args)
method matches? (line 11) | def matches?(check)
method messages_match? (line 22) | def messages_match?(messages)
method status_matches? (line 33) | def status_matches?(actual_status)
method message_matches? (line 37) | def message_matches?(actual_message)
method failure_message (line 47) | def failure_message(actual, error_message)
FILE: spec/support/normalize_indent.rb
type IndentNormalizer (line 5) | module IndentNormalizer
function normalize_indent (line 6) | def normalize_indent(code)
FILE: spec/support/output_helpers.rb
type OutputHelpers (line 4) | module OutputHelpers
function capture_stdout (line 7) | def capture_stdout
FILE: spec/support/shell_helpers.rb
type ShellHelpers (line 7) | module ShellHelpers
function shell (line 8) | def shell(command)
function symlink (line 12) | def symlink(source, dest)
function touch (line 16) | def touch(file)
function wait_until (line 25) | def wait_until(options = {})
function echo (line 42) | def echo(text, file, options = {})
Condensed preview — 458 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (966K chars).
[
{
"path": ".editorconfig",
"chars": 216,
"preview": "# Defines the coding style for different editors and IDEs.\n# http://editorconfig.org\n\nroot = true\n\n[*]\ncharset = utf-8\nt"
},
{
"path": ".git-hooks/pre_commit/master_hooks_match.rb",
"chars": 859,
"preview": "# frozen_string_literal: true\n\nrequire 'fileutils'\n\nmodule Overcommit::Hook::PreCommit\n # Ensures all master hooks have"
},
{
"path": ".github/workflows/lint.yml",
"chars": 674,
"preview": "name: Lint\non:\n push:\n branches: [main]\n pull_request:\n branches: [main]\n\njobs:\n overcommit:\n timeout-minute"
},
{
"path": ".github/workflows/tests.yml",
"chars": 1516,
"preview": "name: Tests\non:\n push:\n branches: [main]\n pull_request:\n branches: [main]\n\njobs:\n rspec:\n timeout-minutes: 1"
},
{
"path": ".gitignore",
"chars": 61,
"preview": "Gemfile.lock\ncoverage/\npkg/\n.bundle\n.idea\n.history/\n.vscode/\n"
},
{
"path": ".overcommit.yml",
"chars": 612,
"preview": "gemfile: Gemfile\n\nPreCommit:\n # Disabled since this causes spurious failures on AppVeyor builds\n BrokenSymlinks:\n e"
},
{
"path": ".rubocop.yml",
"chars": 2889,
"preview": "inherit_from: .rubocop_todo.yml\n\nAllCops:\n TargetRubyVersion: 2.6\n NewCops: disable\n SuggestExtensions: false\n\nLayout"
},
{
"path": ".rubocop_todo.yml",
"chars": 4626,
"preview": "# This configuration was generated by\n# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit`\n# on 2024"
},
{
"path": "CHANGELOG.md",
"chars": 43028,
"preview": "# Overcommit Changelog\n\n## 0.68.0\n\n* Add `Solargraph` pre-commit hook\n\n## 0.67.1\n\n* Fix `set` gem dependency error when "
},
{
"path": "CONTRIBUTING.md",
"chars": 3456,
"preview": "# Contributing to Overcommit\n\n## Bug Reports\n\n* Ensure that your issue [has not already been reported][1]. It may alread"
},
{
"path": "Gemfile",
"chars": 349,
"preview": "# frozen_string_literal: true\n\nsource 'https://rubygems.org'\n\ngemspec\n\n# Development dependencies are listed below\n\ngem "
},
{
"path": "MIT-LICENSE",
"chars": 1080,
"preview": "Copyright (c) 2013-2019 Shane da Silva, Aiden Scandella\n\nPermission is hereby granted, free of charge, to any person obt"
},
{
"path": "README.md",
"chars": 38346,
"preview": "[](https://badge.fury.io/rb/overcommit)\n[ agains"
},
{
"path": "lib/overcommit/hook/pre_commit/jsl.rb",
"chars": 788,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `jsl` against any modified JavaScript files.\n"
},
{
"path": "lib/overcommit/hook/pre_commit/json_syntax.rb",
"chars": 450,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks the syntax of any modified JSON files.\n cl"
},
{
"path": "lib/overcommit/hook/pre_commit/kt_lint.rb",
"chars": 494,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `ktlint` against modified Kotlin files.\n # @"
},
{
"path": "lib/overcommit/hook/pre_commit/license_finder.rb",
"chars": 425,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs LicenseFinder if any of your package manager "
},
{
"path": "lib/overcommit/hook/pre_commit/license_header.rb",
"chars": 1182,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks for license headers in source files\n class"
},
{
"path": "lib/overcommit/hook/pre_commit/line_endings.rb",
"chars": 1974,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks for line endings in files.\n #\n # WARNING:"
},
{
"path": "lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb",
"chars": 387,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks for local paths in files and issues a warni"
},
{
"path": "lib/overcommit/hook/pre_commit/mdl.rb",
"chars": 874,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `mdl` against any modified Markdown files\n #"
},
{
"path": "lib/overcommit/hook/pre_commit/merge_conflicts.rb",
"chars": 357,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks for unresolved merge conflicts\n class Merg"
},
{
"path": "lib/overcommit/hook/pre_commit/mix_format.rb",
"chars": 777,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `mix format --check-formatted` against any mo"
},
{
"path": "lib/overcommit/hook/pre_commit/nginx_test.rb",
"chars": 634,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `nginx -t` against any modified Nginx config "
},
{
"path": "lib/overcommit/hook/pre_commit/pep257.rb",
"chars": 596,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `pep257` against any modified Python files.\n "
},
{
"path": "lib/overcommit/hook/pre_commit/pep8.rb",
"chars": 647,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `pep8` against any modified Python files.\n #"
},
{
"path": "lib/overcommit/hook/pre_commit/php_cs.rb",
"chars": 1178,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `phpcs` against any modified PHP files.\n cla"
},
{
"path": "lib/overcommit/hook/pre_commit/php_cs_fixer.rb",
"chars": 1377,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `php-cs-fixer` against any modified PHP files"
},
{
"path": "lib/overcommit/hook/pre_commit/php_lint.rb",
"chars": 1369,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `php -l` against any modified PHP files.\n cl"
},
{
"path": "lib/overcommit/hook/pre_commit/php_stan.rb",
"chars": 749,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `phpstan` against any modified PHP files.\n #"
},
{
"path": "lib/overcommit/hook/pre_commit/pronto.rb",
"chars": 250,
"preview": "# frozen_string_literal: true\n\nrequire 'overcommit/hook/shared/pronto'\n\nmodule Overcommit::Hook::PreCommit\n # Runs `pro"
},
{
"path": "lib/overcommit/hook/pre_commit/puppet_lint.rb",
"chars": 677,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs 'puppet-lint' against any modified Puppet fil"
},
{
"path": "lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb",
"chars": 743,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n #\n # Run's the Puppet metadata linter. It has suppo"
},
{
"path": "lib/overcommit/hook/pre_commit/pycodestyle.rb",
"chars": 668,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `pycodestyle` against any modified Python fil"
},
{
"path": "lib/overcommit/hook/pre_commit/pydocstyle.rb",
"chars": 608,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `pydocstyle` against any modified Python file"
},
{
"path": "lib/overcommit/hook/pre_commit/pyflakes.rb",
"chars": 806,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `pyflakes` against any modified Python files."
},
{
"path": "lib/overcommit/hook/pre_commit/pylint.rb",
"chars": 927,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `pylint` against any modified Python files.\n "
},
{
"path": "lib/overcommit/hook/pre_commit/python_flake8.rb",
"chars": 947,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `flake8` against any modified Python files.\n "
},
{
"path": "lib/overcommit/hook/pre_commit/r_spec.rb",
"chars": 242,
"preview": "# frozen_string_literal: true\n\nrequire 'overcommit/hook/shared/r_spec'\n\nmodule Overcommit::Hook::PreCommit\n # Runs `rsp"
},
{
"path": "lib/overcommit/hook/pre_commit/rails_best_practices.rb",
"chars": 833,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit\n module Hook\n module PreCommit\n # Runs `rails_best_practices` "
},
{
"path": "lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb",
"chars": 2230,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Check to see whether the schema file is in line wi"
},
{
"path": "lib/overcommit/hook/pre_commit/rake_target.rb",
"chars": 269,
"preview": "# frozen_string_literal: true\n\nrequire 'overcommit/hook/shared/rake_target'\n\nmodule Overcommit::Hook::PreCommit\n # Runs"
},
{
"path": "lib/overcommit/hook/pre_commit/reek.rb",
"chars": 577,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `reek` against any modified Ruby files.\n #\n "
},
{
"path": "lib/overcommit/hook/pre_commit/rst_lint.rb",
"chars": 728,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `rst-lint` against any modified reStructuredT"
},
{
"path": "lib/overcommit/hook/pre_commit/rubo_cop.rb",
"chars": 910,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `rubocop` against any modified Ruby files.\n "
},
{
"path": "lib/overcommit/hook/pre_commit/ruby_lint.rb",
"chars": 590,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `ruby-lint` against any modified Ruby files.\n"
},
{
"path": "lib/overcommit/hook/pre_commit/ruby_syntax.rb",
"chars": 686,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `ruby -c` against all Ruby files.\n #\n class"
},
{
"path": "lib/overcommit/hook/pre_commit/scalariform.rb",
"chars": 599,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `scalariform` against any modified Scala file"
},
{
"path": "lib/overcommit/hook/pre_commit/scalastyle.rb",
"chars": 809,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `scalastyle` against any modified Scala files"
},
{
"path": "lib/overcommit/hook/pre_commit/scss_lint.rb",
"chars": 1470,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `scss-lint` against any modified SCSS files.\n"
},
{
"path": "lib/overcommit/hook/pre_commit/semi_standard.rb",
"chars": 658,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `semistandard` against any modified JavaScrip"
},
{
"path": "lib/overcommit/hook/pre_commit/shell_check.rb",
"chars": 595,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `shellcheck` against any modified shell scrip"
},
{
"path": "lib/overcommit/hook/pre_commit/slim_lint.rb",
"chars": 590,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `slim-lint` against any modified Slim templat"
},
{
"path": "lib/overcommit/hook/pre_commit/solargraph.rb",
"chars": 1439,
"preview": "# frozen_string_literal: true\n\nrequire 'overcommit'\nrequire 'overcommit/hook/pre_commit/base'\n\nmodule Overcommit\n modul"
},
{
"path": "lib/overcommit/hook/pre_commit/sorbet.rb",
"chars": 628,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs 'srb tc' against any modified files.\n #\n # "
},
{
"path": "lib/overcommit/hook/pre_commit/sqlint.rb",
"chars": 657,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs 'sqlint' against any modified SQL files.\n #\n"
},
{
"path": "lib/overcommit/hook/pre_commit/standard.rb",
"chars": 648,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `standard` against any modified JavaScript fi"
},
{
"path": "lib/overcommit/hook/pre_commit/stylelint.rb",
"chars": 648,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `stylelint` against any modified CSS file.\n "
},
{
"path": "lib/overcommit/hook/pre_commit/swift_lint.rb",
"chars": 527,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `swiftlint lint` against modified Swift files"
},
{
"path": "lib/overcommit/hook/pre_commit/terraform_format.rb",
"chars": 509,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs 'terraform fmt' against any modified *.tf fil"
},
{
"path": "lib/overcommit/hook/pre_commit/trailing_whitespace.rb",
"chars": 347,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks for trailing whitespace in files.\n class T"
},
{
"path": "lib/overcommit/hook/pre_commit/travis_lint.rb",
"chars": 383,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `travis-lint` against any modified Travis CI "
},
{
"path": "lib/overcommit/hook/pre_commit/ts_lint.rb",
"chars": 911,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `tslint` against modified TypeScript files.\n "
},
{
"path": "lib/overcommit/hook/pre_commit/vint.rb",
"chars": 561,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `vint` against any modified Vim script files."
},
{
"path": "lib/overcommit/hook/pre_commit/w3c_css.rb",
"chars": 1905,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `w3c_validators` against any modified CSS fil"
},
{
"path": "lib/overcommit/hook/pre_commit/w3c_html.rb",
"chars": 1879,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `w3c_validators` against any modified HTML fi"
},
{
"path": "lib/overcommit/hook/pre_commit/xml_lint.rb",
"chars": 617,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `xmllint` against any modified XML files.\n #"
},
{
"path": "lib/overcommit/hook/pre_commit/xml_syntax.rb",
"chars": 468,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks the syntax of any modified XML files.\n cla"
},
{
"path": "lib/overcommit/hook/pre_commit/yaml_lint.rb",
"chars": 971,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Runs `YAMLLint` against any modified YAML files.\n "
},
{
"path": "lib/overcommit/hook/pre_commit/yaml_syntax.rb",
"chars": 764,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Checks the syntax of any modified YAML files.\n cl"
},
{
"path": "lib/overcommit/hook/pre_commit/yard_coverage.rb",
"chars": 2949,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Class to check yard documentation coverage.\n #\n "
},
{
"path": "lib/overcommit/hook/pre_commit/yarn_check.rb",
"chars": 1398,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreCommit\n # Check if local yarn.lock matches package.json when"
},
{
"path": "lib/overcommit/hook/pre_push/base.rb",
"chars": 762,
"preview": "# frozen_string_literal: true\n\nrequire 'forwardable'\nrequire 'overcommit/utils/messages_utils'\n\nmodule Overcommit::Hook:"
},
{
"path": "lib/overcommit/hook/pre_push/brakeman.rb",
"chars": 313,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `brakeman` whenever Ruby/Rails files change.\n "
},
{
"path": "lib/overcommit/hook/pre_push/cargo_test.rb",
"chars": 275,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `cargo test` before push if Rust files changed\n"
},
{
"path": "lib/overcommit/hook/pre_push/flutter_test.rb",
"chars": 400,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs Flutter test suite (`flutter test`) before push"
},
{
"path": "lib/overcommit/hook/pre_push/go_test.rb",
"chars": 298,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `go test ./...` command on prepush\n class GoTe"
},
{
"path": "lib/overcommit/hook/pre_push/golangci_lint.rb",
"chars": 338,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs golangci-lint\n #\n # @see https://github.com/g"
},
{
"path": "lib/overcommit/hook/pre_push/minitest.rb",
"chars": 431,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `minitest` test suite before push\n #\n # @see "
},
{
"path": "lib/overcommit/hook/pre_push/mix_test.rb",
"chars": 354,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `mix test` test suite before push\n #\n # @see "
},
{
"path": "lib/overcommit/hook/pre_push/php_unit.rb",
"chars": 330,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `phpunit` test suite before push\n #\n # @see h"
},
{
"path": "lib/overcommit/hook/pre_push/pronto.rb",
"chars": 248,
"preview": "# frozen_string_literal: true\n\nrequire 'overcommit/hook/shared/pronto'\n\nmodule Overcommit::Hook::PrePush\n # Runs `pront"
},
{
"path": "lib/overcommit/hook/pre_push/protected_branches.rb",
"chars": 1789,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Prevents updates to specified branches.\n # Accepts "
},
{
"path": "lib/overcommit/hook/pre_push/pub_test.rb",
"chars": 366,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs Dart test suite (`pub run test`) before push\n "
},
{
"path": "lib/overcommit/hook/pre_push/pytest.rb",
"chars": 345,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `pytest` test suite before push\n #\n # @see ht"
},
{
"path": "lib/overcommit/hook/pre_push/python_nose.rb",
"chars": 349,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `nose` test suite before push\n #\n # @see http"
},
{
"path": "lib/overcommit/hook/pre_push/r_spec.rb",
"chars": 240,
"preview": "# frozen_string_literal: true\n\nrequire 'overcommit/hook/shared/r_spec'\n\nmodule Overcommit::Hook::PrePush\n # Runs `rspec"
},
{
"path": "lib/overcommit/hook/pre_push/rake_target.rb",
"chars": 267,
"preview": "# frozen_string_literal: true\n\nrequire 'overcommit/hook/shared/rake_target'\n\nmodule Overcommit::Hook::PrePush\n # Runs r"
},
{
"path": "lib/overcommit/hook/pre_push/test_unit.rb",
"chars": 352,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrePush\n # Runs `test-unit` test suite before push\n #\n # @see"
},
{
"path": "lib/overcommit/hook/pre_rebase/base.rb",
"chars": 364,
"preview": "# frozen_string_literal: true\n\nrequire 'forwardable'\n\nmodule Overcommit::Hook::PreRebase\n # Functionality common to all"
},
{
"path": "lib/overcommit/hook/pre_rebase/merged_commits.rb",
"chars": 858,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PreRebase\n # Prevents rebasing commits that have already been m"
},
{
"path": "lib/overcommit/hook/prepare_commit_msg/base.rb",
"chars": 760,
"preview": "# frozen_string_literal: true\n\nrequire 'forwardable'\n\nmodule Overcommit::Hook::PrepareCommitMsg\n # Functionality common"
},
{
"path": "lib/overcommit/hook/prepare_commit_msg/replace_branch.rb",
"chars": 2550,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::PrepareCommitMsg\n # Prepends the commit message with a message "
},
{
"path": "lib/overcommit/hook/shared/bower_install.rb",
"chars": 380,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::Shared\n # Shared code used by all BowerInstall hooks. Runs `bow"
},
{
"path": "lib/overcommit/hook/shared/bundle_install.rb",
"chars": 385,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::Shared\n # Shared code used by all BundleInstall hooks. Runs `bu"
},
{
"path": "lib/overcommit/hook/shared/composer_install.rb",
"chars": 397,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::Shared\n # Shared code used by all ComposerInstall hooks. Runs `"
},
{
"path": "lib/overcommit/hook/shared/index_tags.rb",
"chars": 363,
"preview": "# frozen_string_literal: true\n\nmodule Overcommit::Hook::Shared\n # Shared code used by all IndexTags hooks. It runs ctag"
}
]
// ... and 258 more files (download for full content)
About this extraction
This page contains the full source code of the sds/overcommit GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 458 files (877.0 KB), approximately 241.0k tokens, and a symbol index with 1071 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.