wtfautolayout icon indicating copy to clipboard operation
wtfautolayout copied to clipboard

Parse issue

Open lukaskollmer opened this issue 4 years ago • 5 comments

input:

(
    "<NSLayoutConstraint:0x60000012ddb0 H:|-(0)-[UIStackView:0x7ff97e680770]   (active, names: '|':_TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0 )>",
    "<NSLayoutConstraint:0x600000114d70 UIView:0x7ff97e604940.width == 1   (active)>",
    "<NSLayoutConstraint:0x6000001180f0 (_TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading - UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading) == 0.5*(UIView:0x7ff97e6ae5f0.leading - UIView:0x7ff97e604940.trailing)   (active, names: _TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading:0x600003736480, UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading:0x600003734380, UIView:0x7ff97e6ae5f0.leading:0x60000386dc40, UIView:0x7ff97e604940.trailing:0x60000386dc00 )>",
    "<NSLayoutConstraint:0x60000012d680 H:|-(0)-[UILayoutGuide:0x600001b62a00'ModuleName.CustomLayoutGuide2']   (active, names: '|':ModuleName.CustomView1:0x7ff97e6803f0 )>",
    "<NSLayoutConstraint:0x60000012cb90 H:|-(0)-[UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1']   (active, names: '|':ModuleName.CustomView1:0x7ff97e6803f0 )>",
    "<NSLayoutConstraint:0x60000011a940 UILayoutGuide:0x600001b62a00'ModuleName.CustomLayoutGuide2'.leading == CustomView2:0x7ff98014d050.leading   (active)>",
    "<NSLayoutConstraint:0x60000011aa30 CustomView2:0x7ff98014d050.leading == UIView:0x7ff97e6ae5f0.leading   (active)>",
    "<NSLayoutConstraint:0x600000116030 'UISV-canvas-connection' UIStackView:0x7ff97e680770.leading == UIView:0x7ff97e604940.leading   (active)>",
    "<NSLayoutConstraint:0x600000116120 'UISV-distributing-edge' H:[UIView:0x7ff97e604940]-(0)-[_UIOLAGapGuide:0x600001e69100'UISV-distributing']   (active)>",
    "<NSLayoutConstraint:0x600000116170 'UISV-distributing-edge' _UIOLAGapGuide:0x600001e69100'UISV-distributing'.trailing == UIView:0x7ff97e6ae5f0.leading   (active)>"
)

output:

Line 4, Column 41
    "<NSLayoutConstraint:0x6000001180f0 (_TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading - UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading) == 0.5*(UIView:0x7ff97e6ae5f0.leading - UIView:0x7ff97e604940.trailing)   (active, names: _TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading:0x600003736480, UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading:0x600003734380, UIView:0x7ff97e6ae5f0.leading:0x60000386dc40, UIView:0x7ff97e604940.trailing:0x60000386dc00 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: whitespace in constraint instance
Expected: 'h' in constraint instance.autoresizing mask info.h=
Expected: ''' in constraint instance.identifier
Expected: whitespace
Expected: ':' in instance
Expected: valid class name character in instance
Expected: '.' in dot attribute
Expected: valid partial identifier character
Expected: 'H'
Expected: 'V'

I'm using -[NSLayoutXAxisAnchor anchorWithOffsetToAnchor:], that seems to be the line the parser can't handle

lukaskollmer avatar Dec 11 '20 19:12 lukaskollmer

Thanks for raising this issue. You're right that the parser doesn't currently handle the output of constraints made that way, but I believe that support can be added.

johnpatrickmorgan avatar Dec 15 '20 09:12 johnpatrickmorgan

just put some example of similar constraint if you will want to fix it "<NSLayoutConstraint:0x600001531db0 (UIView:0x7fa34581bb50.trailing - UIView:0x7fa345816710.trailing) >= (UIView:0x7fa34580f1d0.trailing - UIView:0x7fa345816710.trailing) (active, names: UIView:0x7fa34581bb50.trailing:0x600002ce1d00, UIView:0x7fa345816710.trailing:0x600002ce1d80, UIView:0x7fa34580f1d0.trailing:0x600002ce1d40 )>",

romdevios avatar Aug 24 '22 13:08 romdevios

Before I open a new issue...wtfautolayout doesn't seem to work with Xcode 14 at all, and I'm wondering if this is the same issue. Example constraints:

(
    "<NSAutoresizingMaskLayoutConstraint:0x600003757390 h=-&- v=-&- Conversations.FeedSocialCountCell:0x7f90cc9a87c0.minY == 0   (active, names: '|':UIView:0x7f90cc9a8490 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000037573e0 h=-&- v=-&- V:[Conversations.FeedSocialCountCell:0x7f90cc9a87c0]-(0)-|   (active, names: '|':UIView:0x7f90cc9a8490 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x600003757520 h=--& v=--& UIView:0x7f90cc9a8490.height == 0   (active)>",
    "<NSLayoutConstraint:0x60000375dcc0 12600urn:li:fs_updateV2:(....height == Conversations.FeedSocialCountCell:0x7f90cc9a87c0.height   (active, names: 12600urn:li:fs_updateV2:(...:0x7f90cc9a9710 )>",
    "<NSLayoutConstraint:0x60000375ef30 reactions_like_consumptio....height == 16   (active, names: reactions_like_consumptio...:0x7f90cc9aaf50 )>",
    "<NSLayoutConstraint:0x60000375e850 'LINStackView-bottom-0-UIView-bottom' 12601urn:li:fs_updateV2:(....bottom == 12600urn:li:fs_updateV2:(....bottom   (active, names: 12601urn:li:fs_updateV2:(...:0x7f90cc9a9880, 12600urn:li:fs_updateV2:(...:0x7f90cc9a9710 )>",
    "<NSLayoutConstraint:0x60000375e580 'LINStackView-top-0-UIView-top' V:|-(0)-[12601urn:li:fs_updateV2:(...]   (active, names: 12601urn:li:fs_updateV2:(...:0x7f90cc9a9880, 12600urn:li:fs_updateV2:(...:0x7f90cc9a9710, '|':12600urn:li:fs_updateV2:(...:0x7f90cc9a9710 )>",
    "<NSLayoutConstraint:0x6000037569e0 'UISV-canvas-connection' 12601urn:li:fs_updateV2:(....top == _UILayoutSpacer:0x600002ff2df0'UISV-alignment-spanner'.top   (active, names: 12601urn:li:fs_updateV2:(...:0x7f90cc9a9880 )>",
    "<NSLayoutConstraint:0x600003756bc0 'UISV-canvas-connection' 12601urn:li:fs_updateV2:(....centerY == reactions_like_consumptio....centerY   (active, names: 12601urn:li:fs_updateV2:(...:0x7f90cc9a9880, reactions_like_consumptio...:0x7f90cc9aaf50 )>",
    "<NSLayoutConstraint:0x600003756800 'UISV-spanning-boundary' _UILayoutSpacer:0x600002ff2df0'UISV-alignment-spanner'.top <= reactions_like_consumptio....top   (active, names: reactions_like_consumptio...:0x7f90cc9aaf50 )>"
)

Just gives parsing error:

Line 5, Column 50
    "<NSLayoutConstraint:0x60000375dcc0 12600urn:li:fs_updateV2:(....height == Conversations.FeedSocialCountCell:0x7f90cc9a87c0.height   (active, names: 12600urn:li:fs_updateV2:(...:0x7f90cc9a9710 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: '0' in instance.memory address.0x

brokenalarms avatar Oct 27 '22 21:10 brokenalarms

Hi @brokenalarms! The issue with that input is that one of the views' identifiers (12600urn:li:fs_updateV2:(...) contains both : and (, both of which cause issues for the parser. Removing those characters in the view's identifier allows the log to be parsed correctly.

johnpatrickmorgan avatar Oct 27 '22 22:10 johnpatrickmorgan

Thanks for the answer @johnpatrickmorgan! Nearly all of our identifiers use this terminology for namespacing though, so was hoping there would be a fix in sight for the parser to accept a valid identifier, versus the identifiers needing to conform to a specific naming subset that the parser allows :( Good to know anyway.

brokenalarms avatar Nov 28 '22 20:11 brokenalarms