Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summarize inspect #728

Open
marcandre opened this issue Jul 30, 2020 · 0 comments
Open

Summarize inspect #728

marcandre opened this issue Jul 30, 2020 · 0 comments

Comments

@marcandre
Copy link
Contributor

The current inspect methods for most classes are not very usable:

  @corrector=
   #<Parser::Source::TreeRewriter:0x00007fd280304148
    @action_root=
     #<Parser::Source::TreeRewriter::Action:0x00007fd280d73d90
      @children=[],
      @enforcer=
       #<Method: RuboCop::Cop::Corrector(Parser::Source::TreeRewriter)#enforce_policy(event) /Users/mal/parser/lib/parser/source/tree_rewriter.rb:384>,
      @insert_after="",
      @insert_before="",
      @range=#<Parser::Source::Range /Users/mal/rubocop/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb -1...10139>,
      @replacement=nil>,
    @diagnostics=
     #<Parser::Diagnostic::Engine:0x00007fd2803040a8
      @all_errors_are_fatal=false,
      @consumer=#<Proc:0x00007fd280d73b88 /Users/mal/rubocop/lib/rubocop/cop/corrector.rb:26 (lambda)>,
      @ignore_warnings=false>,
    @enforcer=
     #<Method: RuboCop::Cop::Corrector(Parser::Source::TreeRewriter)#enforce_policy(event) /Users/mal/parser/lib/parser/source/tree_rewriter.rb:384>,
    @in_transaction=false,
    @policy={:crossing_deletions=>:accept, :different_replacements=>:raise, :swallowed_insertions=>:raise},
    @source_buffer=
     #<Parser::Source::Buffer:0x00007fd284028358
      @column_for_position=
       {0=>0,
        31=>0,
        102=>0,
        166=>0,
        268=>6,
        343=>6,
        421=>6,
        492=>6,
        571=>6,
        646=>6,
        722=>6,
   #...
    @line_for_position= {
   # ...

Parser::Source::Range has nice inspect and to_s, but Parser::Source::Buffer and Parser::Source::TreeRewriter (at a minimum) would benefit from a summarized version...

I hope to propose a PR one day...

marcandre added a commit to marcandre/parser that referenced this issue Mar 7, 2021
marcandre added a commit to marcandre/parser that referenced this issue Mar 7, 2021
marcandre added a commit to marcandre/parser that referenced this issue Mar 7, 2021
iliabylich pushed a commit that referenced this issue Mar 7, 2021
marcandre added a commit to marcandre/parser that referenced this issue Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant