Skip to content

Setup Gitlint. #645

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
merged 3 commits into from
Mar 4, 2021
Merged

Setup Gitlint. #645

merged 3 commits into from
Mar 4, 2021

Conversation

LoopThrough-i-j
Copy link
Contributor

No description provided.

Copy link
Contributor

@neiljp neiljp left a comment

Choose a reason for hiding this comment

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

@LoopThrough-i-j This looks broadly good to me, though other than the doc updates I'd like to see noted how much is different to in zulip/zulip, and how much is a straight copy (as per my comments).

ZT settled on a slightly different commit format, but I know the API repo matches the main one. That said, I personally prefer the more explicit nature of ZT git-linting since it gives more specific feedback on what is missing/wrong. That may be a discussion for somewhere else, however.

.gitlint Outdated
@@ -0,0 +1,13 @@
[general]
ignore=title-trailing-punctuation, body-min-length, body-is-missing, title-imperative-mood
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to exclude title-imperative-mood? Is this is from zulip/zulip? It seems strange to exclude a rule that's added in the extra rules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am taking a look and trying to make the required changes. Thanks for the review.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong in zulip/zulip; see zulip/zulip#17393. Once that merges, please bring those changes into this PR.

@LoopThrough-i-j LoopThrough-i-j force-pushed the git-lint branch 2 times, most recently from 537fcf5 to 5177377 Compare January 15, 2021 22:00
@LoopThrough-i-j LoopThrough-i-j force-pushed the git-lint branch 3 times, most recently from 1889390 to 4b4f6b4 Compare February 25, 2021 01:32
@LoopThrough-i-j
Copy link
Contributor Author

@alexmv The changes are made. I think they look good to be merged now, still consider reviewing and add any more suggestions if required.

README.md Outdated
@@ -25,14 +25,18 @@ and [commit guidelines](https://zulip.readthedocs.io/en/latest/contributing/vers
1. Fork and clone the Git repo:
`git clone https://github.com/<your_username>/python-zulip-api.git`

2. Make sure you have [pip](https://pip.pypa.io/en/stable/installing/)
2. Setup upstream and fetch upstream/master (Required for Gitlint):
Copy link
Member

Choose a reason for hiding this comment

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

Let's spell it [Gitlint](https://jorisroovers.com/gitlint/)

@timabbott
Copy link
Member

timabbott commented Feb 25, 2021

For the files copied from zulip/zulip, can you add a comment noting that's the case at the top of the file? And also mention if anything has changed. Something like:

# This file is copied from the original at tools/foobar in zulip/zulip.
# Please don't edit here; instead update the zulip/zulip copy and then resync this file.

@LoopThrough-i-j LoopThrough-i-j force-pushed the git-lint branch 3 times, most recently from aa02421 to 89b7eae Compare February 25, 2021 03:29
@LoopThrough-i-j LoopThrough-i-j changed the title Lint: Setup gitlint. [WIP]Lint: Setup gitlint. Feb 25, 2021
@LoopThrough-i-j LoopThrough-i-j force-pushed the git-lint branch 2 times, most recently from 7ceb832 to 7585161 Compare February 25, 2021 04:22
@LoopThrough-i-j LoopThrough-i-j changed the title [WIP]Lint: Setup gitlint. Setup Gitlint. Feb 25, 2021
if [[ "
$(git remote -v)
" =~ '
'([^[:space:]]*)[[:space:]]*(https://github\.com/|ssh://git@github\.com/|git@github\.com:)zulip/python-zulip-api(\.git|/)?\ \(fetch\)'
Copy link
Member

Choose a reason for hiding this comment

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

Probably we should do a commit to zulip/zulip that makes the repository name a variable at the top of the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, we can do that.

Set and Fetch upstream is required for gitlint, while
setting up development env.
Setup gitlint for developers to write well formatted
commit messages.

Note: .gitlint, gitlint-rules.py and lint-commits
are taken directly from zulip/zulip with minor changes.
@timabbott timabbott merged commit c4a78d0 into zulip:master Mar 4, 2021
@timabbott
Copy link
Member

Resolved the minor merge conflict when rebasing and merged, thanks @LoopThrough-i-j!

One thing I noticed is that mypy prints a bunch of debug output that it doesn't on zulip/zulip; can you look into whatever flag we need to suppress that?

mypy      | Running mypy for `zulip`.
mypy      | Success: no issues found in 69 source files
mypy      | Running mypy for `zulip_bots`.
mypy      | Success: no issues found in 75 source files
mypy      | Running mypy for `zulip_botserver`.
mypy      | Success: no issues found in 7 source files
mypy      | Running mypy for `tools`.
mypy      | Success: no issues found in 2 source files

@LoopThrough-i-j
Copy link
Contributor Author

Sure will check and push a fix. Thanks for the merge.

@@ -15,6 +15,7 @@ EXCLUDED_FILES = [
def run() -> None:
parser = argparse.ArgumentParser()
add_default_linter_arguments(parser)
parser.add_argument('--no-gitlint', action='store_true', help='Disable gitlint')
Copy link
Member

Choose a reason for hiding this comment

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

zulint already has an option for this: #659.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will create a PR soon, fixing the required changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants