From 23f23550fd0f3e2267cc5654002ed9f9dc347aa7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 12:14:34 +0000 Subject: [PATCH 1/6] Bump simplecov from 0.21.2 to 0.22.0 Bumps [simplecov](https://github.com/simplecov-ruby/simplecov) from 0.21.2 to 0.22.0. - [Release notes](https://github.com/simplecov-ruby/simplecov/releases) - [Changelog](https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md) - [Commits](https://github.com/simplecov-ruby/simplecov/compare/v0.21.2...v0.22.0) --- updated-dependencies: - dependency-name: simplecov dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 02476d5..c8bf5b6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,7 +9,7 @@ GEM docile (1.4.0) power_assert (2.0.2) rake (13.0.6) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) From f39b8a67fe2a49bc3837f8984f6b7e92948741db Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 3 Jan 2023 22:51:49 -0500 Subject: [PATCH 2/6] A couple of doc changes --- .github/dependabot.yml | 4 ++ .github/workflows/main.yml | 6 ++- CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++ README.md | 3 ++ 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 CODE_OF_CONDUCT.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4695914..9f77688 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,7 @@ updates: directory: "/" schedule: interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bcd3384..16f2807 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,16 +1,18 @@ name: Main + on: - push -- pull_request_target +- pull_request + jobs: ci: strategy: fail-fast: false matrix: ruby: - - '2.7' - '3.0' - '3.1' + - '3.2' - head name: CI runs-on: ubuntu-latest diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..b0c6bcf --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at kddnewton@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/README.md b/README.md index 48da3f2..2437757 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # PrettierPrint +[![Build Status](https://github.com/kddnewton/prettier_print/workflows/Main/badge.svg)](https://github.com/kddnewton/prettier_print/actions) +[![Gem Version](https://img.shields.io/gem/v/prettier_print.svg)](https://rubygems.org/gems/prettier_print) + A drop-in replacement for the `prettyprint` gem with more functionality. ## Installation From e13ace497e7b118e1da77ca931a973ba8b0a472e Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 3 Jan 2023 22:52:27 -0500 Subject: [PATCH 3/6] Fix up links for badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2437757..0e29038 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PrettierPrint -[![Build Status](https://github.com/kddnewton/prettier_print/workflows/Main/badge.svg)](https://github.com/kddnewton/prettier_print/actions) +[![Build Status](https://github.com/ruby-syntax-tree/prettier_print/workflows/Main/badge.svg)](https://github.com/ruby-syntax-tree/prettier_print/actions) [![Gem Version](https://img.shields.io/gem/v/prettier_print.svg)](https://rubygems.org/gems/prettier_print) A drop-in replacement for the `prettyprint` gem with more functionality. From 144e340de2db4ffe394f29fa501c8b7733fa2dce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 03:54:04 +0000 Subject: [PATCH 4/6] Bump dependabot/fetch-metadata from 1.3.3 to 1.3.5 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.3 to 1.3.5. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.3...v1.3.5) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 9b28abf..514ac27 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.3.3 + uses: dependabot/fetch-metadata@v1.3.5 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From 2459d7ca341a1132985b28a2bcc030bdd408a3b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jan 2023 12:11:59 +0000 Subject: [PATCH 5/6] Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.5 to 1.3.6. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.5...v1.3.6) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 514ac27..e54c910 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.3.5 + uses: dependabot/fetch-metadata@v1.3.6 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From 477cf9a64211db93af70494b6e973bfc5eb978ea Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 9 Mar 2023 09:52:30 -0500 Subject: [PATCH 6/6] Fix infinite loop, bump to version 1.2.1 --- CHANGELOG.md | 9 ++++++++- Gemfile.lock | 3 ++- lib/prettier_print.rb | 7 +++++-- lib/prettier_print/version.rb | 2 +- test/prettier_print_test.rb | 9 +++++++++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 506beb8..1b59deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [1.2.1] - 2023-03-09 + +### Changed + +- Fixed a bug where having line suffixes on the final line without a breakable could cause an infinite loop. + ## [1.2.0] - 2022-12-23 ### Added @@ -55,7 +61,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - 🎉 Initial release! 🎉 -[unreleased]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.2.0...HEAD +[unreleased]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.2.1...HEAD +[1.2.1]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.2.0...v1.2.1 [1.2.0]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.1.0...v1.2.0 [1.1.0]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.0.2...v1.1.0 [1.0.2]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.0.1...v1.0.2 diff --git a/Gemfile.lock b/Gemfile.lock index c8bf5b6..5c2e15b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - prettier_print (1.2.0) + prettier_print (1.2.1) GEM remote: https://rubygems.org/ @@ -20,6 +20,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-22 x86_64-darwin-21 x86_64-linux diff --git a/lib/prettier_print.rb b/lib/prettier_print.rb index 8cc72ad..a0ac1cc 100644 --- a/lib/prettier_print.rb +++ b/lib/prettier_print.rb @@ -616,8 +616,11 @@ def flush(base_indentation = DEFAULT_INDENTATION) end if commands.empty? && line_suffixes.any? - commands += line_suffixes.sort_by(&line_suffix_sort) - line_suffixes = [] + line_suffixes.sort_by(&line_suffix_sort).each do |(indent, mode, doc)| + commands += doc.contents.reverse.map { |part| [indent, mode, part] } + end + + line_suffixes.clear end end diff --git a/lib/prettier_print/version.rb b/lib/prettier_print/version.rb index 2677aff..bd23d3f 100644 --- a/lib/prettier_print/version.rb +++ b/lib/prettier_print/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class PrettierPrint - VERSION = "1.2.0" + VERSION = "1.2.1" end diff --git a/test/prettier_print_test.rb b/test/prettier_print_test.rb index 51c2faa..66068ca 100644 --- a/test/prettier_print_test.rb +++ b/test/prettier_print_test.rb @@ -152,6 +152,15 @@ class PrettierPrintTest < Test::Unit::TestCase assert_equal "content # suffix\n", result end + test "PrettierPrint#line_suffix without a break" do + result = + PrettierPrint.format do |q| + q.line_suffix { q.text("# suffix") } + end + + assert_equal "# suffix", result + end + test "PrettierPrint#trim" do result = PrettierPrint.format do |q|