From d3d883dd7ef9ab9c75ba7f085c3a05ec079d4164 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Jul 2022 17:27:36 +0000 Subject: [PATCH 1/3] Bump rubocop from 1.31.2 to 1.32.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.31.2 to 1.32.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.31.2...v1.32.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ab79db80..937e7f3a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,17 +19,17 @@ GEM rake (13.0.6) regexp_parser (2.5.0) rexml (3.2.5) - rubocop (1.31.2) + rubocop (1.32.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.18.0, < 2.0) + rubocop-ast (>= 1.19.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.18.0) + rubocop-ast (1.19.1) parser (>= 3.1.1.0) ruby-progressbar (1.11.0) simplecov (0.21.2) From 46d2fbf4fefb2542d3f7f3ae73c1b301e95e8696 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 22 Jul 2022 13:09:32 -0400 Subject: [PATCH 2/3] Properly handle conditionals in assignment --- lib/syntax_tree/node.rb | 2 +- test/fixtures/if.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/syntax_tree/node.rb b/lib/syntax_tree/node.rb index 58335b00..b633a1c9 100644 --- a/lib/syntax_tree/node.rb +++ b/lib/syntax_tree/node.rb @@ -5173,7 +5173,7 @@ def self.call(parent) while (node = queue.shift) return true if [Assign, MAssign, OpAssign].include?(node.class) - queue += node.child_nodes + queue += node.child_nodes.compact end false diff --git a/test/fixtures/if.rb b/test/fixtures/if.rb index e5e88103..1963d301 100644 --- a/test/fixtures/if.rb +++ b/test/fixtures/if.rb @@ -59,3 +59,7 @@ baz end ) +% +if (x = x + 1).to_i + x +end From 3f5b736b9c81587382192385421358dc5209ea62 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 22 Jul 2022 13:19:34 -0400 Subject: [PATCH 3/3] Bump to v3.2.1 --- CHANGELOG.md | 9 ++++++++- Gemfile.lock | 2 +- lib/syntax_tree/version.rb | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b219009b..6634f331 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] +## [3.2.1] - 2022-07-22 + +### Changed + +- [#119](https://github.com/ruby-syntax-tree/syntax_tree/pull/119) - If there are conditionals in the assignment we cannot convert it to the modifier form. There was a bug where it would stop checking for assignment nodes if there were any optional child nodes. + ## [3.2.0] - 2022-07-19 ### Added @@ -306,7 +312,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/syntax_tree/compare/v3.2.0...HEAD +[unreleased]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.2.1...HEAD +[3.2.1]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.2.0...v3.2.1 [3.2.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.1.0...v3.2.0 [3.1.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.0.1...v3.1.0 [3.0.1]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.0.0...v3.0.1 diff --git a/Gemfile.lock b/Gemfile.lock index 937e7f3a..0fbbbf84 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - syntax_tree (3.2.0) + syntax_tree (3.2.1) prettier_print GEM diff --git a/lib/syntax_tree/version.rb b/lib/syntax_tree/version.rb index 92f18514..f920098f 100644 --- a/lib/syntax_tree/version.rb +++ b/lib/syntax_tree/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SyntaxTree - VERSION = "3.2.0" + VERSION = "3.2.1" end