Skip to content
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

README: Split out Commit Style notes into an expanded section. #1055

Merged
merged 1 commit into from
Jun 26, 2021

Conversation

neiljp
Copy link
Collaborator

@neiljp neiljp commented Jun 24, 2021

Link to Commit Style (GitLint) sections updated.

@neiljp neiljp added the area: documentation Requires changes in documentation label Jun 24, 2021
@zulipbot zulipbot added the size: M [Automatic label added by zulipbot] label Jun 24, 2021
@prah23
Copy link
Member

prah23 commented Jun 25, 2021

Thanks for doing this, @neiljp, the section looks good!
I had a quick suggestion for the commit message body aspect, there seems to be no mention of that. Since we're emphasizing on commit style in it's own section, I think a short description/pointers on what we expect in a commit message's body would be useful to point new contributors to. I'd suggest points like:

  • Why a feature is being added in a commit; a brief explanation on how as well.
  • In case of bug-fixes, what went wrong prior to the commit and how the commit fixes it (in detail).
  • Nuances to the commit that are missed in the commit title.

Copy link
Member

@preetmishra preetmishra left a comment

Choose a reason for hiding this comment

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

@neiljp Thanks for pushing this in. It looks good! 👍 I have left two minor concerns as in-line comments. Re the commit body, I believe we pretty much follow the Zulip version control guidelines, so a link to the docs would be sufficient.


If you plan to submit git commits in pull-requests (PRs), then we highly suggest installing the `gitlint` commit-message hook by running `gitlint install-hook` (or `pipenv run gitlint install-hook` with pipenv setups). While the content still depends upon your writing skills, this ensures a more consistent formatting structure between commits, including by different authors.

If the hook is installed as described above, then after completing the text for a commit, it will be checked by gitlint against the style we have set up, and will offer advice if there are any issues it notices. If gitlint finds any, it will ask if you wish to commit with the message as it is (`y` for 'yes'), stop the commit process (`n` for 'no'), or edit the commit message (`e` for 'edit').

Other gitlint options are available; for example it is possible to apply it to a range of commits with the `--commits` option, eg. `gitlint --commits HEAD~2..HEAD` would apply it to the last few commits.

**NOTE** Not all style suggestions are identified by gitlint at this time, including:
* If modifying code (not just tests), list modified filenames without extensions between slashes in only one area of the commit title (eg. `run/model/core/README: Some description.`)
* If modifying tests in addition to code, just note this in the body of the commit after a blank line (eg. `Tests updated.`)
Copy link
Member

Choose a reason for hiding this comment

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

We don't check for this in the GitLint, right? Should we keep it here in the README?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Some of these are mentioned in the new section, so how about adjusting the trailing sentence of that from:

To make it easier to meet these style guidelines we recommend installing GitLint - see the next section!

to

To aid in satisfying some of these rules you can use `GitLint`, as described in the following section.
**However**, please check your commits manually versus these style rules, since GitLint cannot check everything - or language or grammar!

Copy link
Member

Choose a reason for hiding this comment

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

That sounds good! 👍


Our commit titles have slight variations from the general Zulip style, with each:
* starting with one or more areas in lower case, followed by a colon and space
* area being slash-separated modified files without extensions, or the type of the change
Copy link
Member

Choose a reason for hiding this comment

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

Should we recommend filenames (and areas) in an alphabetically sorted fashion, so that the git log is more consistent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know that some contributors do this, but there are various rules we could use for ordering, and I think it's best to not impose even more rules on contributors in this way? I'm not sure what we gain in alphabetical ordering that isn't achievable with eg. some kind of grep. We could sort by "size of change in file contents" or others - and they all impose various extra work which can be determined otherwise.

Instead we could explicitly mention that the order doesn't matter?

(listing files already impose extra burden, but help summarize what has changed quickly in the log titles - and too many entries sometimes indicates if a commit is too complicated - if it's not a refactor, for example)

Copy link
Member

Choose a reason for hiding this comment

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

Right, that does add a bit of resistance; seems reasonable. 👍 We could mention that the order doesn't matter if needed later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

as per PM I've slightly hinted that order isn't important in the first example commit title :)

@neiljp
Copy link
Collaborator Author

neiljp commented Jun 26, 2021

@prah23 Should I leave a commit message content follow-up to you?

Link to Commit Style (GitLint) sections updated.
@neiljp
Copy link
Collaborator Author

neiljp commented Jun 26, 2021

Updated per feedback. Hope to merge in the next <24h.

@prah23
Copy link
Member

prah23 commented Jun 26, 2021

Sure, I'll write it and open another PR.

@neiljp
Copy link
Collaborator Author

neiljp commented Jun 26, 2021

OK, let's get this merged - feel free to discuss and update while I'm away so we can help clarify anything else people have noticed 👍

@neiljp neiljp merged commit fb0160f into zulip:main Jun 26, 2021
@neiljp neiljp added this to the Next Release milestone Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: documentation Requires changes in documentation size: M [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants