Comments (13)
Ah-ha! Found it. Thanks! That'll be fixed in the next release
from plugin-ruby.
In the meantime you can take the following steps:
- Change it to
Dry::Matcher::ResultMatcher.call(result) do |m|
- Add a
# stree-ignore
comment before the line with the issue - Ignore the whole file
from plugin-ruby.
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.
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.
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.
Indeed, here it is:
Dry::Matcher::ResultMatcher.(result) do |m|
...
from plugin-ruby.
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.
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.
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.
Actually even better, could you run stree format path/to/file
and give me the backtrace? That would be super helpful.
from plugin-ruby.
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.
Fantastic! Thank you for your help. Looking forward the next release
from plugin-ruby.
# stree-ignore
for the win!
from plugin-ruby.
Related Issues (20)
- 4.0 fails on large array of hashes
- No parser could be inferred for file xyz.rb HOT 2
- HAML Formatting with long line HOT 1
- plugin going wrong in testing environment HOT 1
- unfriendly when use API prettier.format HOT 1
- Failed to get connection options from parse server in time HOT 1
- plugin-ruby does not support tab indentation HOT 4
- Change defaultOption.trailingComma to "all" to match Prettier for better diffs and easier code manipulation HOT 3
- Couldn't resolve parser "ruby" HOT 1
- Require blank line between function definitions HOT 1
- Prettier stopped working for Ruby files in VSCode HOT 8
- Any way to force prettier to use the plugin-ruby parser? HOT 1
- Can't run plugin HOT 1
- New release HOT 2
- Formatting is failing for certain files after #1407 HOT 2
- Change in method call chaining style
- Non-stable formatting with a multi-line comment in a method chain HOT 1
- Weird chained method call block indent
- Option to keep curly braces HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-ruby.