Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Formatting fixes for YARP#394

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
csabahenk wants to merge1 commit intoruby-syntax-tree:yarp
base:yarp
Choose a base branch
Loading
fromcsabahenk:yarp

Conversation

csabahenk
Copy link

@csabahenkcsabahenk commentedJul 9, 2023
edited
Loading

Following issues are addressed:

---"constant misnomer (has: AssocSplat, should have: AssocSplatNode) brings on formatting failure":"{a => b}"hash label key duplicated:"{a: b}"identity hash formatting failure:"{a:}"mixed hash content loss:"{a => b, c: d}"funcall with kwargs gets bogus '=>':"fun(a: b)""empty #call formatting failure":fun[]"#-@ appended to arg":"-1"empty funcall formatting failure:fun()empty super call formatting failure:super()ternary conditional formatting failure:"a ? b : c"incorrect postfix unless for compound statements:unless a; b; c; endAlternationPatternNode:foo => bar | bazCallOperatorAndWriteNode:foo.bar &&= valueCallOperatorOrWriteNode:foo.bar ||= valueClassVariableOperatorAndWriteNode:"@https://github.com/target &&= value"ClassVariableOperatorOrWriteNode:"@https://github.com/target ||= value"ClassVariableOperatorWriteNode:"@https://github.com/target += value"ConstantOperatorAndWriteNode:Target &&= valueConstantOperatorOrWriteNode:Target ||= valueConstantOperatorWriteNode:Target += valueConstantPathOperatorWriteNode:Parent::Child += valueConstantPathOperatorAndWriteNode:Parent::Child &&= valueConstantPathOperatorOrWriteNode:Parent::Child ||= valueGlobalVariableOperatorAndWriteNode:$target &&= valueGlobalVariableOperatorOrWriteNode:$target ||= valueGlobalVariableOperatorWriteNode:$target += valueInstanceVariableOperatorAndWriteNode:"https://github.com/target &&= value"InstanceVariableOperatorOrWriteNode:"https://github.com/target ||= value"InstanceVariableOperatorWriteNode:"https://github.com/target += value"KeywordHashNode:"[**{}]"LocalVariableOperatorAndWriteNode:target &&= valueLocalVariableOperatorOrWriteNode:target ||= valueOrNode:left or rightRequiredDestructuredParameterNode:def foo((bar, baz)); endSourceFileNode:__FILE__SourceLineNode:__LINE__SourceEncodingNode:__ENCODING__

Notes:

  • Entries associated with a YARP Node class indicate a formatting
    failure due to #format method not being implemented for given
    class; so in these cases the fix boils down to implementing format.
  • For these entries the sample code that's given in the entry is the
    sample code from the YARP definition (config.yml), with one exception:
    the sample code for KeywordHashNode is 'foo(a: b)', but for that
    expression the formatting code preempts winding down to the
    KeywordHashNode instance, so the lack of KeywordHashNode#format is
    not triggered. The expression given for KeywordHashNode does indeed
    trigger KeywordHashNode#format. (Ironically, 'foo(a: b)' still had
    a formatting issue, but for a different reason.)
  • The aforementioned class tagged entries and the ones where
    "formatting failure" is indicated raise an exception with
    SyntaxTree::Formatter.format; the other cases do return but with a
    bogus result.
  • The hash related issues (ones where the word 'hash' occurs in the label,
    entries 2. to 4.) are shadowed by the first one (constant misnomer).
    Without fixing the name these entries will also end up with an exception.
    When the constant name is fixed, the indicated issue will be present.

Tested with YARP0eb5f7c3..

Following issues are addressed:---"constant misnomer (has: AssocSplat, should have: AssocSplatNode) brings on formatting failure": "{a => b}"hash label key duplicated: "{a: b}"identity hash formatting failure: "{a:}"mixed hash content loss: "{a => b, c: d}"funcall with kwargs gets bogus '=>': "fun(a: b)""empty #call formatting failure": fun[]"#-@ appended to arg": "-1"empty funcall formatting failure: fun()empty super call formatting failure: super()ternary conditional formatting failure: "a ? b : c"incorrect postfix unless for compound statements: unless a; b; c; endAlternationPatternNode: foo => bar | bazCallOperatorAndWriteNode: foo.bar &&= valueCallOperatorOrWriteNode: foo.bar ||= valueClassVariableOperatorAndWriteNode: "@@target &&= value"ClassVariableOperatorOrWriteNode: "@@target ||= value"ClassVariableOperatorWriteNode: "@@target += value"ConstantOperatorAndWriteNode: Target &&= valueConstantOperatorOrWriteNode: Target ||= valueConstantOperatorWriteNode: Target += valueConstantPathOperatorWriteNode: Parent::Child += valueConstantPathOperatorAndWriteNode: Parent::Child &&= valueConstantPathOperatorOrWriteNode: Parent::Child ||= valueGlobalVariableOperatorAndWriteNode: $target &&= valueGlobalVariableOperatorOrWriteNode: $target ||= valueGlobalVariableOperatorWriteNode: $target += valueInstanceVariableOperatorAndWriteNode: "@target &&= value"InstanceVariableOperatorOrWriteNode: "@target ||= value"InstanceVariableOperatorWriteNode: "@target += value"KeywordHashNode: "[**{}]"LocalVariableOperatorAndWriteNode: target &&= valueLocalVariableOperatorOrWriteNode: target ||= valueOrNode: left or rightRequiredDestructuredParameterNode: def foo((bar, baz)); endSourceFileNode: __FILE__SourceLineNode: __LINE__SourceEncodingNode: __ENCODING__Notes:- Entries associated with a YARP Node class indicate a formatting  failure due to #format method not being implemented for given  class; so in these cases the fix boils down to implementing format.- For these entries the sample code that's given in the entry is the  sample code from the YARP definition (config.yml), with one exception:  the sample code for KeywordHashNode is 'foo(a: b)', but for that  expression the formatting code preempts winding down to the  KeywordHashNode instance, so the lack of KeywordHashNode#format is  not triggered. The expression given for KeywordHashNode does indeed  trigger KeywordHashNode#format. (Ironically, 'foo(a: b)' still had  a formatting issue, but for a different reason.)- The aforementioned class tagged entries and the ones where  "formatting failure" is indicated raise an exception with  SyntaxTree::Formatter.format; the other cases do return but with a  bogus result.- The hash related issues (ones where the word 'hash' occurs in the label,  entries 2. to 4.) are shadowed by the first one (constant misnomer).  Without fixing the name these entries will also end up with an exception.  When the constant name is fixed, the indicated issue will be present.Tested with YARP 0eb5f7c3.
@csabahenkcsabahenk changed the base branch frommain toyarpJuly 9, 2023 11:50
@csabahenk
Copy link
Author

As the build setup does not integrate YARP (which is not even available on Rubygems.org ATM), all CI cases fail onrequire "yarp",

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@csabahenk

[8]ページ先頭

©2009-2025 Movatter.jp