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: fynsta/overcommit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
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
Checking mergeability… Don’t worry, you can still create the pull request.
  • 16 commits
  • 27 files changed
  • 9 contributors

Commits on Jun 24, 2024

  1. Configuration menu
    Copy the full SHA
    26e78aa View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2024

  1. Cut version 0.64.0 (sds#852)

    sds authored Jul 22, 2024
    Configuration menu
    Copy the full SHA
    939d9e6 View commit details
    Browse the repository at this point in the history
  2. Update changelog

    sds committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    5ff9d5e View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2024

  1. Fix spec compatibility with recent git versions (sds#854)

    The original array was defining the shellwords like this:
    `["git", "commit", "-m", "\"Resolve", "conflicts\"", "-i", "some-file"]`
    
    This combined with the most recent git version failed with:
    ```
    error: pathspec 'conflicts"' did not match any file(s) known to git
    ```
    
    This PR just simplifies the commit message to work with the %w array
    literal.
    anakinj authored Aug 11, 2024
    Configuration menu
    Copy the full SHA
    5a3d68e View commit details
    Browse the repository at this point in the history
  2. Expand tildes(~) for hooksPath (sds#853)

    While installing overcommit git hooks i noticed that tildes are not
    expanded to home folders for the `hooksPath` config, the result was a
    tilde folder in the current directory.
    
    This PR addresses that by switching `File.absolute_path` to
    `File.expand_path`. The [underlaying
    implementation](https://github.com/ruby/ruby/blob/v3_3_4/file.c#L3753)
    in Ruby is exactly the same just with this difference in how `~` is
    handled.
    
    ---------
    
    Co-authored-by: Shane da Silva <shane@dasilva.io>
    anakinj and sds authored Aug 11, 2024
    Configuration menu
    Copy the full SHA
    31c83ce View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2024

  1. Bump rexml to >= 3.3.9 to resolve GHSA-2rxp-v6pw-ch6m (sds#857)

    A `ReDoS vulnerability in REXML` has been identified in versions <3.3.9
    
    Details in GitHub:
     - GHSA-2rxp-v6pw-ch6m
    
    This is a small bump to the latest patched version. This should resolve
    anybody getting the following `bundle audit` error when using
    overcommit:
    
    ```
    Name: rexml
    Version: 3.3.8
    CVE: CVE-2024-49761
    GHSA: GHSA-2rxp-v6pw-ch6m
    Criticality: High
    URL: GHSA-2rxp-v6pw-ch6m
    Title: REXML ReDoS vulnerability
    Solution: update to '>= 3.3.9'
    ```
    RemoteCTO authored Oct 31, 2024
    Configuration menu
    Copy the full SHA
    9825868 View commit details
    Browse the repository at this point in the history
  2. Update changelog

    sds committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    eff94a7 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2025

  1. Load bundled gems on expected version (sds#859)

    Fixes sds#789
    
    `psych` is no longer a default gem, but current and old ruby still ships
    with it. When we `require 'yaml'`, we activate that gem in whatever
    version that is bundled with ruby. Later on, we load bundler, and we
    `Bundler.setup`, which will then activate whatever version specified in
    the lock file. More often than not, they might not match.
    
    The approach in this PR is to strip the `yaml` dependency completely
    from the hook scripts, while retaining the ability to configure the
    Gemfile using it.
    xjunior authored Jan 27, 2025
    Configuration menu
    Copy the full SHA
    7d3e8fa View commit details
    Browse the repository at this point in the history
  2. Cut version 0.65.0

    sds committed Jan 27, 2025
    Configuration menu
    Copy the full SHA
    9ce5492 View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2025

  1. Add -diff cli option for running precommit hooks against diffs (sds…

    …#860)
    
    For example, running `overcommit --diff main` from a feature branch will
    run pre-commit hooks against the diff between the two branches.
    
    I was able to very easily leverage existing code for the bulk of the
    feature - this is mainly just adding the cli option, a hook context to
    do the execution and some tests based on the existing `--run-all` test.
    
    ---
    
    For background, my team is responsible for a couple of really old,
    really large rails apps. Getting them completely in compliance with our
    various linters is a huge task that isn't getting done anytime soon
    (things are funky to the point that we've even observed breakages with
    "safe" auto-correct functions).
    
    I introduced/started heavily encouraging overcommit so that we at least
    don't add _new_ linting offenses and things will naturally improve over
    time. It's been great, but offenses still slip through though here and
    there, especially with juniors who might be getting away with not having
    a local install (and/or abusing `OVERCOMMIT_DISABLE=1`).
    
    An option like this would allow me to leverage the very useful "only
    apply to changed lines" logic within a ci environment and help enforce
    my desired "no new linting offenses" policy.
    benmelz authored Jan 30, 2025
    Configuration menu
    Copy the full SHA
    b4d4ce0 View commit details
    Browse the repository at this point in the history
  2. Cut version 0.66.0 (sds#861)

    sds authored Jan 30, 2025
    Configuration menu
    Copy the full SHA
    43e17fb View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2025

  1. Restore ability to specify "gemfile: false" in config (sds#863)

    Setting `gemfile: false` in `.overcommit.yml` is supposed to disable
    Bundler. However, a recently-introduced bug causes `false` to be
    interpreted as the name of the gemfile. Bundler looks for a gemfile
    named "false", which fails, leading overcommit's hooks to crash.
    
    This PR fixes the bug by adjusting the regex used to parse the
    `gemfile:` line in the config. Now, `false` is no longer interpreted as
    a gemfile name.
    
    I added an integration test to verify the fix.
    
    Fixes sds#862
    mattbrictson authored Feb 16, 2025
    Configuration menu
    Copy the full SHA
    3db733e View commit details
    Browse the repository at this point in the history
  2. Cut version 0.67.0 (sds#864)

    sds authored Feb 16, 2025
    Configuration menu
    Copy the full SHA
    88bee08 View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2025

  1. Add note about unsupported YAML features in gemfile: line in defaul…

    …t.yml (sds#865)
    
    Related to sds#863 and [this
    comment](sds#862 (comment)):
    
    > Having a similar problem since we had this line in our
    `.overcommit.yml`:
    > 
    > ```yaml
    > gemfile: Gemfile # enforce bundled version of overcommit
    > ```
    >
    > And now overcommit doesn't strip out the inline comment, resulting in
    this weird looking error message:
    >
    > ```
    > Problem loading 'Gemfile # enforce bundled version of overcommit':
    /path/to/project/Gemfile # enforce bundled version of overcommit not
    found
    > ```
    
    I think adding support for comments in the `gemfile:` regexp is likely
    overkill and may still not be enough when the next person tries to use
    yet another YAML feature in that line, but perhaps this little warning
    would help someone else avoid tripping.
    pilaf authored Feb 19, 2025
    Configuration menu
    Copy the full SHA
    9f142c2 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2025

  1. adds 'set' requirements to diff hook context. (sds#866)

    Running `overcommit` with the `--diff` flag results in errors for
    version `0.67.0`.
    
    ```sh
    bundle exec overcommit --diff HEAD
    ```
    
    It results on the following:
    
    ```ruby
    Running pre-commit hooks
    Check for case-insensitivity conflicts................[CaseConflicts] FAILED
    Hook raised unexpected error
    uninitialized constant Overcommit::Hook::PreCommit::CaseConflicts::Set
    
          repo_files = Set.new(applicable_files)
                       ^^^
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook/pre_commit/case_conflicts.rb:8:in `run'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook/base.rb:47:in `block in run_and_transform'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/utils.rb:260:in `with_environment'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook/base.rb:47:in `run_and_transform'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:162:in `run_hook'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:98:in `block in consume'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:94:in `loop'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:94:in `consume'
    Analyze with RuboCop........................................[RuboCop] FAILED
    Hook raised unexpected error
    uninitialized constant Overcommit::GitRepo::Set
    
          lines = Set.new
                  ^^^
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/git_repo.rb:69:in `extract_modified_lines'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_context/diff.rb:17:in `modified_lines_in_file'
    /nix/store/0sj7d3r1kf95f27028j93j0sx3v6p1kw-ruby-3.1.6/lib/ruby/3.1.0/forwardable.rb:238:in `modified_lines_in_file'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/message_processor.rb:145:in `message_on_modified_line?'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/message_processor.rb:138:in `block in remove_ignored_messages'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/message_processor.rb:138:in `select'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/message_processor.rb:138:in `remove_ignored_messages'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/message_processor.rb:45:in `handle_modified_lines'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/message_processor.rb:39:in `hook_result'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook/base.rb:263:in `process_hook_return_value'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook/base.rb:48:in `run_and_transform'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:162:in `run_hook'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:98:in `block in consume'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:94:in `loop'
    .bundle/ruby/3.1.0/gems/overcommit-0.67.0/lib/overcommit/hook_runner.rb:94:in `consume'
    
    ✗ One or more pre-commit hooks failed
    ```
    
    The problems are fixed once `set` is required in the context that the
    sub command is run.
    
    `run_all.rb` also requires `set` where the module is
    [defined](https://github.com/sds/overcommit/blob/main/lib/overcommit/hook_context/run_all.rb#L3).
    rscnt authored Mar 3, 2025
    Configuration menu
    Copy the full SHA
    11ef06b View commit details
    Browse the repository at this point in the history
  2. Cut version 0.67.1

    sds committed Mar 3, 2025
    Configuration menu
    Copy the full SHA
    46c3033 View commit details
    Browse the repository at this point in the history
Loading