diff-lcs 1.6.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +67 -4
  3. data/CODE_OF_CONDUCT.md +152 -114
  4. data/CONTRIBUTING.md +91 -35
  5. data/CONTRIBUTORS.md +19 -9
  6. data/LICENCE.md +39 -11
  7. data/Manifest.txt +91 -83
  8. data/README.md +30 -17
  9. data/Rakefile +99 -73
  10. data/SECURITY.md +22 -27
  11. data/integration/compare/array_diff_spec.rb +10 -0
  12. data/integration/compare/hash_diff_spec.rb +25 -0
  13. data/integration/compare/string_diff_spec.rb +10 -0
  14. data/integration/rspec_differ_spec.rb +26 -0
  15. data/integration/rspec_expectations_spec.rb +32 -0
  16. data/integration/runner +20 -0
  17. data/lib/diff/lcs/block.rb +29 -24
  18. data/lib/diff/lcs/callbacks.rb +240 -242
  19. data/lib/diff/lcs/change.rb +102 -104
  20. data/lib/diff/lcs/hunk.rb +92 -155
  21. data/lib/diff/lcs/internals.rb +92 -96
  22. data/lib/diff/lcs/ldiff.rb +30 -38
  23. data/lib/diff/lcs/version.rb +1 -1
  24. data/lib/diff/lcs.rb +439 -466
  25. data/licenses/dco.txt +34 -0
  26. data/spec/hunk_spec.rb +32 -45
  27. data/spec/lcs_spec.rb +6 -6
  28. data/spec/ldiff_spec.rb +8 -8
  29. data/spec/spec_helper.rb +17 -27
  30. data/test/fixtures/ldiff/output.diff-c +7 -0
  31. data/test/fixtures/ldiff/output.diff-u +5 -0
  32. data/test/fixtures/ldiff/output.diff.bin2 +1 -0
  33. data/test/fixtures/ldiff/output.diff.bin2-c +1 -0
  34. data/test/fixtures/ldiff/output.diff.bin2-e +1 -0
  35. data/test/fixtures/ldiff/output.diff.bin2-f +1 -0
  36. data/test/fixtures/ldiff/output.diff.bin2-u +1 -0
  37. data/{spec → test}/fixtures/ldiff/output.diff.chef-c +2 -2
  38. data/test/fixtures/ldiff/output.diff.chef-u +9 -0
  39. data/{spec → test}/fixtures/ldiff/output.diff.chef2-c +2 -2
  40. data/{spec → test}/fixtures/ldiff/output.diff.chef2-u +2 -2
  41. data/test/fixtures/ldiff/output.diff.empty.vs.four_lines-c +9 -0
  42. data/test/fixtures/ldiff/output.diff.empty.vs.four_lines-u +7 -0
  43. data/test/fixtures/ldiff/output.diff.four_lines.vs.empty-c +9 -0
  44. data/test/fixtures/ldiff/output.diff.four_lines.vs.empty-u +7 -0
  45. data/test/fixtures/ldiff/output.diff.issue95_trailing_context-c +9 -0
  46. data/test/fixtures/ldiff/output.diff.issue95_trailing_context-u +6 -0
  47. data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-c +2 -2
  48. data/test/fixtures/ldiff/output.diff.missing_new_line1-u +9 -0
  49. data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-c +2 -2
  50. data/test/fixtures/ldiff/output.diff.missing_new_line2-u +9 -0
  51. data/test/test_block.rb +34 -0
  52. data/test/test_change.rb +234 -0
  53. data/test/test_diff.rb +53 -0
  54. data/test/test_helper.rb +225 -0
  55. data/test/test_hunk.rb +72 -0
  56. data/test/test_issues.rb +168 -0
  57. data/test/test_lcs.rb +47 -0
  58. data/test/test_ldiff.rb +89 -0
  59. data/test/test_patch.rb +362 -0
  60. data/test/test_sdiff.rb +167 -0
  61. data/test/test_traverse_balanced.rb +322 -0
  62. data/test/test_traverse_sequences.rb +187 -0
  63. metadata +205 -119
  64. data/.rspec +0 -1
  65. data/bin/htmldiff +0 -35
  66. data/lib/diff/lcs/backports.rb +0 -13
  67. data/lib/diff/lcs/htmldiff.rb +0 -160
  68. data/mise.toml +0 -5
  69. data/spec/fixtures/ldiff/output.diff-c +0 -7
  70. data/spec/fixtures/ldiff/output.diff-e +0 -3
  71. data/spec/fixtures/ldiff/output.diff-f +0 -3
  72. data/spec/fixtures/ldiff/output.diff-u +0 -5
  73. data/spec/fixtures/ldiff/output.diff.bin2 +0 -1
  74. data/spec/fixtures/ldiff/output.diff.bin2-c +0 -1
  75. data/spec/fixtures/ldiff/output.diff.bin2-e +0 -1
  76. data/spec/fixtures/ldiff/output.diff.bin2-f +0 -1
  77. data/spec/fixtures/ldiff/output.diff.bin2-u +0 -1
  78. data/spec/fixtures/ldiff/output.diff.chef-e +0 -3
  79. data/spec/fixtures/ldiff/output.diff.chef-f +0 -3
  80. data/spec/fixtures/ldiff/output.diff.chef-u +0 -9
  81. data/spec/fixtures/ldiff/output.diff.chef2-e +0 -7
  82. data/spec/fixtures/ldiff/output.diff.chef2-f +0 -7
  83. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c +0 -9
  84. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-u +0 -7
  85. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-c +0 -9
  86. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-u +0 -7
  87. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-c +0 -9
  88. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-u +0 -6
  89. data/spec/fixtures/ldiff/output.diff.missing_new_line1-u +0 -9
  90. data/spec/fixtures/ldiff/output.diff.missing_new_line2-u +0 -9
  91. /data/{docs → licenses}/COPYING.txt +0 -0
  92. /data/{docs → licenses}/artistic.txt +0 -0
  93. /data/{spec → test}/fixtures/123_x +0 -0
  94. /data/{spec → test}/fixtures/456_x +0 -0
  95. /data/{spec → test}/fixtures/aX +0 -0
  96. /data/{spec → test}/fixtures/bXaX +0 -0
  97. /data/{spec → test}/fixtures/ds1.csv +0 -0
  98. /data/{spec → test}/fixtures/ds2.csv +0 -0
  99. /data/{spec → test}/fixtures/empty +0 -0
  100. /data/{spec → test}/fixtures/file1.bin +0 -0
  101. /data/{spec → test}/fixtures/file2.bin +0 -0
  102. /data/{spec → test}/fixtures/four_lines +0 -0
  103. /data/{spec → test}/fixtures/four_lines_with_missing_new_line +0 -0
  104. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line1-e +0 -0
  105. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line1-f +0 -0
  106. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line2-e +0 -0
  107. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line2-f +0 -0
  108. /data/{spec → test}/fixtures/ldiff/error.diff.chef-e +0 -0
  109. /data/{spec → test}/fixtures/ldiff/error.diff.chef-f +0 -0
  110. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line1-e +0 -0
  111. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line1-f +0 -0
  112. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line2-e +0 -0
  113. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line2-f +0 -0
  114. /data/{spec → test}/fixtures/ldiff/output.diff +0 -0
  115. /data/{spec → test}/fixtures/ldiff/output.diff.bin1 +0 -0
  116. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-c +0 -0
  117. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-e +0 -0
  118. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-f +0 -0
  119. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-u +0 -0
  120. /data/{spec → test}/fixtures/ldiff/output.diff.chef +0 -0
  121. /data/{spec → test}/fixtures/ldiff/output.diff.chef2 +0 -0
  122. /data/{spec → test}/fixtures/ldiff/output.diff.chef2-d +0 -0
  123. /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines +0 -0
  124. /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines-e +0 -0
  125. /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines-f +0 -0
  126. /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty +0 -0
  127. /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty-e +0 -0
  128. /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty-f +0 -0
  129. /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context +0 -0
  130. /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context-e +0 -0
  131. /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context-f +0 -0
  132. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1 +0 -0
  133. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-e +0 -0
  134. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-f +0 -0
  135. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2 +0 -0
  136. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-e +0 -0
  137. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-f +0 -0
  138. /data/{spec → test}/fixtures/new-chef +0 -0
  139. /data/{spec → test}/fixtures/new-chef2 +0 -0
  140. /data/{spec → test}/fixtures/old-chef +0 -0
  141. /data/{spec → test}/fixtures/old-chef2 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34fc249139fb5ed40b525cf33d8e4e3d3702384f74d1e67e63d8eed54a09133c
4
- data.tar.gz: 46739e6b242db46dd6d01c4bb26d7c51fc07ccaebd7ecd58c305d758f30dfc33
3
+ metadata.gz: b8edc3b3383f33e30269bdef56fd21d58ac8efe471bb202f129d659a4f1a5ead
4
+ data.tar.gz: 681426cabb34022d55a8335b4dcf095dc5b97faeddc4bbe82793a2cba36c6729
5
5
  SHA512:
6
- metadata.gz: c482d6b11cb38b840ee4a4c11785c592a7a537e5f855cca99739a578e8d833b05ad43cba4ac8e40e4ae1fa876633d9d96c18c29acef63bf72532c352d98b05e6
7
- data.tar.gz: 7c6da2681b6a2ddf4ebda85deb24aeaeea29218cfa452d40717e1963c117c95230da2c01c18b806cb0916a804263aa7ac0230c4adcbb8fb1b30a95faee5a4dda
6
+ metadata.gz: db895eb27c2215803f6da307375044c456fe7a09250d86d3be8fd176e22cc6aef71d3767fd6901c62c3a9a5c1035e282570a535fe365bff8af9ce1459d937687
7
+ data.tar.gz: 948fd71bb838124c75c594921a5225358785b40d36d4b3bae60bd0d17914f1b3aa9ab71715e25c488028a67fb660a41808036ffa955b3802505dc9dce83d13fc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0 / 2026-02-01
4
+
5
+ This release has significant **breaking changes**.
6
+
7
+ - diff-lcs 2 supports Ruby 3.2 or higher. This allowed:
8
+
9
+ - readability improvements (endless methods, pattern matching);
10
+
11
+ - support for immutable Data classes (`Diff::LCS::Block`, `Diff::LCS::Change`,
12
+ and `Diff::LCS::ContextChange`);
13
+
14
+ - removal of compatibility shims;
15
+
16
+ - reduction in conditional tests in loops, especially for String character
17
+ extraction (compare `string ? seq[i, 1] : seq[i]` to `seq[i]`); and
18
+
19
+ - optimizations to string and relying on standard encoding support present
20
+ since Ruby 2.1.
21
+
22
+ The primary API (methods and class methods on `Diff::LCS`) has not changed,
23
+ with one exception noted below. Internal APIs (including `Diff::LCS::Block`,
24
+ `Diff::LCS::Change`, `Diff::LCS::ContextChange`, and `Diff::LCS::Hunk`) have
25
+ changed for compatibility.
26
+
27
+ - The `htmldiff` binary and supporting code have been removed without
28
+ replacement.
29
+
30
+ - `ldiff` no longer supports `ed`-script output (`ed` and `reverse_ed` formats).
31
+ As Baptiste Courtois says in [#108][pull-108], the "implementation was broken
32
+ for a while and no-one reported it."
33
+
34
+ - The method `Diff::LCS.LCS` has been removed as an alias for `Diff::LCS.lcs`.
35
+ Most callers are using `Diff::LCS.lcs` and modern Ruby did-you-mean support
36
+ should assist with this update.
37
+
38
+ - `Diff::LCS::Change` objects implemented the comparison operator (`<=>`)
39
+ incorrectly. Comparisons are now done so that the `position` is compared
40
+ first, then the `action` (by index of `VALID_ACTIONS`), and finally the
41
+ element. `Diff::LCS::ContextChange` works similarly, comparing the old and new
42
+ positions prior to comparing the actions by index.
43
+
44
+ The order of `VALID_ACTIONS` was changed for the index order to make sense.
45
+
46
+ - `ldiff` now implements `-` as a filename option for standard input. This is
47
+ used for integration testing with RSpec like this:
48
+
49
+ ```console
50
+ rspec -Ilib -rdiff/lcs integration/failure/array_diff_spec.rb 2>&1 |
51
+ ruby -Ilib bin/ldiff -U integration/golden/array_diff.txt -
52
+ ```
53
+
54
+ - diff-lcs no longer uses RSpec as its test suite, but instead uses Minitest.
55
+ The conversion to Minitest and the new RSpec integration tests
56
+ (`rake integration`) were written with the assistance of [Kiro][kiro] and
57
+ verified manually, with portions changed as required.
58
+
59
+ - The code of conduct was updated to the Contributor Covenant 3.0.
60
+
3
61
  ## 1.6.2 / 2025-05-12
4
62
 
5
63
  - Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
@@ -25,8 +83,9 @@
25
83
 
26
84
  ## 1.6.0 / 2025-02-13
27
85
 
28
- - Baptiste Courtois (@annih) has done significant work on making `bin/ldiff`
29
- work better, contributing a number of issues and pull requests. These include:
86
+ - Baptiste Courtois ([@annih][gh-user-annih]) has done significant work on
87
+ making `bin/ldiff` work better, contributing a number of issues and pull
88
+ requests. These include:
30
89
 
31
90
  - Separation of command parsing from diff-generation in `Diff::LCS::Ldiff`
32
91
  code extraction making it easier to use separately from the `bin/ldiff`
@@ -385,8 +444,8 @@
385
444
 
386
445
  ## 1.1.1 / 2004-09-25
387
446
 
388
- - Fixed bug #891 (Set returned from patch command does not contain last equal
389
- part).
447
+ - Fixed bug [#891][gh-issue-891] (Set returned from patch command does not
448
+ contain last equal part).
390
449
 
391
450
  - Fixed a problem with callback initialisation code (it assumed that all
392
451
  callbacks passed as classes can be initialised; now, it rescues NoMethodError
@@ -504,6 +563,7 @@
504
563
  [pull-103]: https://github.com/halostatue/diff-lcs/pull/103
505
564
  [pull-104]: https://github.com/halostatue/diff-lcs/pull/104
506
565
  [pull-105]: https://github.com/halostatue/diff-lcs/pull/105
566
+ [pull-108]: https://github.com/halostatue/diff-lcs/pull/108
507
567
  [pull-129]: https://github.com/halostatue/diff-lcs/pull/129
508
568
  [pull-147]: https://github.com/halostatue/diff-lcs/pull/147
509
569
  [pull-148]: https://github.com/halostatue/diff-lcs/pull/148
@@ -516,3 +576,6 @@
516
576
  [standard ruby]: https://github.com/standardrb/standard
517
577
  [tidelift]: https://tidelift.com/security
518
578
  [tp]: https://guides.rubygems.org/trusted-publishing/
579
+ [kiro]: https://kiro.dev
580
+ [gh-user-annih]: https://github.com/annih
581
+ [gh-issue-891]: https://github.com/halostatue/diff-lcs/issues/891
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,128 +1,166 @@
1
- # Contributor Covenant Code of Conduct
1
+ # Contributor Covenant 3.0 Code of Conduct
2
2
 
3
3
  ## Our Pledge
4
4
 
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- - Demonstrating empathy and kindness toward other people
21
- - Being respectful of differing opinions, viewpoints, and experiences
22
- - Giving and gracefully accepting constructive feedback
23
- - Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- - Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- - The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- - Trolling, insulting or derogatory comments, and personal or political attacks
33
- - Public or private harassment
34
- - Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- - Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
5
+ We pledge to make our community welcoming, safe, and equitable for all.
6
+
7
+ We are committed to fostering an environment that respects and promotes the
8
+ dignity, rights, and contributions of all individuals, regardless of
9
+ characteristics including race, ethnicity, caste, color, age, physical
10
+ characteristics, neurodiversity, disability, sex or gender, gender identity or
11
+ expression, sexual orientation, language, philosophy or religion, national or
12
+ social origin, socio-economic position, level of education, or other status. The
13
+ same privileges of participation are extended to everyone who participates in
14
+ good faith and in accordance with this Covenant.
15
+
16
+ ## Encouraged Behaviors
17
+
18
+ While acknowledging differences in social norms, we all strive to meet our
19
+ community's expectations for positive behavior. We also understand that our
20
+ words and actions may be interpreted differently than we intend based on
21
+ culture, background, or native language.
22
+
23
+ With these considerations in mind, we agree to behave mindfully toward each
24
+ other and act in ways that center our shared values, including:
25
+
26
+ 1. Respecting the **purpose of our community**, our activities, and our ways of
27
+ gathering.
28
+ 2. Engaging **kindly and honestly** with others.
29
+ 3. Respecting **different viewpoints** and experiences.
30
+ 4. **Taking responsibility** for our actions and contributions.
31
+ 5. Gracefully giving and accepting **constructive feedback**.
32
+ 6. Committing to **repairing harm** when it occurs.
33
+ 7. Behaving in other ways that promote and sustain the **well-being of our
34
+ community**.
35
+
36
+ ## Restricted Behaviors
37
+
38
+ We agree to restrict the following behaviors in our community. Instances,
39
+ threats, and promotion of these behaviors are violations of this Code of
40
+ Conduct.
41
+
42
+ 1. **Harassment.** Violating explicitly expressed boundaries or engaging in
43
+ unnecessary personal attention after any clear request to stop.
44
+ 2. **Character attacks.** Making insulting, demeaning, or pejorative comments
45
+ directed at a community member or group of people.
46
+ 3. **Stereotyping or discrimination.** Characterizing anyone’s personality or
47
+ behavior on the basis of immutable identities or traits.
48
+ 4. **Sexualization.** Behaving in a way that would generally be considered
49
+ inappropriately intimate in the context or purpose of the community.
50
+ 5. **Violating confidentiality**. Sharing or acting on someone's personal or
51
+ private information without their permission.
52
+ 6. **Endangerment.** Causing, encouraging, or threatening violence or other harm
53
+ toward any person or group.
54
+ 7. Behaving in other ways that **threaten the well-being** of our community.
55
+
56
+ ### Other Restrictions
57
+
58
+ 1. **Misleading identity.** Impersonating someone else for any reason, or
59
+ pretending to be someone else to evade enforcement actions.
60
+ 2. **Failing to credit sources.** Not properly crediting the sources of content
61
+ you contribute.
62
+ 3. **Promotional materials**. Sharing marketing or other commercial content in a
63
+ way that is outside the norms of the community.
64
+ 4. **Irresponsible communication.** Failing to responsibly present content which
65
+ includes, links or describes any other restricted behaviors.
66
+
67
+ ## Reporting an Issue
68
+
69
+ Tensions can occur between community members even when they are trying their
70
+ best to collaborate. Not every conflict represents a code of conduct violation,
71
+ and this Code of Conduct reinforces encouraged behaviors and norms that can help
72
+ avoid conflicts and minimize harm.
73
+
74
+ When an incident does occur, it is important to report it promptly. To report a
75
+ possible violation, create a [private security advisory][advisory] — violations
76
+ of this code of conduct are considered security vulnerabilities.
77
+
78
+ Community Moderators take reports of violations seriously and will make every
79
+ effort to respond in a timely manner. They will investigate all reports of code
80
+ of conduct violations, reviewing messages, logs, and recordings, or interviewing
81
+ witnesses and other participants. Community Moderators will keep investigation
82
+ and enforcement actions as transparent as possible while prioritizing safety and
83
+ confidentiality. In order to honor these values, enforcement actions are carried
84
+ out in private with the involved parties, but communicating to the whole
85
+ community may be part of a mutually agreed upon resolution.
86
+
87
+ ## Addressing and Repairing Harm
88
+
89
+ If an investigation by the Community Moderators finds that this Code of Conduct
90
+ has been violated, the following enforcement ladder may be used to determine how
91
+ best to repair harm, based on the incident's impact on the individuals involved
92
+ and the community as a whole. Depending on the severity of a violation, lower
93
+ rungs on the ladder may be skipped.
94
+
95
+ 1. Warning
96
+ 1. Event: A violation involving a single incident or series of incidents.
97
+ 2. Consequence: A private, written warning from the Community Moderators.
98
+ 3. Repair: Examples of repair include a private written apology,
99
+ acknowledgement of responsibility, and seeking clarification on
100
+ expectations.
101
+
102
+ 2. Temporarily Limited Activities
103
+ 1. Event: A repeated incidence of a violation that previously resulted in a
104
+ warning, or the first incidence of a more serious violation.
105
+ 2. Consequence: A private, written warning with a time-limited cooldown
106
+ period designed to underscore the seriousness of the situation and give
107
+ the community members involved time to process the incident. The cooldown
108
+ period may be limited to particular communication channels or interactions
109
+ with particular community members.
110
+ 3. Repair: Examples of repair may include making an apology, using the
111
+ cooldown period to reflect on actions and impact, and being thoughtful
112
+ about re-entering community spaces after the period is over.
113
+
114
+ 3. Temporary Suspension
115
+ 1. Event: A pattern of repeated violation which the Community Moderators have
116
+ tried to address with warnings, or a single serious violation.
117
+ 2. Consequence: A private written warning with conditions for return from
118
+ suspension. In general, temporary suspensions give the person being
119
+ suspended time to reflect upon their behavior and possible corrective
120
+ actions.
121
+ 3. Repair: Examples of repair include respecting the spirit of the
122
+ suspension, meeting the specified conditions for return, and being
123
+ thoughtful about how to reintegrate with the community when the suspension
124
+ is lifted.
125
+
126
+ 4. Permanent Ban
127
+ 1. Event: A pattern of repeated code of conduct violations that other steps
128
+ on the ladder have failed to resolve, or a violation so serious that the
129
+ Community Moderators determine there is no way to keep the community safe
130
+ with this person as a member.
131
+ 2. Consequence: Access to all community spaces, tools, and communication
132
+ channels is removed. In general, permanent bans should be rarely used,
133
+ should have strong reasoning behind them, and should only be resorted to
134
+ if working through other remedies has failed to change the behavior.
135
+ 3. Repair: There is no possible repair in cases of this severity.
136
+
137
+ This enforcement ladder is intended as a guideline. It does not limit the
138
+ ability of Community Managers to use their discretion and judgment, in keeping
139
+ with the best interests of our community.
50
140
 
51
141
  ## Scope
52
142
 
53
143
  This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official email address,
56
- posting via an official social media account, or acting as an appointed
144
+ an individual is officially representing the community in public or other
145
+ spaces. Examples of representing our community include using an official email
146
+ address, posting via an official social media account, or acting as an appointed
57
147
  representative at an online or offline event.
58
148
 
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at [INSERT CONTACT
63
- METHOD]. All complaints will be reviewed and investigated promptly and fairly.
64
-
65
- All community leaders are obligated to respect the privacy and security of the
66
- reporter of any incident.
67
-
68
- ## Enforcement Guidelines
69
-
70
- Community leaders will follow these Community Impact Guidelines in determining
71
- the consequences for any action they deem in violation of this Code of Conduct:
72
-
73
- ### 1. Correction
74
-
75
- **Community Impact**: Use of inappropriate language or other behavior deemed
76
- unprofessional or unwelcome in the community.
77
-
78
- **Consequence**: A private, written warning from community leaders, providing
79
- clarity around the nature of the violation and an explanation of why the
80
- behavior was inappropriate. A public apology may be requested.
81
-
82
- ### 2. Warning
83
-
84
- **Community Impact**: A violation through a single incident or series of
85
- actions.
86
-
87
- **Consequence**: A warning with consequences for continued behavior. No
88
- interaction with the people involved, including unsolicited interaction with
89
- those enforcing the Code of Conduct, for a specified period of time. This
90
- includes avoiding interactions in community spaces as well as external channels
91
- like social media. Violating these terms may lead to a temporary or permanent
92
- ban.
93
-
94
- ### 3. Temporary Ban
95
-
96
- **Community Impact**: A serious violation of community standards, including
97
- sustained inappropriate behavior.
98
-
99
- **Consequence**: A temporary ban from any sort of interaction or public
100
- communication with the community for a specified period of time. No public or
101
- private interaction with the people involved, including unsolicited interaction
102
- with those enforcing the Code of Conduct, is allowed during this period.
103
- Violating these terms may lead to a permanent ban.
104
-
105
- ### 4. Permanent Ban
106
-
107
- **Community Impact**: Demonstrating a pattern of violation of community
108
- standards, including sustained inappropriate behavior, harassment of an
109
- individual, or aggression toward or disparagement of classes of individuals.
110
-
111
- **Consequence**: A permanent ban from any sort of public interaction within the
112
- community.
113
-
114
149
  ## Attribution
115
150
 
116
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117
- version 2.1, available at
118
- <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
151
+ This Code of Conduct is adapted from the Contributor Covenant, version 3.0,
152
+ permanently available at <https://www.contributor-covenant.org/version/3/0/>.
119
153
 
120
- Community Impact Guidelines were inspired by
121
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
154
+ Contributor Covenant is stewarded by the Organization for Ethical Source and
155
+ licensed under CC BY-SA 4.0. To view a copy of this license, visit
156
+ <https://creativecommons.org/licenses/by-sa/4.0/>.
122
157
 
123
- For answers to common questions about this code of conduct, see the FAQ at
124
- <https://www.contributor-covenant.org/faq>. Translations are available at
125
- <https://www.contributor-covenant.org/translations>.
158
+ For answers to common questions about Contributor Covenant, see the FAQ at
159
+ <https://www.contributor-covenant.org/faq>. Translations are provided at
160
+ <https://www.contributor-covenant.org/translations>. Additional enforcement and
161
+ community guideline resources can be found at
162
+ <https://www.contributor-covenant.org/resources>. The enforcement ladder was
163
+ inspired by the work of [Mozilla’s code of conduct team][inclusion].
126
164
 
127
- [homepage]: https://www.contributor-covenant.org
128
- [Mozilla CoC]: https://github.com/mozilla/diversity
165
+ [advisory]: https://github.com/halostatue/diff-lcs/security/advisories/new
166
+ [inclusion]: https://github.com/mozilla/inclusion
data/CONTRIBUTING.md CHANGED
@@ -1,31 +1,36 @@
1
1
  # Contributing
2
2
 
3
- Contribution to diff-lcs is encouraged in any form: a bug report, a feature
4
- request, or code contributions. There are a few DOs and DON'Ts for
5
- contributions.
3
+ Contribution to diff-lcs is encouraged: bug reports, feature requests, or code
4
+ contributions. New features should be proposed and discussed in an
5
+ [issue][issues].
6
6
 
7
- - DO:
7
+ Before contributing patches, please read the [Licence](./LICENCE.md).
8
8
 
9
- - Keep the coding style that already exists for any updated Ruby code (support
10
- or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
9
+ diff-lcs is governed under the [Contributor Covenant Code of Conduct][cccoc].
11
10
 
12
- - Use thoughtfully-named topic branches for contributions. Rebase your commits
13
- into logical chunks as necessary.
11
+ ## Code Guidelines
14
12
 
15
- - Use [quality commit messages][qcm].
13
+ I have several guidelines to contributing code through pull requests:
16
14
 
17
- - Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
18
- `CHANGELOG.md` as a separate commit from your main change. (Follow the style
19
- in the `CHANGELOG.md` and provide a link to your PR.)
15
+ - All code changes require tests. In most cases, this will be added or updated
16
+ unit tests. I use [Minitest][minitest].
20
17
 
21
- - Add or update tests as appropriate for your change. The test suite is
22
- written in [RSpec][rspec].
18
+ - There are integration tests with RSpec which must not be broken, accessible
19
+ through `rake integration`. This requires a non-bundled RSpec,
20
+ `gem install rspec`.
23
21
 
24
- - Add or update documentation as appropriate for your change. The
25
- documentation is RDoc; diff-lcs does not use extensions that may be present
26
- in alternative documentation generators.
22
+ - I use code formatters, static analysis tools, and linting to ensure consistent
23
+ styles and formatting. There should be no warning output from test run
24
+ processes. I use [Standard Ruby][standardrb].
27
25
 
28
- - DO NOT:
26
+ - Proposed changes should be on a thoughtfully-named topic branch and organized
27
+ into logical commit chunks as appropriate.
28
+
29
+ - Use [Conventional Commits][conventional] with my
30
+ [conventions](#commit-conventions).
31
+
32
+ - Versions must not be updated in pull requests unless otherwise directed. This
33
+ means that you must not:
29
34
 
30
35
  - Modify `VERSION` in `lib/diff/lcs/version.rb`. When your patch is accepted
31
36
  and a release is made, the version will be updated at that point.
@@ -36,6 +41,30 @@ contributions.
36
41
 
37
42
  - Modify the `Gemfile`.
38
43
 
44
+ - Documentation should be added or updated as appropriate for new or updated
45
+ functionality. The documentation is RDoc; diff-lcs does not use extensions
46
+ that may be present in alternative documentation generators.
47
+
48
+ - All GitHub Actions checks marked as required must pass before a pull request
49
+ may be accepted and merged.
50
+
51
+ - Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
52
+ `CHANGELOG.md` as a separate commit from your main change. (Follow the style
53
+ in the `CHANGELOG.md` and provide a link to your PR.)
54
+
55
+ - Include your DCO sign-off in each commit message (see [LICENCE](LICENCE.md)).
56
+
57
+ ## AI Contribution Policy
58
+
59
+ diff-lcs is a library with complex interactions and subtle decisions (some of
60
+ them possibly even wrong). It is extremely important that contributions of any
61
+ sort be well understood by the submitter and that the developer can attest to
62
+ the [Developer Certificate of Origin][dco] for each pull request (see
63
+ [LICENCE](LICENCE.md)).
64
+
65
+ Any contribution (bug, feature request, or pull request) that uses undeclared AI
66
+ output will be rejected.
67
+
39
68
  ## Test Dependencies
40
69
 
41
70
  diff-lcs uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds
@@ -44,28 +73,55 @@ tests in the same way that `rake spec` does.
44
73
 
45
74
  To assist with the installation of the development dependencies for diff-lcs, I
46
75
  have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file.
47
- `minitar.gemspec` file. This will permit you to use `bundle install` to install
48
- the dependencies.
76
+ This will permit you to use `bundle install` to install the dependencies.
49
77
 
50
78
  You can run tests with code coverage analysis by running `rake spec:coverage`.
51
79
 
52
- ## Workflow
80
+ ## Commit Conventions
81
+
82
+ diff-lcs has adopted a variation of the Conventional Commits format for commit
83
+ messages. The following types are permitted:
84
+
85
+ | Type | Purpose |
86
+ | ------- | ----------------------------------------------------- |
87
+ | `feat` | A new feature |
88
+ | `fix` | A bug fix |
89
+ | `chore` | A code change that is neither a bug fix nor a feature |
90
+ | `docs` | Documentation updates |
91
+ | `deps` | Dependency updates, including GitHub Actions. |
92
+
93
+ I encourage the use of [Tim Pope's][tpope-qcm] or [Chris Beam's][cbeams]
94
+ guidelines on the writing of commit messages
95
+
96
+ I require the use of [git][trailers1] [trailers][trailers2] for specific
97
+ additional metadata and strongly encourage it for others. The conditionally
98
+ required metadata trailers are:
99
+
100
+ - `Breaking-Change`: if the change is a breaking change. **Do not** use the
101
+ shorthand form (`feat!(scope)`) or `BREAKING CHANGE`.
102
+
103
+ - `Signed-off-by`: this is required for all developers except me, as outlined in
104
+ the [Licence](./LICENCE.md#developer-certificate-of-origin).
53
105
 
54
- Here's the most direct way to get your work merged into the project:
106
+ - `Fixes` or `Resolves`: If a change fixes one or more open [issues][issues],
107
+ that issue must be included in the `Fixes` or `Resolves` trailer. Multiple
108
+ issues should be listed comma separated in the same trailer:
109
+ `Fixes: #1, #5, #7`, but _may_ appear in separate trailers. While both `Fixes`
110
+ and `Resolves` are synonyms, only _one_ should be used in a given commit or
111
+ pull request.
55
112
 
56
- - Fork the project.
57
- - Clone your fork (`git clone git://github.com/<username>/diff-lcs.git`).
58
- - Create a topic branch to contain your change
59
- (`git checkout -b my_awesome_feature`).
60
- - Hack away, add tests. Not necessarily in that order.
61
- - Make sure everything still passes by running `rake`.
62
- - If necessary, rebase your commits into logical chunks, without errors.
63
- - Push the branch up (`git push origin my_awesome_feature`).
64
- - Create a pull request against halostatue/diff-lcs and describe what your
65
- change does and the why you think it should be merged.
113
+ - `Related to`: If a change does not fix an issue, those issue references should
114
+ be included in this trailer.
66
115
 
116
+ [cbeams]: https://cbea.ms/git-commit/
117
+ [cccoc]: ./CODE_OF_CONDUCT.md
118
+ [conventional]: https://www.conventionalcommits.org/en/v1.0.0/
119
+ [dco]: licences/dco.txt
67
120
  [hoe]: https://github.com/seattlerb/hoe
68
- [qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
69
- [release-gem]: https://github.com/rubygems/release-gem
70
- [rspec]: http://rspec.info/documentation/
121
+ [issues]: https://github.com/halostatue/diff-lcs/issues
122
+ [minitest]: https://github.com/seattlerb/minitest
123
+ [rspec]: https://rspec.info/documentation/
71
124
  [standardrb]: https://github.com/standardrb/standard
125
+ [tpope-qcm]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
126
+ [trailers1]: https://git-scm.com/docs/git-interpret-trailers
127
+ [trailers2]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---trailerlttokengtltvaluegt
data/CONTRIBUTORS.md CHANGED
@@ -1,26 +1,26 @@
1
1
  # Contributors
2
2
 
3
- - Austin Ziegler (@halostatue) created diff-lcs.
3
+ - Austin Ziegler ([@halostatue][gh-user-halostatue]) created diff-lcs.
4
4
 
5
5
  Thanks to everyone else who has contributed to diff-lcs over the years:
6
6
 
7
- - @ginriki
8
- - @joshbronson
9
- - @kevinmook
10
- - @mckaz
7
+ - [@ginriki][gh-user-ginriki]
8
+ - [@joshbronson][gh-user-joshbronson]
9
+ - [@kevinmook][gh-user-kevinmook]
10
+ - [@mckaz][gh-user-mckaz]
11
11
  - Akinori Musha
12
12
  - Artem Ignatyev
13
13
  - Brandon Fish
14
- - Baptiste Courtois (@annih)
14
+ - Baptiste Courtois ([@annih][gh-user-annih])
15
15
  - Camille Drapier
16
16
  - Cédric Boutillier
17
- - @earlopain
17
+ - [@earlopain][gh-user-earlopain]
18
18
  - Gregg Kellogg
19
19
  - Jagdeep Singh
20
20
  - Jason Gladish
21
21
  - Jon Rowe
22
22
  - Josef Strzibny
23
- - Josep (@apuratepp)
23
+ - Josep ([@apuratepp][gh-user-apuratepp])
24
24
  - Josh Bronson
25
25
  - Jun Aruga
26
26
  - Justin Steele
@@ -44,6 +44,16 @@ Thanks to everyone else who has contributed to diff-lcs over the years:
44
44
  - Ryan Lovelett
45
45
  - Scott Steele
46
46
  - Simon Courtois
47
- - Tien (@tiendo1011)
47
+ - Tien ([@tiendo1011][gh-user-tiendo1011])
48
48
  - Tomas Jura
49
49
  - Vít Ondruch
50
+
51
+ [gh-user-halostatue]: https://github.com/halostatue
52
+ [gh-user-ginriki]: https://github.com/ginriki
53
+ [gh-user-joshbronson]: https://github.com/joshbronson
54
+ [gh-user-kevinmook]: https://github.com/kevinmook
55
+ [gh-user-mckaz]: https://github.com/mckaz
56
+ [gh-user-annih]: https://github.com/annih
57
+ [gh-user-earlopain]: https://github.com/earlopain
58
+ [gh-user-apuratepp]: https://github.com/apuratepp
59
+ [gh-user-tiendo1011]: https://github.com/tiendo1011