Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 14 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,14 @@ jobs:
with:
persist-credentials: false

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
ruby-version: '3.4'
rubygems: latest
bundler: 2
bundler-cache: false
bundler-cache: true

- name: Run standardrb
run: |
bundle install --jobs 4 --retry 3
bundle exec standardrb
env:
MAINTENANCE: true
- run: bundle exec standardrb

coverage:
name: Generate Coverage Report
Expand All @@ -76,18 +71,14 @@ jobs:
with:
persist-credentials: false

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
ruby-version: '3.4'
rubygems: latest
bundler: 2
bundler-cache: false
bundler-cache: true

- run: |
bundle install --jobs 4 --retry 3
bundle exec ruby -S rake coverage --trace
env:
COVERAGE: true
- run: bundle exec ruby -S rake coverage --trace

- uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b #v2.3.6

Expand All @@ -104,12 +95,10 @@ jobs:
- ubuntu-22.04
- ubuntu-24.04
ruby:
- '2.6'
- '2.7'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- '4.0'
- truffleruby

runs-on: ${{ matrix.os }}
Expand All @@ -131,7 +120,7 @@ jobs:
with:
persist-credentials: false

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
ruby-version: ${{ matrix.ruby }}
rubygems: latest
Expand All @@ -154,12 +143,10 @@ jobs:
- macos-15
- macos-26
ruby:
- '2.6'
- '2.7'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- '4.0'

runs-on: ${{ matrix.os }}

Expand All @@ -180,7 +167,7 @@ jobs:
with:
persist-credentials: false

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
ruby-version: ${{ matrix.ruby }}
rubygems: latest
Expand All @@ -202,13 +189,10 @@ jobs:
- windows-2022
- windows-2025
ruby:
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- '4.0'
- mingw
- mswin
- ucrt
Expand All @@ -232,7 +216,7 @@ jobs:
with:
persist-credentials: false

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
ruby-version: ${{ matrix.ruby }}
rubygems: latest
Expand Down Expand Up @@ -278,7 +262,7 @@ jobs:
with:
persist-credentials: false

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
ruby-version: ${{ matrix.ruby }}
rubygems: latest
Expand Down Expand Up @@ -324,7 +308,7 @@ jobs:
with:
persist-credentials: false

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
ruby-version: ${{ matrix.ruby }}
rubygems: latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dco-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
api.github.com:443
github.com:443

- uses: KineticCafe/actions-dco@cd9508e5ae82413fbd74b20af21551db0ea3eb78 # v2.0.0
- uses: KineticCafe/actions-dco@76b7fc30ff5988e68d01ea07deeaf7e71256598f # v2.1.0
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
'print "version=", Gem::Specification.load(ARGV[0]).rubygems_version, "\n"' \
diff-lcs.gemspec >>"${GITHUB_OUTPUT}"

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
bundler-cache: false
ruby-version: ruby
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
'print "version=", Gem::Specification.load(ARGV[0]).rubygems_version, "\n"' \
diff-lcs.gemspec >>"${GITHUB_OUTPUT}"

- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
with:
bundler-cache: false
ruby-version: ruby
Expand Down
4 changes: 0 additions & 4 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
[tools]
ruby = "3.4"

[env]
MAINTENANCE = "true"
COVERAGE = "true"
6 changes: 1 addition & 5 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
---
parallel: true
ruby_version: 2.0
ruby_version: 3.2

ignore:
- '*.gemspec'
- research/**/*
- pkg/**/*
- Gemfile:
- Style/HashSyntax
- Rakefile:
- Layout/HeredocIndentation

plugins:
- rubocop-thread_safety
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Changelog

## 2.0.0.beta.1 / 2025-12-31

This release has significant **breaking changes**.

- diff-lcs 2 supports Ruby 3.2 or higher. This allowed:

- readability improvements (endless methods, pattern matching);

- support for immutable Data classes (`Diff::LCS::Block`, `Diff::LCS::Change`,
and `Diff::LCS::ContextChange`);

- removal of compatibility shims;

- reduction in conditional tests in loops, especially for String character
extraction (compare `string ? seq[i, 1] : seq[i]` to `seq[i]`); and

- optimizations to string and relying on standard encoding support present
since Ruby 2.1.

The primary API (methods and class methods on `Diff::LCS`) has not changed,
with one exception noted below. Internal APIs (including `Diff::LCS::Block`,
`Diff::LCS::Change`, `Diff::LCS::ContextChange`, and `Diff::LCS::Hunk`) have
changed for compatibility.

- The `htmldiff` binary and supporting code have been removed without
replacement.

- `ldiff` no longer supports `ed`-script output (`ed` and `reverse_ed` formats).
As Baptiste Courtois says in [#108][pull-108], the "implementation was broken
for a while and no-one reported it."

- The method `Diff::LCS.LCS` has been removed as an alias for `Diff::LCS.lcs`.
Most callers are using `Diff::LCS.lcs` and modern Ruby did-you-mean support
should assist with this update.

## 1.6.2 / 2025-05-12

- Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
Expand Down Expand Up @@ -504,6 +539,7 @@
[pull-103]: https://github.com/halostatue/diff-lcs/pull/103
[pull-104]: https://github.com/halostatue/diff-lcs/pull/104
[pull-105]: https://github.com/halostatue/diff-lcs/pull/105
[pull-108]: https://github.com/halostatue/diff-lcs/pull/108
[pull-129]: https://github.com/halostatue/diff-lcs/pull/129
[pull-147]: https://github.com/halostatue/diff-lcs/pull/147
[pull-148]: https://github.com/halostatue/diff-lcs/pull/148
Expand Down
133 changes: 85 additions & 48 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,65 @@
# Contributing

Contribution to diff-lcs is encouraged: bug reports, feature requests, or code
contributions. There are a few DOs and DON'Ts that should be followed.
contributions. New features should be proposed and discussed in an
[issue][issues].

## DO
Before contributing patches, please read the [Licence](./LICENCE.md).

- Keep the coding style that already exists for any updated Ruby code (support
or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
diff-lcs is governed under the [Contributor Covenant Code of Conduct][cccoc].

- Use thoughtfully-named topic branches for contributions. Rebase your commits
into logical chunks as necessary.
## Code Guidelines

- Use [quality commit messages][qcm].
I have several guidelines to contributing code through pull requests:

- Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
`CHANGELOG.md` as a separate commit from your main change. (Follow the style
in the `CHANGELOG.md` and provide a link to your PR.)
- All code changes require tests. In most cases, this will be added or updated
unit tests. I use [RSpec][rspec].

- Add or update tests as appropriate for your change. The test suite is written
in [RSpec][rspec].
- I use code formatters, static analysis tools, and linting to ensure consistent
styles and formatting. There should be no warning output from test run
processes. I use [Standard Ruby][standardrb].

- Add or update documentation as appropriate for your change. The documentation
is RDoc; diff-lcs does not use extensions that may be present in alternative
documentation generators.
- Proposed changes should be on a thoughtfully-named topic branch and organized
into logical commit chunks as appropriate.

## DO NOT
- Use [Conventional Commits][conventional] with my
[conventions](#commit-conventions).

- Modify `VERSION` in `lib/diff/lcs/version.rb`. When your patch is accepted and
a release is made, the version will be updated at that point.
- Versions must not be updated in pull requests unless otherwise directed. This
means that you must not:

- Modify `diff-lcs.gemspec`; it is a generated file. (You _may_ use
`rake gemspec` to regenerate it if your change involves metadata related to
gem itself).
- Modify `VERSION` in `lib/diff/lcs/version.rb`. When your patch is accepted
and a release is made, the version will be updated at that point.

- Modify the `Gemfile`.
- Modify `diff-lcs.gemspec`; it is a generated file. (You _may_ use
`rake gemspec` to regenerate it if your change involves metadata related to
gem itself).

## LLM-Generated Contribution Policy
- Modify the `Gemfile`.

diff-lcs is a library with complex interactions and subtle decisions (some of
them possibly even wrong). It is extremely important that any issues or pull
requests be well understood by the submitter and that, especially for pull
requests, the developer can attest to the [Developer Certificate of Origin][dco]
for each pull request (see [LICENCE](LICENCE.md)).
- Documentation should be added or updated as appropriate for new or updated
functionality. The documentation is RDoc; diff-lcs does not use extensions
that may be present in alternative documentation generators.

- All GitHub Actions checks marked as required must pass before a pull request
may be accepted and merged.

- Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
`CHANGELOG.md` as a separate commit from your main change. (Follow the style
in the `CHANGELOG.md` and provide a link to your PR.)

If LLM assistance is used in writing pull requests, this must be documented in
the commit message and pull request. If there is evidence of LLM assistance
without such declaration, the pull request **will be declined**.
- Include your DCO sign-off in each commit message (see [LICENCE](LICENCE.md)).

Any contribution (bug, feature request, or pull request) that uses unreviewed
LLM output will be rejected.
## AI Contribution Policy

diff-lcs is a library with complex interactions and subtle decisions (some of
them possibly even wrong). It is extremely important that contributions of any
sort be well understood by the submitter and that the developer can attest to
the [Developer Certificate of Origin][dco] for each pull request (see
[LICENCE](LICENCE.md)).

Any contribution (bug, feature request, or pull request) that uses undeclared AI
output will be rejected.

## Test Dependencies

Expand All @@ -58,28 +69,54 @@ tests in the same way that `rake spec` does.

To assist with the installation of the development dependencies for diff-lcs, I
have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file.
`minitar.gemspec` file. This will permit you to use `bundle install` to install
the dependencies.
This will permit you to use `bundle install` to install the dependencies.

You can run tests with code coverage analysis by running `rake spec:coverage`.

## Workflow
## Commit Conventions

diff-lcs has adopted a variation of the Conventional Commits format for commit
messages. The following types are permitted:

| Type | Purpose |
| ------- | ----------------------------------------------------- |
| `feat` | A new feature |
| `fix` | A bug fix |
| `chore` | A code change that is neither a bug fix nor a feature |
| `docs` | Documentation updates |
| `deps` | Dependency updates, including GitHub Actions. |

I encourage the use of [Tim Pope's][tpope-qcm] or [Chris Beam's][cbeams]
guidelines on the writing of commit messages

I require the use of [git][trailers1] [trailers][trailers2] for specific
additional metadata and strongly encourage it for others. The conditionally
required metadata trailers are:

- `Breaking-Change`: if the change is a breaking change. **Do not** use the
shorthand form (`feat!(scope)`) or `BREAKING CHANGE`.

- `Signed-off-by`: this is required for all developers except me, as outlined in
the [Licence](./LICENCE.md#developer-certificate-of-origin).

Here's the most direct way to get your work merged into the project:
- `Fixes` or `Resolves`: If a change fixes one or more open [issues][issues],
that issue must be included in the `Fixes` or `Resolves` trailer. Multiple
issues should be listed comma separated in the same trailer:
`Fixes: #1, #5, #7`, but _may_ appear in separate trailers. While both `Fixes`
and `Resolves` are synonyms, only _one_ should be used in a given commit or
pull request.

- Fork the project.
- Clone your fork (`git clone git://github.com/<username>/diff-lcs.git`).
- Create a topic branch to contain your change
(`git checkout -b my_awesome_feature`).
- Hack away, add tests. Not necessarily in that order.
- Make sure everything still passes by running `rake`.
- If necessary, rebase your commits into logical chunks, without errors.
- Push the branch up (`git push origin my_awesome_feature`).
- Create a pull request against halostatue/diff-lcs and describe what your
change does and the why you think it should be merged.
- `Related to`: If a change does not fix an issue, those issue references should
be included in this trailer.

[cbeams]: https://cbea.ms/git-commit/
[cccoc]: ./CODE_OF_CONDUCT.md
[conventional]: https://www.conventionalcommits.org/en/v1.0.0/
[dco]: licences/dco.txt
[hoe]: https://github.com/seattlerb/hoe
[qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[issues]: https://github.com/halostatue/diff-lcs/issues
[rspec]: http://rspec.info/documentation/
[standardrb]: https://github.com/standardrb/standard
[tpope-qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[trailers1]: https://git-scm.com/docs/git-interpret-trailers
[trailers2]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---trailerlttokengtltvaluegt
Loading
Loading