Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sds/overcommit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.28.0
Choose a base ref
...
head repository: sds/overcommit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Aug 26, 2015

  1. Add Pylint to list of pre-commit hooks

    We have a hook for this, but it was mysteriously absent from this list.
    lencioni committed Aug 26, 2015
    Copy the full SHA
    e26ae1c View commit details

Commits on Sep 5, 2015

  1. Add code of conduct

    lencioni committed Sep 5, 2015
    Copy the full SHA
    12093b1 View commit details
  2. Copy the full SHA
    eeb8bdc View commit details

Commits on Sep 8, 2015

  1. Allow nested arrays in include/exclude options

    This allows us to use YAML references to extend a default list of
    exclusions without repeating ourselves, while still being explicit about
    where the exclusions are coming from in the YAML file.
    sds committed Sep 8, 2015
    Copy the full SHA
    c7471ec View commit details
  2. Fix TOC heading for hook options

    sds committed Sep 8, 2015
    Copy the full SHA
    da7955d View commit details

Commits on Sep 15, 2015

  1. Copy the full SHA
    14d0a45 View commit details

Commits on Sep 17, 2015

  1. Copy the full SHA
    51d0348 View commit details

Commits on Sep 23, 2015

  1. Copy the full SHA
    9774d2b View commit details

Commits on Sep 30, 2015

  1. Copy the full SHA
    311f73f View commit details
  2. Mention OVERCOMMIT_DEBUG=1 in CONTRIBUTING.md

    In 0.27.0 we added support for the `OVERCOMMIT_DEBUG` environment
    variable which toggles the display of verbose output from executed
    commands, but didn't document it anywhere. This setting might help
    people debug their problems and submit more informative bug reports, so
    documenting it here seems to make sense.
    lencioni authored and sds committed Sep 30, 2015
    Copy the full SHA
    98c712c View commit details

Commits on Oct 1, 2015

  1. Copy the full SHA
    e3ad967 View commit details

Commits on Oct 2, 2015

  1. Copy the full SHA
    e2b527d View commit details

Commits on Oct 3, 2015

  1. Copy the full SHA
    03c1f49 View commit details
  2. Copy the full SHA
    d0b5993 View commit details

Commits on Oct 15, 2015

  1. Fix tests with git diff.renames option set

    If the ~/.gitconfig sets the `diff.renames` option to a true value 4 of
    the 5 tests run with `rspec -d renam` fail.  Fix this by adding `R` to
    the list of change types included in the `--diff-filter` option.  All
    tests continue to pass if this option is left at the default value.
    aschrab committed Oct 15, 2015
    Copy the full SHA
    f2ab408 View commit details

Commits on Oct 22, 2015

  1. Add GitConfig.comment_character method

    Retrieve the character which git will use to indicate comments in commit
    message templates.
    aschrab committed Oct 22, 2015
    Copy the full SHA
    6245b56 View commit details
  2. Honor core.commentchar configuration

    Modify commit message parsing to respect the comment character which git
    has been configured to use.
    aschrab committed Oct 22, 2015
    Copy the full SHA
    007bc87 View commit details

Commits on Oct 23, 2015

  1. Copy the full SHA
    d411541 View commit details

Commits on Oct 28, 2015

  1. Fix name of scss_lint gem

    This has confused some people since the name was changed to match
    Rubygems naming conventions. Ensure we document the underscored name.
    sds committed Oct 28, 2015
    Copy the full SHA
    7173482 View commit details
  2. Copy the full SHA
    59fb6ed View commit details

Commits on Nov 18, 2015

  1. Sign configuration in addition to hook plugins

    Unfortunately, the hook signing code did not work as advertised. Since
    we weren't signing the configuration file itself, an attacker could
    change the value of `verify_plugin_signatures` to `false` at the same
    time they added some malicious code, thereby bypassing the check
    altogether.
    
    Work around this by signing the configuration file itself. In order to
    force everyone's attention (and also to reflect the fact that this
    signing doesn't only apply to hooks) change the option name to
    `verify_signatures`. The default is `true`, so developers will have to
    update their configuration to the new `verify_signatures` option.
    Hopefully this will prompt organizations to read the change log and
    perform an audit of their repository hooks.
    
    This implementation is a little bit tangly, but I erred on the side of
    having it more global in scope so that any disabling of verification is
    intentional rather than because we forgot to enable it for a particular
    code path.
    sds committed Nov 18, 2015
    Copy the full SHA
    6271bfa View commit details
  2. Cut version 0.29.0

    sds committed Nov 18, 2015
    Copy the full SHA
    fddb5cf View commit details
  3. Sign hooks before executing with --run flag in Travis

    Our new signing logic requires us to sign on the first run. Since this
    is running in CI, we're OK signing without manually verifying.
    sds committed Nov 18, 2015
    Copy the full SHA
    bcb41f9 View commit details
  4. Enforce hook name format

    We recently had an issue filed where the user was confused about whether
    underscores were allowed in a hook's name. Rather than document this,
    simply raise an error, since we need to enforce hook names as CamelCase
    in order to have a one-way mapping between CamelCase and snake_case and
    vice versa.
    sds committed Nov 18, 2015
    Copy the full SHA
    4e17d61 View commit details
  5. Fix hook signing when specifying name

    Unfortunately the fix in 6271bfa broke hook signing (specifically when
    you specified a name). Fix it.
    sds committed Nov 18, 2015
    Copy the full SHA
    fbab8c0 View commit details
  6. Fix BundleCheck hook to work with --run flag with local changes

    As reported in #293, this hook would fail if you ran Overcommit via the
    `--run` flag with local changes that weren't staged, resulting in `git
    diff -- Gemfile.lock` always exiting unsuccessfully.
    
    Work around this by reading the contents of the file before and after,
    and raise an error if its content changes.
    sds committed Nov 18, 2015
    Copy the full SHA
    ed0fc9c View commit details
  7. Cut version 0.29.1

    sds committed Nov 18, 2015
    Copy the full SHA
    f248a83 View commit details
  8. Copy the full SHA
    d555521 View commit details

Commits on Nov 19, 2015

  1. Copy the full SHA
    b3f66a3 View commit details

Commits on Nov 21, 2015

  1. Fix --run flag to work with ad hoc hook scripts

    When attempting to use an existing hook script (a.k.a. ad hoc hooks)
    with the `--run` flag, the hook would block reading on STDIN (since
    there was nothing to read).
    
    Since pre-commit hooks don't read from STDIN anyway, pass in the null
    input stream to ensure we don't block.
    sds committed Nov 21, 2015
    Copy the full SHA
    9778b29 View commit details
  2. Specify branch in build status badge

    Apparently this shows the status of all branches by default. Limit it to
    the master build so pull requests don't mess things up.
    sds committed Nov 21, 2015
    Copy the full SHA
    b102f3e View commit details

Commits on Nov 22, 2015

  1. Increase timeout for --run flag integration test

    The test fails on JRuby because it takes longer than a second to start
    up Overcommit on the JVM. Increase the timeout to 10 seconds to be safe.
    sds committed Nov 22, 2015
    Copy the full SHA
    4db026a View commit details
  2. Add Dogma pre-commit hook to check Elixir source files

    Dogma is a code style linter for Elixir language.
    Dogma's source code is available at https://github.com/lpil/dogma
    This pre-commit hook executes dogma and reports errors.
    dtengeri committed Nov 22, 2015
    Copy the full SHA
    1d392fa View commit details

Commits on Nov 24, 2015

  1. Copy the full SHA
    6b589aa View commit details

Commits on Nov 25, 2015

  1. Copy the full SHA
    bd6d096 View commit details
  2. Copy the full SHA
    d824f8a View commit details
  3. Copy the full SHA
    daff6eb View commit details

Commits on Dec 15, 2015

  1. Add minitest pre-push hook

    Dan Rabinowitz authored and sds committed Dec 15, 2015
    Copy the full SHA
    ed26f3c View commit details
  2. Copy the full SHA
    ee28194 View commit details
  3. Correctly fail hook when rubocop is not installed

    When rubocop is not installed, or when the installed version does not
    match the version expected by Bundler, the 'pre_commit/rubo_cop' hook
    passes 100% of the time because 'result.stdout' is empty.
    
    This commit updates the hook to fail if anything is present in stderr
    after the hook runs.
    fixlr authored and sds committed Dec 15, 2015
    Copy the full SHA
    efa40dc View commit details
  4. Copy the full SHA
    c06d2af View commit details

Commits on Dec 18, 2015

  1. Copy the full SHA
    ef36c65 View commit details

Commits on Dec 23, 2015

  1. Copy the full SHA
    c5f145c View commit details
  2. Add example to commit-msg TextWidth hook

    Add example verifying that lines in the commit message are allowed
    to be the length of the limit plus a trailing newline character.
    jdewyea authored and sds committed Dec 23, 2015
    Copy the full SHA
    c7223dc View commit details
  3. Don't count newline against commit subject length

    When comparing the commit subject against the specified limit, trailing
    newlines should not be considered part of a subject's character count.
    jdewyea authored and sds committed Dec 23, 2015
    Copy the full SHA
    44fc645 View commit details
  4. Copy the full SHA
    bd7aa39 View commit details
  5. Fix TextWidth spec for Ruby 1.9.3

    The test was failing since `#lines` returns an Enumerator in 1.9.3.
    Ensure it is an array.
    sds committed Dec 23, 2015
    Copy the full SHA
    ef693fb View commit details
  6. Fix quoting in external command for Windows

    jawshooah authored and sds committed Dec 23, 2015
    Copy the full SHA
    0d9f013 View commit details
  7. Copy the full SHA
    eda2813 View commit details
  8. Copy the full SHA
    08cf3fc View commit details
Showing 469 changed files with 15,016 additions and 1,381 deletions.
28 changes: 28 additions & 0 deletions .git-hooks/pre_commit/master_hooks_match.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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
61 changes: 61 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,6 @@ Gemfile.lock
coverage/
pkg/
.bundle
.idea
.history/
.vscode/
16 changes: 10 additions & 6 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
gemfile: Gemfile

PreCommit:
# Disabled since this causes spurious failures on AppVeyor builds
BrokenSymlinks:
enabled: false

BundleCheck:
enabled: true

@@ -12,20 +18,18 @@ PreCommit:
HardTabs:
enabled: true

MasterHooksMatch:
enabled: true
quiet: true

RuboCop:
enabled: true
command: ['bundle', 'exec', 'rubocop']
include:
- '**/*.gemspec'
- '**/*.rb'
- '**/Gemfile'
- template-dir/hooks/overcommit-hook

TravisLint:
enabled: true
command: ['bundle', 'exec', 'travis']
flags: ['lint', '--skip-version-check']

TrailingWhitespace:
enabled: true

10 changes: 0 additions & 10 deletions .projections.json

This file was deleted.

106 changes: 75 additions & 31 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,90 @@
Lint/AmbiguousRegexpLiteral:
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.6
NewCops: disable
SuggestExtensions: false

Layout/ClosingParenthesisIndentation:
Enabled: false

Lint/AssignmentInCondition:
Layout/DotPosition:
EnforcedStyle: trailing

# Fails on AppVeyor builds
Layout/EndOfLine:
Enabled: false

Lint/Void:
Layout/FirstParameterIndentation:
Enabled: false

Metrics/AbcSize:
Layout/FirstArrayElementIndentation:
Enabled: false

Metrics/LineLength:
Layout/HeredocIndentation:
Enabled: false

Layout/LineLength:
Max: 100

Metrics/MethodLength:
Max: 20
Layout/MultilineMethodCallIndentation:
Enabled: false

Metrics/ModuleLength:
Layout/MultilineOperationIndentation:
Enabled: false

# Enforcing this results in a lot of unnecessary indentation.
Style/ClassAndModuleChildren:
Layout/SpaceBeforeFirstArg:
Exclude:
- '*.gemspec'

Lint/AmbiguousBlockAssociation:
Enabled: false

Style/ClosingParenthesisIndentation:
Lint/AmbiguousRegexpLiteral:
Enabled: false

Style/Documentation:
Exclude:
- 'spec/overcommit/**/*'
Lint/AssignmentInCondition:
Enabled: false

Style/DotPosition:
EnforcedStyle: trailing
Lint/Void:
Enabled: false

Metrics/AbcSize:
Enabled: false

Style/Encoding:
EnforcedStyle: when_needed
Metrics/BlockLength:
Enabled: false

Style/FileName:
Metrics/MethodLength:
Max: 20

Metrics/ModuleLength:
Enabled: false

Naming/FileName:
Exclude:
- 'template-dir/hooks/*'
- 'Gemfile'
- 'Rakefile'
- '*.gemspec'

Style/FirstParameterIndentation:
# Renaming `has_something?` to `something?` obfuscates whether it is a "is-a" or
# a "has-a" relationship.
Naming/PredicateName:
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

@@ -63,10 +102,11 @@ Style/IfUnlessModifier:
Style/Lambda:
Enabled: false

Style/MultilineOperationIndentation:
Style/Next:
Enabled: false

Style/Next:
# Calling .zero? instead of comparing `== 0` seems unnecessarily verbose
Style/NumericPredicate:
Enabled: false

Style/ParallelAssignment:
@@ -85,10 +125,9 @@ Style/PercentLiteralDelimiters:
'%W': '[]'
'%x': '{}'

# Renaming `has_something?` to `something?` obfuscates whether it is a "is-a" or
# a "has-a" relationship.
Style/PredicateName:
Enabled: false
Style/RescueModifier:
Exclude:
- 'bin/overcommit'

Style/SignalException:
Enabled: false
@@ -98,12 +137,17 @@ Style/SignalException:
Style/SingleLineBlockParams:
Enabled: false

Style/SingleSpaceBeforeFirstArg:
Exclude:
- '*.gemspec'

Style/SpecialGlobalVars:
Enabled: false

Style/TrailingComma:
Style/SymbolArray:
Enabled: false

Style/TrailingCommaInArguments:
Enabled: false

Style/TrailingCommaInArrayLiteral:
Enabled: false

Style/TrailingCommaInHashLiteral:
Enabled: false
Loading