bash-merge 2.0.5 → 7.1.1

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.
data/CONTRIBUTING.md DELETED
@@ -1,227 +0,0 @@
1
- # Contributing
2
-
3
- Bug reports and pull requests are welcome on [CodeBerg][📜src-cb], [GitLab][📜src-gl], or [GitHub][📜src-gh].
4
- This project should be a safe, welcoming space for collaboration, so contributors agree to adhere to
5
- the [code of conduct][🤝conduct].
6
-
7
- To submit a patch, please fork the project, create a patch with tests, and send a pull request.
8
-
9
- Remember to [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] if you make changes.
10
-
11
- ## Help out!
12
-
13
- Take a look at the `reek` list which is the file called `REEK` and find something to improve.
14
-
15
- Follow these instructions:
16
-
17
- 1. Fork the repository
18
- 2. Create a feature branch (`git checkout -b my-new-feature`)
19
- 3. Make some fixes.
20
- 4. Commit changes (`git commit -am 'Added some feature'`)
21
- 5. Push to the branch (`git push origin my-new-feature`)
22
- 6. Make sure to add tests for it. This is important, so it doesn't break in a future release.
23
- 7. Create new Pull Request.
24
-
25
- ## Executables vs Rake tasks
26
-
27
- Executables shipped by dependencies, such as kettle-dev, and stone_checksums, are available
28
- after running `bin/setup`. These include:
29
-
30
- - gem_checksums
31
- - kettle-changelog
32
- - kettle-commit-msg
33
- - kettle-dev-setup
34
- - kettle-dvcs
35
- - kettle-pre-release
36
- - kettle-readme-backers
37
- - kettle-release
38
-
39
- There are many Rake tasks available as well. You can see them by running:
40
-
41
- ```shell
42
- bin/rake -T
43
- ```
44
-
45
- ## Environment Variables for Local Development
46
-
47
- Below are the primary environment variables recognized by stone_checksums (and its integrated tools). Unless otherwise noted, set boolean values to the string "true" to enable.
48
-
49
- General/runtime
50
- - DEBUG: Enable extra internal logging for this library (default: false)
51
- - REQUIRE_BENCH: Enable `require_bench` to profile requires (default: false)
52
- - CI: When set to true, adjusts default rake tasks toward CI behavior
53
-
54
- Coverage (kettle-soup-cover / SimpleCov)
55
- - K_SOUP_COV_DO: Enable coverage collection (default: true in .envrc)
56
- - K_SOUP_COV_FORMATTERS: Comma-separated list of formatters (html, xml, rcov, lcov, json, tty)
57
- - K_SOUP_COV_MIN_LINE: Minimum line coverage threshold (integer, e.g., 100)
58
- - K_SOUP_COV_MIN_BRANCH: Minimum branch coverage threshold (integer, e.g., 100)
59
- - K_SOUP_COV_MIN_HARD: Fail the run if thresholds are not met (true/false)
60
- - K_SOUP_COV_MULTI_FORMATTERS: Enable multiple formatters at once (true/false)
61
- - K_SOUP_COV_OPEN_BIN: Path to browser opener for HTML (empty disables auto-open)
62
- - MAX_ROWS: Limit console output rows for simplecov-console (e.g., 1)
63
- Tip: When running a single spec file locally, you may want `K_SOUP_COV_MIN_HARD=false` to avoid failing thresholds for a partial run.
64
-
65
- GitHub API and CI helpers
66
- - GITHUB_TOKEN or GH_TOKEN: Token used by `ci:act` and release workflow checks to query GitHub Actions status at higher rate limits
67
-
68
- Releasing and signing
69
- - SKIP_GEM_SIGNING: If set, skip gem signing during build/release
70
- - GEM_CERT_USER: Username for selecting your public cert in `certs/<USER>.pem` (defaults to $USER)
71
- - SOURCE_DATE_EPOCH: Reproducible build timestamp.
72
- - `kettle-release` will set this automatically for the session.
73
- - Not needed on bundler >= 2.7.0, as reproducible builds have become the default.
74
-
75
- Git hooks and commit message helpers (exe/kettle-commit-msg)
76
- - GIT_HOOK_BRANCH_VALIDATE: Branch name validation mode (e.g., `jira`) or `false` to disable
77
- - GIT_HOOK_FOOTER_APPEND: Append a footer to commit messages when goalie allows (true/false)
78
- - GIT_HOOK_FOOTER_SENTINEL: Required when footer append is enabled — a unique first-line sentinel to prevent duplicates
79
- - GIT_HOOK_FOOTER_APPEND_DEBUG: Extra debug output in the footer template (true/false)
80
-
81
- For a quick starting point, this repository’s `.envrc` shows sane defaults, and `.env.local` can override them locally.
82
-
83
- ## Appraisals
84
-
85
- From time to time the [appraisal2][🚎appraisal2] gemfiles in `gemfiles/` will need to be updated.
86
- They are created and updated with the commands:
87
-
88
- ```console
89
- bin/rake appraisal:update
90
- ```
91
-
92
- If you need to reset all gemfiles/*.gemfile.lock files:
93
-
94
- ```console
95
- bin/rake appraisal:reset
96
- ```
97
-
98
- When adding an appraisal to CI, check the [runner tool cache][🏃‍♂️runner-tool-cache] to see which runner to use.
99
-
100
- ## The Reek List
101
-
102
- Take a look at the `reek` list which is the file called `REEK` and find something to improve.
103
-
104
- To refresh the `reek` list:
105
-
106
- ```console
107
- bundle exec reek > REEK
108
- ```
109
-
110
- ## Run Tests
111
-
112
- To run all tests
113
-
114
- ```console
115
- bundle exec rake test
116
- ```
117
-
118
- ### Spec organization (required)
119
-
120
- - One spec file per class/module. For each class or module under `lib/`, keep all of its unit tests in a single spec file under `spec/` that mirrors the path and file name exactly: `lib/bash/merge/my_class.rb` -> `spec/bash/merge/my_class_spec.rb`.
121
- - Exception: Integration specs that intentionally span multiple classes. Place these under `spec/integration/` (or a clearly named integration folder), and do not directly mirror a single class. Name them after the scenario, not a class.
122
-
123
- ## Lint It
124
-
125
- Run all the default tasks, which includes running the gradually autocorrecting linter, `rubocop-gradual`.
126
-
127
- ```console
128
- bundle exec rake
129
- ```
130
-
131
- Or just run the linter.
132
-
133
- ```console
134
- bundle exec rake rubocop_gradual:autocorrect
135
- ```
136
-
137
- For more detailed information about using RuboCop in this project, please see the [RUBOCOP.md](RUBOCOP.md) guide. This project uses `rubocop_gradual` instead of vanilla RuboCop, which requires specific commands for checking violations.
138
-
139
- ### Important: Do not add inline RuboCop disables
140
-
141
- Never add `# rubocop:disable ...` / `# rubocop:enable ...` comments to code or specs (except when following the few existing `rubocop:disable` patterns for a rule already being disabled elsewhere in the code). Instead:
142
-
143
- - Prefer configuration-based exclusions when a rule should not apply to certain paths or files (e.g., via `.rubocop.yml`).
144
- - When a violation is temporary, and you plan to fix it later, record it in `.rubocop_gradual.lock` using the gradual workflow:
145
- - `bundle exec rake rubocop_gradual:autocorrect` (preferred)
146
- - `bundle exec rake rubocop_gradual:force_update` (only when you cannot fix the violations immediately)
147
-
148
- As a general rule, fix style issues rather than ignoring them. For example, our specs should follow RSpec conventions like using `described_class` for the class under test.
149
-
150
- ## Contributors
151
-
152
- Your picture could be here!
153
-
154
- [![Contributors][🖐contributors-img]][🖐contributors]
155
-
156
- Made with [contributors-img][🖐contrib-rocks].
157
-
158
- Also see GitLab Contributors: [https://gitlab.com/kettle-rb/bash-merge/-/graphs/main][🚎contributors-gl]
159
-
160
- ## For Maintainers
161
-
162
- ### One-time, Per-maintainer, Setup
163
-
164
- **IMPORTANT**: To sign a build,
165
- a public key for signing gems will need to be picked up by the line in the
166
- `gemspec` defining the `spec.cert_chain` (check the relevant ENV variables there).
167
- All releases are signed releases.
168
- See: [RubyGems Security Guide][🔒️rubygems-security-guide]
169
-
170
- NOTE: To build without signing the gem set `SKIP_GEM_SIGNING` to any value in the environment.
171
-
172
- ### To release a new version:
173
-
174
- #### Automated process
175
-
176
- 1. Update version.rb to contain the correct version-to-be-released.
177
- 2. Run `bundle exec kettle-changelog`.
178
- 3. Run `bundle exec kettle-release`.
179
- 4. Stay awake and monitor the release process for any errors, and answer any prompts.
180
-
181
- #### Manual process
182
-
183
- 1. Run `bin/setup && bin/rake` as a "test, coverage, & linting" sanity check
184
- 2. Update the version number in `version.rb`, and ensure `CHANGELOG.md` reflects changes
185
- 3. Run `bin/setup && bin/rake` again as a secondary check, and to update `Gemfile.lock`
186
- 4. Run `git commit -am "🔖 Prepare release v<VERSION>"` to commit the changes
187
- 5. Run `git push` to trigger the final CI pipeline before release, and merge PRs
188
- - NOTE: Remember to [check the build][🧪build].
189
- 6. Run `export GIT_TRUNK_BRANCH_NAME="$(git remote show origin | grep 'HEAD branch' | cut -d ' ' -f5)" && echo $GIT_TRUNK_BRANCH_NAME`
190
- 7. Run `git checkout $GIT_TRUNK_BRANCH_NAME`
191
- 8. Run `git pull origin $GIT_TRUNK_BRANCH_NAME` to ensure latest trunk code
192
- 9. Optional for older Bundler (< 2.7.0): Set `SOURCE_DATE_EPOCH` so `rake build` and `rake release` use the same timestamp and generate the same checksums
193
- - If your Bundler is >= 2.7.0, you can skip this; builds are reproducible by default.
194
- - Run `export SOURCE_DATE_EPOCH=$EPOCHSECONDS && echo $SOURCE_DATE_EPOCH`
195
- - If the echo above has no output, then it didn't work.
196
- - Note: `zsh/datetime` module is needed, if running `zsh`.
197
- - In older versions of `bash` you can use `date +%s` instead, i.e. `export SOURCE_DATE_EPOCH=$(date +%s) && echo $SOURCE_DATE_EPOCH`
198
- 10. Run `bundle exec rake build`
199
- 11. Run `bin/gem_checksums` (more context [1][🔒️rubygems-checksums-pr], [2][🔒️rubygems-guides-pr])
200
- to create SHA-256 and SHA-512 checksums. This functionality is provided by the `stone_checksums`
201
- [gem][💎stone_checksums].
202
- - The script automatically commits but does not push the checksums
203
- 12. Sanity check the SHA256, comparing with the output from the `bin/gem_checksums` command:
204
- - `sha256sum pkg/<gem name>-<version>.gem`
205
- 13. Run `bundle exec rake release` which will create a git tag for the version,
206
- push git commits and tags, and push the `.gem` file to the gem host configured in the gemspec.
207
-
208
- [📜src-gl]: https://gitlab.com/kettle-rb/bash-merge/
209
- [📜src-cb]: https://codeberg.org/kettle-rb/bash-merge
210
- [📜src-gh]: https://github.com/kettle-rb/bash-merge
211
- [🧪build]: https://github.com/kettle-rb/bash-merge/actions
212
- [🤝conduct]: https://gitlab.com/kettle-rb/bash-merge/-/blob/main/CODE_OF_CONDUCT.md
213
- [🖐contrib-rocks]: https://contrib.rocks
214
- [🖐contributors]: https://github.com/kettle-rb/bash-merge/graphs/contributors
215
- [🚎contributors-gl]: https://gitlab.com/kettle-rb/bash-merge/-/graphs/main
216
- [🖐contributors-img]: https://contrib.rocks/image?repo=kettle-rb/bash-merge
217
- [💎gem-coop]: https://gem.coop
218
- [🔒️rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
219
- [🔒️rubygems-checksums-pr]: https://github.com/rubygems/rubygems/pull/6022
220
- [🔒️rubygems-guides-pr]: https://github.com/rubygems/guides/pull/325
221
- [💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums
222
- [📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
223
- [📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-FFDD67.svg?style=flat
224
- [📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139
225
- [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
226
- [🚎appraisal2]: https://github.com/appraisal-rb/appraisal2
227
- [🏃‍♂️runner-tool-cache]: https://github.com/ruby/ruby-builder/releases/tag/toolcache
data/FUNDING.md DELETED
@@ -1,74 +0,0 @@
1
- <!-- RELEASE-NOTES-FOOTER-START -->
2
-
3
- Official Discord 👉️ [![Live Chat on Discord][✉️discord-invite-img]][✉️discord-invite]
4
-
5
- Many paths lead to being a sponsor or a backer of this project. Are you on such a path?
6
-
7
- [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal]
8
-
9
- [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate to my FLOSS efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS efforts using Patreon][🖇patreon-img]][🖇patreon]
10
-
11
- [⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
12
- [⛳liberapay]: https://liberapay.com/pboling/donate
13
- [🖇osc-backers]: https://opencollective.com/kettle-rb#backer
14
- [🖇osc-backers-i]: https://opencollective.com/kettle-rb/backers/badge.svg?style=flat
15
- [🖇osc-sponsors]: https://opencollective.com/kettle-rb#sponsor
16
- [🖇osc-sponsors-i]: https://opencollective.com/kettle-rb/sponsors/badge.svg?style=flat
17
- [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
18
- [🖇sponsor]: https://github.com/sponsors/pboling
19
- [🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg?style=flat
20
- [🖇polar]: https://polar.sh/pboling
21
- [🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat
22
- [🖇kofi]: https://ko-fi.com/O5O86SNP4
23
- [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-a51611.svg?style=flat
24
- [🖇patreon]: https://patreon.com/galtzo
25
- [🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat
26
- [🖇buyme]: https://www.buymeacoffee.com/pboling
27
- [🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&logo=paypal
28
- [🖇paypal]: https://www.paypal.com/paypalme/peterboling
29
- [✉️discord-invite]: https://discord.gg/3qme4XHNKN
30
- [✉️discord-invite-img]: https://img.shields.io/discord/1373797679469170758?style=flat
31
-
32
- <!-- RELEASE-NOTES-FOOTER-END -->
33
-
34
- # 🤑 A request for help
35
-
36
- Maintainers have teeth and need to pay their dentists.
37
- After getting laid off in an RIF in March, and encountering difficulty finding a new one,
38
- I began spending most of my time building open source tools.
39
- I'm hoping to be able to pay for my kids' health insurance this month,
40
- so if you value the work I am doing, I need your support.
41
- Please consider sponsoring me or the project.
42
-
43
- To join the community or get help 👇️ Join the Discord.
44
-
45
- [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
46
-
47
- To say "thanks!" ☝️ Join the Discord or 👇️ send money.
48
-
49
- [![Sponsor kettle-rb/bash-merge on Open Source Collective][🖇osc-all-bottom-img]][🖇osc] 💌 [![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal]
50
-
51
- # Another Way to Support Open Source Software
52
-
53
- I’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions. I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈‍ cats).
54
-
55
- If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in `bundle fund`.
56
-
57
- I’m developing a new library, [floss_funding][🖇floss-funding-gem], designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.
58
-
59
- **[Floss-Funding.dev][🖇floss-funding.dev]: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags**
60
-
61
- [⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
62
- [🖇osc-all-img]: https://img.shields.io/opencollective/all/kettle-rb
63
- [🖇osc-sponsors-img]: https://img.shields.io/opencollective/sponsors/kettle-rb
64
- [🖇osc-backers-img]: https://img.shields.io/opencollective/backers/kettle-rb
65
- [🖇osc-all-bottom-img]: https://img.shields.io/opencollective/all/kettle-rb?style=for-the-badge
66
- [🖇osc-sponsors-bottom-img]: https://img.shields.io/opencollective/sponsors/kettle-rb?style=for-the-badge
67
- [🖇osc-backers-bottom-img]: https://img.shields.io/opencollective/backers/kettle-rb?style=for-the-badge
68
- [🖇osc]: https://opencollective.com/kettle-rb
69
- [🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
70
- [🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
71
- [🖇paypal-bottom-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge&logo=paypal&color=0A0A0A
72
- [🖇floss-funding.dev]: https://floss-funding.dev
73
- [🖇floss-funding-gem]: https://github.com/galtzo-floss/floss_funding
74
- [✉️discord-invite-img-ftb]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025-2026 Peter H. Boling
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/REEK DELETED
File without changes
data/RUBOCOP.md DELETED
@@ -1,71 +0,0 @@
1
- # RuboCop Usage Guide
2
-
3
- ## Overview
4
-
5
- A tale of two RuboCop plugin gems.
6
-
7
- ### RuboCop Gradual
8
-
9
- This project uses `rubocop_gradual` instead of vanilla RuboCop for code style checking. The `rubocop_gradual` tool allows for gradual adoption of RuboCop rules by tracking violations in a lock file.
10
-
11
- ### RuboCop LTS
12
-
13
- This project uses `rubocop-lts` to ensure, on a best-effort basis, compatibility with Ruby >= 1.9.2.
14
- RuboCop rules are meticulously configured by the `rubocop-lts` family of gems to ensure that a project is compatible with a specific version of Ruby. See: https://rubocop-lts.gitlab.io for more.
15
-
16
- ## Checking RuboCop Violations
17
-
18
- To check for RuboCop violations in this project, always use:
19
-
20
- ```bash
21
- bundle exec rake rubocop_gradual:check
22
- ```
23
-
24
- **Do not use** the standard RuboCop commands like:
25
- - `bundle exec rubocop`
26
- - `rubocop`
27
-
28
- ## Understanding the Lock File
29
-
30
- The `.rubocop_gradual.lock` file tracks all current RuboCop violations in the project. This allows the team to:
31
-
32
- 1. Prevent new violations while gradually fixing existing ones
33
- 2. Track progress on code style improvements
34
- 3. Ensure CI builds don't fail due to pre-existing violations
35
-
36
- ## Common Commands
37
-
38
- - **Check violations**
39
- - `bundle exec rake rubocop_gradual`
40
- - `bundle exec rake rubocop_gradual:check`
41
- - **(Safe) Autocorrect violations, and update lockfile if no new violations**
42
- - `bundle exec rake rubocop_gradual:autocorrect`
43
- - **Force update the lock file (w/o autocorrect) to match violations present in code**
44
- - `bundle exec rake rubocop_gradual:force_update`
45
-
46
- ## Workflow
47
-
48
- 1. Before submitting a PR, run `bundle exec rake rubocop_gradual:autocorrect`
49
- a. or just the default `bundle exec rake`, as autocorrection is a pre-requisite of the default task.
50
- 2. If there are new violations, either:
51
- - Fix them in your code
52
- - Run `bundle exec rake rubocop_gradual:force_update` to update the lock file (only for violations you can't fix immediately)
53
- 3. Commit the updated `.rubocop_gradual.lock` file along with your changes
54
-
55
- ## Never add inline RuboCop disables
56
-
57
- Do not add inline `rubocop:disable` / `rubocop:enable` comments anywhere in the codebase (including specs, except when following the few existing `rubocop:disable` patterns for a rule already being disabled elsewhere in the code). We handle exceptions in two supported ways:
58
-
59
- - Permanent/structural exceptions: prefer adjusting the RuboCop configuration (e.g., in `.rubocop.yml`) to exclude a rule for a path or file pattern when it makes sense project-wide.
60
- - Temporary exceptions while improving code: record the current violations in `.rubocop_gradual.lock` via the gradual workflow:
61
- - `bundle exec rake rubocop_gradual:autocorrect` (preferred; will autocorrect what it can and update the lock only if no new violations were introduced)
62
- - If needed, `bundle exec rake rubocop_gradual:force_update` (as a last resort when you cannot fix the newly reported violations immediately)
63
-
64
- In general, treat the rules as guidance to follow; fix violations rather than ignore them. For example, RSpec conventions in this project expect `described_class` to be used in specs that target a specific class under test.
65
-
66
- ## Benefits of rubocop_gradual
67
-
68
- - Allows incremental adoption of code style rules
69
- - Prevents CI failures due to pre-existing violations
70
- - Provides a clear record of code style debt
71
- - Enables focused efforts on improving code quality over time
data/SECURITY.md DELETED
@@ -1,21 +0,0 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- | Version | Supported |
6
- |----------|-----------|
7
- | 1.latest | ✅ |
8
-
9
- ## Security contact information
10
-
11
- To report a security vulnerability, please use the
12
- [Tidelift security contact](https://tidelift.com/security).
13
- Tidelift will coordinate the fix and disclosure.
14
-
15
- ## Additional Support
16
-
17
- If you are interested in support for versions older than the latest release,
18
- please consider sponsoring the project / maintainer @ https://liberapay.com/pboling/donate,
19
- or find other sponsorship links in the [README].
20
-
21
- [README]: README.md
@@ -1,199 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bash
4
- module Merge
5
- # Resolves conflicts between template and destination Bash content
6
- # using structural signatures and configurable preferences.
7
- #
8
- # @example Basic usage
9
- # resolver = ConflictResolver.new(template_analysis, dest_analysis)
10
- # resolver.resolve(result)
11
- class ConflictResolver < ::Ast::Merge::ConflictResolverBase
12
- # Creates a new ConflictResolver
13
- #
14
- # @param template_analysis [FileAnalysis] Analyzed template file
15
- # @param dest_analysis [FileAnalysis] Analyzed destination file
16
- # @param preference [Symbol, Hash] Which version to prefer when
17
- # nodes have matching signatures:
18
- # - :destination (default) - Keep destination version (customizations)
19
- # - :template - Use template version (updates)
20
- # @param add_template_only_nodes [Boolean] Whether to add nodes only in template
21
- # @param match_refiner [#call, nil] Optional match refiner for fuzzy matching
22
- # @param options [Hash] Additional options for forward compatibility
23
- # @param node_typing [Hash{Symbol,String => #call}, nil] Node typing configuration
24
- # for per-node-type preferences
25
- def initialize(template_analysis, dest_analysis, preference: :destination, add_template_only_nodes: false, match_refiner: nil, node_typing: nil, **options)
26
- super(
27
- strategy: :batch,
28
- preference: preference,
29
- template_analysis: template_analysis,
30
- dest_analysis: dest_analysis,
31
- add_template_only_nodes: add_template_only_nodes,
32
- match_refiner: match_refiner,
33
- **options
34
- )
35
- @node_typing = node_typing
36
- @emitter = Emitter.new
37
- end
38
-
39
- # Resolve conflicts and populate the result
40
- #
41
- # @param result [MergeResult] Result object to populate
42
- def resolve(result)
43
- DebugLogger.time("ConflictResolver#resolve") do
44
- template_nodes = @template_analysis.nodes
45
- dest_nodes = @dest_analysis.nodes
46
-
47
- # Clear emitter for fresh merge
48
- @emitter.clear
49
-
50
- # Build signature maps
51
- template_by_sig = build_signature_map(template_nodes, @template_analysis)
52
- dest_by_sig = build_signature_map(dest_nodes, @dest_analysis)
53
-
54
- # Track which nodes have been processed
55
- processed_template_sigs = ::Set.new
56
- processed_dest_sigs = ::Set.new
57
-
58
- # Process nodes via emitter
59
- merge_nodes_to_emitter(
60
- template_nodes,
61
- dest_nodes,
62
- template_by_sig,
63
- dest_by_sig,
64
- processed_template_sigs,
65
- processed_dest_sigs,
66
- )
67
-
68
- # Transfer emitter output to result
69
- emitted_content = @emitter.to_s
70
- unless emitted_content.empty?
71
- emitted_content.lines.each do |line|
72
- result.add_line(line.chomp, decision: MergeResult::DECISION_MERGED, source: :merged)
73
- end
74
- end
75
-
76
- DebugLogger.debug("Conflict resolution complete", {
77
- template_nodes: template_nodes.size,
78
- dest_nodes: dest_nodes.size,
79
- result_lines: result.line_count,
80
- })
81
- end
82
- end
83
-
84
- private
85
-
86
- def merge_nodes_to_emitter(template_nodes, dest_nodes, template_by_sig, dest_by_sig, processed_template_sigs, processed_dest_sigs)
87
- # First pass: Process destination nodes and find matches
88
- dest_nodes.each do |dest_node|
89
- dest_sig = @dest_analysis.generate_signature(dest_node)
90
-
91
- # Freeze blocks from destination are always preserved
92
- if freeze_node?(dest_node)
93
- emit_freeze_block(dest_node)
94
- processed_dest_sigs << dest_sig if dest_sig
95
- next
96
- end
97
-
98
- if dest_sig && template_by_sig[dest_sig]
99
- # Found matching node in template
100
- template_info = template_by_sig[dest_sig].first
101
- template_node = template_info[:node]
102
-
103
- # Decide which to emit based on preference
104
- emit_preferred_node(template_node, dest_node)
105
-
106
- processed_dest_sigs << dest_sig
107
- processed_template_sigs << dest_sig
108
- else
109
- # Destination-only node - always keep
110
- emit_node(dest_node, @dest_analysis)
111
- processed_dest_sigs << dest_sig if dest_sig
112
- end
113
- end
114
-
115
- # Second pass: Add template-only nodes if configured
116
- return unless @add_template_only_nodes
117
-
118
- template_nodes.each do |template_node|
119
- template_sig = @template_analysis.generate_signature(template_node)
120
-
121
- # Skip if already processed (matched with dest)
122
- next if template_sig && processed_template_sigs.include?(template_sig)
123
-
124
- # Skip freeze blocks from template
125
- next if freeze_node?(template_node)
126
-
127
- # Add template-only node
128
- emit_node(template_node, @template_analysis)
129
- processed_template_sigs << template_sig if template_sig
130
- end
131
- end
132
-
133
- def emit_preferred_node(template_node, dest_node)
134
- if preference_for_pair(template_node, dest_node) == :destination
135
- emit_node(dest_node, @dest_analysis)
136
- else
137
- emit_node(template_node, @template_analysis)
138
- end
139
- end
140
-
141
- def preference_for_pair(template_node, dest_node)
142
- return @preference unless @preference.is_a?(Hash)
143
-
144
- typed_template = apply_node_typing(template_node)
145
- typed_dest = apply_node_typing(dest_node)
146
-
147
- if Ast::Merge::NodeTyping.typed_node?(typed_template)
148
- merge_type = Ast::Merge::NodeTyping.merge_type_for(typed_template)
149
- return @preference.fetch(merge_type) { default_preference } if merge_type
150
- end
151
-
152
- if Ast::Merge::NodeTyping.typed_node?(typed_dest)
153
- merge_type = Ast::Merge::NodeTyping.merge_type_for(typed_dest)
154
- return @preference.fetch(merge_type) { default_preference } if merge_type
155
- end
156
-
157
- default_preference
158
- end
159
-
160
- def apply_node_typing(node)
161
- return node unless @node_typing
162
- return node unless node
163
-
164
- Ast::Merge::NodeTyping.process(node, @node_typing)
165
- end
166
-
167
- # Emit a single node to the emitter
168
- # @param node [NodeWrapper] Node to emit
169
- # @param analysis [FileAnalysis] Analysis for accessing source
170
- def emit_node(node, analysis)
171
- return if freeze_node?(node)
172
-
173
- # Emit leading comments
174
- if node.start_line
175
- leading = analysis.comment_tracker.leading_comments_before(node.start_line)
176
- leading.each do |comment|
177
- @emitter.emit_tracked_comment(comment)
178
- end
179
- end
180
-
181
- # Emit the node content
182
- if node.start_line && node.end_line
183
- lines = []
184
- (node.start_line..node.end_line).each do |line_num|
185
- line = analysis.line_at(line_num)
186
- lines << line if line
187
- end
188
- @emitter.emit_raw_lines(lines)
189
- end
190
- end
191
-
192
- # Emit a freeze block
193
- # @param freeze_node [FreezeNode] Freeze block to emit
194
- def emit_freeze_block(freeze_node)
195
- @emitter.emit_raw_lines(freeze_node.lines)
196
- end
197
- end
198
- end
199
- end