Code Monkey home page Code Monkey logo

Comments (13)

kddnewton avatar kddnewton commented on June 6, 2024 1

Ah-ha! Found it. Thanks! That'll be fixed in the next release

from plugin-ruby.

kddnewton avatar kddnewton commented on June 6, 2024 1

In the meantime you can take the following steps:

  1. Change it to Dry::Matcher::ResultMatcher.call(result) do |m|
  2. Add a # stree-ignore comment before the line with the issue
  3. Ignore the whole file

from plugin-ruby.

kddnewton avatar kddnewton commented on June 6, 2024

Hey @chimpanstache - any chance you could share your users_controller.rb file? If not, could you potentially try to format it while removing private content and get it down to a small reproduction? I can't do anything without a little more information unfortunately.

from plugin-ruby.

chimpanstache avatar chimpanstache commented on June 6, 2024

Hey @kddnewton, there are only 2 contexts where value is appearing in that file, which are very same:

    result =
      estimate_duration.call(
        params: params,
      )
    if result.success?
      duration = result.value!

estimate_duration being an instance of this class:

class EstimateDuration
  include Wisper::Publisher
  include Dry::Monads[:result]
  extend Dry::Initializer


  def call(params:)
      ...

copilot explanation here if helpful:

Dry::Monads::Result can be either a Success or a Failure object. Both Success and Failure objects respond to the value! method.

In the case of a Success object, value! will return the value that the Success object is wrapping. However, if result is a Failure object, calling value! will raise an error.

Let me know if a larger code sample is necessary, thank you for helping me

from plugin-ruby.

kddnewton avatar kddnewton commented on June 6, 2024

value in this case is a method being called within syntax tree, it doesn't have to do with your file specifically. I imagine there's some place in your code that is calling something like:

foo.()

Do you see anything like that?

from plugin-ruby.

chimpanstache avatar chimpanstache commented on June 6, 2024

Indeed, here it is:

    Dry::Matcher::ResultMatcher.(result) do |m|
      ...

from plugin-ruby.

kddnewton avatar kddnewton commented on June 6, 2024

Great! Now that we've found that, can you tell me the version of the syntax_tree gem that you have installed? That performs the actual formatting.

from plugin-ruby.

chimpanstache avatar chimpanstache commented on June 6, 2024

Nice, there it is:

❯ gem list syntax_tree

*** LOCAL GEMS ***

syntax_tree (6.2.0)
syntax_tree-haml (4.0.3)
syntax_tree-rbs (1.0.0)

from plugin-ruby.

kddnewton avatar kddnewton commented on June 6, 2024

Is there anywhere else in that file that has calls like that? I'm still not quite able to reproduce here. (Thank you for your patience!)

from plugin-ruby.

kddnewton avatar kddnewton commented on June 6, 2024

Actually even better, could you run stree format path/to/file and give me the backtrace? That would be super helpful.

from plugin-ruby.

chimpanstache avatar chimpanstache commented on June 6, 2024

No worries! No, it's the only place in that file. Here is the full backtrace :

❯ stree format app/controllers/users_controller.rb
undefined method `value' for :call:Symbol
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2779:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:7614:in `block (2 levels) in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:924:in `block in if_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:924:in `if_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:7614:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:7612:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9974:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `each'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2398:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2397:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4499:in `block in format_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:961:in `block in indent'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:961:in `indent'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4497:in `format_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4415:in `block (2 levels) in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:924:in `block in if_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:924:in `if_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4415:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4413:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:7629:in `format_contents'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2791:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:7614:in `block (2 levels) in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:924:in `block in if_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:924:in `if_break'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:7614:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:7612:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9986:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `each'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2398:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2397:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4207:in `block (2 levels) in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:961:in `block in indent'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:961:in `indent'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4205:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:4175:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9986:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `each'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2398:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:2397:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:3383:in `block (2 levels) in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:961:in `block in indent'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:961:in `indent'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:3381:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `block in group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prettier_print-1.2.1/lib/prettier_print.rb:1009:in `with_target'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:201:in `group'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:3378:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9974:in `block in format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `each'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:9970:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/formatter.rb:168:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/node.rb:8640:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree.rb:94:in `format_node'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree.rb:66:in `format'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/cli.rb:314:in `run'
/Users/elias/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/syntax_tree-6.2.0/lib/syntax_tree/cli.rb:671:in `block (2 levels) in process_queue'

from plugin-ruby.

chimpanstache avatar chimpanstache commented on June 6, 2024

Fantastic! Thank you for your help. Looking forward the next release

from plugin-ruby.

chimpanstache avatar chimpanstache commented on June 6, 2024

# stree-ignore for the win!

from plugin-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.