Checkstyle: Catch wide snippets#34163
Merged
nik9000 merged 3 commits intoelastic:masterfrom Oct 1, 2018
Merged
Conversation
We use wrap code in `// tag` and `//end` to include it in our docs. Our current docs style wraps code snippets in a box that is only wide enough for 76 characters and adds a horizontal scroll bar for wider snippets which makes the snippet much harder to read. This adds a checkstyle check that looks for java code that is included in the docs and is wider than that 76 characters so all snippets fit into the box. It solves many of the failures that this catches but suppresses many more. I will clean those up in a follow up change.
Collaborator
|
Pinging @elastic/es-core-infra |
nik9000
commented
Sep 28, 2018
|
|
||
| //tag::rest-client-init | ||
| RestClient restClient = RestClient.builder( | ||
| new HttpHost("localhost", 9200, "http"), |
Member
Author
There was a problem hiding this comment.
Usually I prefer 8 spaces for this kind of thing but I switched the snippets over to 4 to make the snippets fit in the box more easily.
Member
Author
|
The build failure is sneaky. It fails because of the example test builds. I'll fix. |
Member
Author
|
Thanks for reviewing @rjernst! I've merged to master and am backporting now. |
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Oct 1, 2018
This further applies the pattern set in elastic#34125 to reduce copy-and-paste in the single document CRUD portion of the High Level REST Client docs. It also adds line wraps to snippets that are too wide to fit into the box when rendered in the docs, following up on the work started in elastic#34163.
nik9000
added a commit
that referenced
this pull request
Oct 2, 2018
We use wrap code in `// tag` and `//end` to include it in our docs. Our current docs style wraps code snippets in a box that is only wide enough for 76 characters and adds a horizontal scroll bar for wider snippets which makes the snippet much harder to read. This adds a checkstyle check that looks for java code that is included in the docs and is wider than that 76 characters so all snippets fit into the box. It solves many of the failures that this catches but suppresses many more. I will clean those up in a follow up change.
kcm
pushed a commit
that referenced
this pull request
Oct 30, 2018
We use wrap code in `// tag` and `//end` to include it in our docs. Our current docs style wraps code snippets in a box that is only wide enough for 76 characters and adds a horizontal scroll bar for wider snippets which makes the snippet much harder to read. This adds a checkstyle check that looks for java code that is included in the docs and is wider than that 76 characters so all snippets fit into the box. It solves many of the failures that this catches but suppresses many more. I will clean those up in a follow up change.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We use wrap code in
// tagand//endto include it in our docs. Ourcurrent docs style wraps code snippets in a box that is only wide enough
for 76 characters and adds a horizontal scroll bar for wider snippets
which makes the snippet much harder to read. This adds a checkstyle check
that looks for java code that is included in the docs and is wider than
that 76 characters so all snippets fit into the box. It solves many of
the failures that this catches but suppresses many more. I will clean
those up in a follow up change.