Repository navigation
Allow acceptable long lines to suppress warnings #1872
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
Merged
+51
−6
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System.Collections.Immutable; | ||
|
|
||
| namespace MarkdownConverter.Converter; | ||
|
|
||
| /// <summary> | ||
| /// Aspects of configuration which are hard-coded for convenience, but could be extracted later. | ||
| /// </summary> | ||
| public static class HardCodedConfig | ||
| { | ||
| // Long lines that are either known to actually be okay in the Word output, or | ||
| // are acceptable and better than trying to break them. These do not issue warnings. | ||
| public static ImmutableList<string> AcceptedLongLines = new List<string> | ||
| { | ||
| // expressions.md (12.8.11 Null Conditional Invocation Expression) and grammar.md | ||
| // These genuinely wrap, but that's better than breaking the lines. | ||
| " : null_conditional_member_access null_forgiving_operator? '(' argument_list? ')'", | ||
| " | null_conditional_element_access null_forgiving_operator? '(' argument_list? ')'", | ||
| // expressions.md (12.8.22 Stack allocation) and grammar.md | ||
| // Again, genuinely wrapping but better than breaking lines. | ||
| " | 'stackalloc' unmanaged_type? '[' constant_expression? ']' stackalloc_initializer", | ||
| // classes.md (15.2.5 Type parameter constraints) | ||
| // This doesn't end up wrapping. | ||
| " // nonnullable base class requirement allows nonnullable class type argument", | ||
| }.ToImmutableList(); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I might consider here is adding a comment stating which clause (in expressions.md) that these productions appear.
I agree this feels like a hack in some ways, but I like the design in that if we edit those lines, suddenly warnings appear and we need to look to see if the new content works. The only stale risk is if we shorten these lines and they remain forever as unneeded accepted long lines.
Noting where they are in the standard might entice us to remove those no longer needed while editing any that changed. (We're just detailed enough to consider it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added more detail for the location in a separate commit - not just the number, but the title, so it's easier to find if we renumber.
I did wonder about checking at the end of the conversion whether every long line listed for the file that's being converted ended up being used... but it felt like overengineering in the end. Can explore that if you'd like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that's more than we need. Let's