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

✨ Add support for Phabricator as a code review system #1884

Merged
merged 3 commits into from May 5, 2022
Merged

✨ Add support for Phabricator as a code review system #1884

merged 3 commits into from May 5, 2022

Conversation

vihangm
Copy link
Contributor

@vihangm vihangm commented May 4, 2022

What kind of change does this PR introduce?

Supports the "Reviewed By" field used by Phabricator to check if a repo uses Phabricator as their code review system.

What is the current behavior?

Repos that use Phabricator are marked as not requiring code review.

What is the new behavior (if this is a feature change)?**

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Fixes #1883

Special notes for your reviewer

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

Repositories using Phabricator will now pass the Code review check.

@vihangm vihangm temporarily deployed to integration-test May 4, 2022 05:01 Inactive
@github-actions
Copy link

github-actions bot commented May 4, 2022

Integration tests success for
[1e2116b]
(https://github.com/ossf/scorecard/actions/runs/2267833904)

@codecov
Copy link

codecov bot commented May 4, 2022

Codecov Report

Merging #1884 (aef4781) into main (f779fb8) will increase coverage by 2.93%.
The diff coverage is 44.00%.

@@            Coverage Diff             @@
##             main    #1884      +/-   ##
==========================================
+ Coverage   51.42%   54.36%   +2.93%     
==========================================
  Files          79       79              
  Lines        6709     6729      +20     
==========================================
+ Hits         3450     3658     +208     
+ Misses       3031     2834     -197     
- Partials      228      237       +9     

Copy link
Contributor

@azeemshaikh38 azeemshaikh38 left a comment

Choose a reason for hiding this comment

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

Looks like we don't check for anything Gerrit or Phabricator specific in our code at all. Wonder, if we should generalize this to:

reviewPlatformCommitMsg = "ReviewedCommitMessage"

func hasCommitMsgReview() bool {
  regexpMatch, reviewedBy := regexp.Match("\nReviewed By: (\S+)")
  if regexpMatch {
    // Log reviewedBy
  }
  regexpMatch, reviewedOn := regexp.Match("\nReviewed On: (\S+)")
  if regexpMatch {
    // Log reviewedOn
  }
}

Note that above is mostly pseudo-code. @laurentsimon wdyt?

@laurentsimon
Copy link
Contributor

Looks like we don't check for anything Gerrit or Phabricator specific in our code at all. Wonder, if we should generalize this to:

reviewPlatformCommitMsg = "ReviewedCommitMessage"

func hasCommitMsgReview() bool {
  regexpMatch, reviewedBy := regexp.Match("\nReviewed By: (\S+)")
  if regexpMatch {
    // Log reviewedBy
  }
  regexpMatch, reviewedOn := regexp.Match("\nReviewed On: (\S+)")
  if regexpMatch {
    // Log reviewedOn
  }
}

Note that above is mostly pseudo-code. @laurentsimon wdyt?

I don't mind improving it.

@vihangm
Copy link
Contributor Author

vihangm commented May 4, 2022

Happy to generalize it.
I also realized that I could do some validation to check if the review system is actually Phabricator by looking for the Differential Revision: field.
LMK which one you prefer.

@laurentsimon
Copy link
Contributor

Happy to generalize it. I also realized that I could do some validation to check if the review system is actually Phabricator by looking for the Differential Revision: field. LMK which one you prefer.

Looking for Differential Revision: would be great if it allows us to differentiate with Gerrit - I'm not super familiar with any of the reviewing system, to be completely honest.

@vihangm
Copy link
Contributor Author

vihangm commented May 4, 2022

Happy to generalize it. I also realized that I could do some validation to check if the review system is actually Phabricator by looking for the Differential Revision: field. LMK which one you prefer.

Looking for Differential Revision: would be great if it allows us to differentiate with Gerrit - I'm not super familiar with any of the reviewing system, to be completely honest.

Yeah, let me actually add the additional check.

@vihangm vihangm temporarily deployed to integration-test May 4, 2022 16:53 Inactive
@github-actions
Copy link

github-actions bot commented May 4, 2022

Integration tests success for
[366844a]
(https://github.com/ossf/scorecard/actions/runs/2271150139)

@vihangm vihangm temporarily deployed to integration-test May 4, 2022 17:51 Inactive
@github-actions
Copy link

github-actions bot commented May 4, 2022

Integration tests success for
[ae51622]
(https://github.com/ossf/scorecard/actions/runs/2271422626)

Copy link
Contributor

@azeemshaikh38 azeemshaikh38 left a comment

Choose a reason for hiding this comment

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

Thanks!

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>
…abricator

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>
Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>
@vihangm vihangm temporarily deployed to integration-test May 5, 2022 16:57 Inactive
@github-actions
Copy link

github-actions bot commented May 5, 2022

Integration tests success for
[aef4781]
(https://github.com/ossf/scorecard/actions/runs/2277095696)

@azeemshaikh38 azeemshaikh38 enabled auto-merge (squash) May 5, 2022 21:40
@azeemshaikh38 azeemshaikh38 merged commit 72086c9 into ossf:main May 5, 2022
@vihangm vihangm deleted the phabricator branch May 5, 2022 22:12
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.

Support Phabricator as a Code Review tool
3 participants