Skip to content

Make the rest of flatteners functional in anticipation of #381 #392

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

Closed
wants to merge 2 commits into from

Conversation

tmcw
Copy link
Member

@tmcw tmcw commented Mar 22, 2016

cc @jfirebaugh the singleUse property of these functions will power the lint check in #381

@tmcw
Copy link
Member Author

tmcw commented Mar 22, 2016

This now hits the following lint errors:

  • When you use a tag that's "single use only" multiple times (any of the tags that flatten flattens to a non-array value)
  • When you use a combination of tags that result in something getting overwritten:
  • A "kind" tag plus explicit @kind
  • A "kind" tag with type plus explicit @type
  • A "kind" tag with name plus explicit @name or @alias

cc @jfirebaugh for the review

@jfirebaugh
Copy link
Member

I think this would be better handled in each individual flattener function, rather than in a separate lint step. Handling in the flattener function keeps the logic for a given tag in a single place, and can more easily handle cases like where both @class and @kind class appear (whichever one comes later should get linted as a conflict to the first one).

@tmcw
Copy link
Member Author

tmcw commented Mar 22, 2016

I think it'll be harder to do it that way: an important part of these messages is that they say

  • warning tag private can only be used once but is used multiple times
  • warning tag access can only be used once, but is already declared by its synonym private

They can differentiate between tags declared multiple times and those declared by a synonym. We can do that cleanly in the linting step, but not really as cleanly in the individual flatteners that only have awareness of a single tag, by design. Otherwise we'd need to do extra bookkeeping to track already-defined tags - something we can do, but I'm betting is less clean.

@jfirebaugh
Copy link
Member

Yes -- I have ideas in that vein.

Can we please hold on this for now? It's going to cause conflicts with #388 and some other parsing changes I have queued up.

@tmcw
Copy link
Member Author

tmcw commented Mar 22, 2016

Sure, will let this PR sit as-is.

@tmcw
Copy link
Member Author

tmcw commented Mar 26, 2016

Closing - I trust @jfirebaugh has a better plan for this.

@tmcw tmcw closed this Mar 26, 2016
@tmcw tmcw deleted the functional-flatten branch March 26, 2016 17:23
rhendric added a commit to rhendric/documentation that referenced this pull request Sep 15, 2022
* First draft of documentation update for v0.15 (documentationjs#421)

* First draft of documentation update for v0.15

* Describe ambiguous matches in instance chains (documentationjs#392)

* Update tool versions

* Update parsing library changelog

* Update 0.15 guides to account for `Stream.write` breaking change

Co-authored-by: sigma-andex <[email protected]>
Co-authored-by: Ryan Hendrickson <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants