Skip to content

Change to comply with documentation standards #9088

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 1 commit into from
Closed

Change to comply with documentation standards #9088

wants to merge 1 commit into from

Conversation

adursun
Copy link
Contributor

@adursun adursun commented Jan 20, 2018

Some verbs didn't follow documentation standards written here.

@javiereguiluz
Copy link
Member

I'm not strongly against this change ... but I can't find where this is recommended in the link you shared. Besides, we use this style in hundreds of examples across the doc, so it'd be almost impossible to fix everything.

Now a personal opinion: I like the current style because it's easier to understand for me:

  • return a string ... looks like: "you should return a string here"
  • returns a string ... looks like: "the result of executing this code is that a string is returned"

@adursun
Copy link
Contributor Author

adursun commented Jan 21, 2018

As you said, both styles are used in the documentation. There are inconsistencies, especially here, but I am not sure it is worth changing all of them.

In my opinion, the correct style depends on the communication between the documentation and the reader. If the documentation tells the reader what to do, you return version should be used. If the documentation describes methods or statements to the reader, it returns version should be used.

@javiereguiluz
Copy link
Member

OK, so we should fix this inconsistency. I propose to use everywhere returns a string... instead of return a string... What do other doc maintainers think? @wouterj @xabbuh Thanks!

Note: whatever the decision, we should make those changes in 2.7 branch (the oldest maintained branch) and then we'll merge fixes up to the other branches. Thanks!

@xabbuh xabbuh added this to the 2.7 milestone Jan 30, 2018
@@ -181,7 +181,7 @@ If you're serving HTML, you'll want to render a template. The ``render()``
method renders a template **and** puts that content into a ``Response``
object for you::

// renders templates/lucky/number.html.twig
// render templates/lucky/number.html.twig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the previous style. @javiereguiluz explained that quite well. This comment explains what the code below does, not what you as a developer should do.

@javiereguiluz
Copy link
Member

Given the comments from the doc maintainers, we've decided to make code comments consistent. We've created #9194 to do that, so we're closing this one. @adursun even if your pull request wasn't merged, it helped us to find this inconsistency and fix it. Thank you!

javiereguiluz added a commit that referenced this pull request Feb 5, 2018
This PR was merged into the 2.7 branch.

Discussion
----------

Make code comments consistent

This finishes #9088 by doing the opposite change: when the comment describes what the code does instead of what the user must do, use the format: `// returns a ...`  instead of `// return a ...`

Commits
-------

a439f63 Make code comments consistent
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.

4 participants