Open chimpanstache opened 2 months ago
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.
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
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?
Indeed, here it is:
Dry::Matcher::ResultMatcher.(result) do |m|
...
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.
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)
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!)
Actually even better, could you run stree format path/to/file
and give me the backtrace? That would be super helpful.
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'
Ah-ha! Found it. Thanks! That'll be fixed in the next release
Fantastic! Thank you for your help. Looking forward the next release
In the meantime you can take the following steps:
Dry::Matcher::ResultMatcher.call(result) do |m|
# stree-ignore
comment before the line with the issue# stree-ignore
for the win!
Bumping into this error:
here are my ruby and node versions:
Same versions are used inside the project repository. Here are my Prettier and prettier-ruby versions inside my package.json file:
My .prettierrc file :
My .prettierrc.json file :