Skip to content

Commit

Permalink
Merge branch 'add_pair_connectors' of 'https://github.com/zhquan/Grim…
Browse files Browse the repository at this point in the history
…oireELK'

Merges #1060
Closes #1060
  • Loading branch information
zhquan committed Jun 3, 2022
2 parents 7be9add + e2dc096 commit d20bedc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion grimoire_elk/enriched/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class GitEnrich(Enrich):

# REGEX to extract authors from a multi author commit: several authors present
# in the Author field in the commit. Used if self.pair_programming is True
AUTHOR_P2P_REGEX = re.compile(r'(?P<first_authors>.* .*) and (?P<last_author>.* .*) (?P<email>.*)')
AUTHOR_P2P_REGEX = re.compile(r'(?P<first_authors>.* .*) ([aA][nN][dD]|&|\+) (?P<last_author>.* .*) (?P<email>.*)')
AUTHOR_P2P_NEW_REGEX = re.compile(r"Co-authored-by:(?P<first_authors>.* .*)<(?P<email>.*)>\n?")

# REGEX to extract authors from the commit
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Pair programming regular expression improvement
category: fixed
author: Quan Zhou <[email protected]>
issue: null
notes: >
The regular expression to detect pair programming authors in git
datasource has been improved adding more connectors.
The following list shows the current connectors:
- `[aA][nN][dD]`
- `&`
- `+`
12 changes: 6 additions & 6 deletions tests/data/git.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
"backend_version": "0.8.10",
"category": "commit",
"data": {
"Author": "Eduardo Morais <[email protected]>",
"Author": "Eduardo Morais & Zhongpeng Lin <[email protected]>",
"AuthorDate": "Tue Aug 14 14:33:27 2012 -0300",
"Commit": "Eduardo Morais <[email protected]>",
"Commit": "Eduardo Morais & Zhongpeng Lin <[email protected]>",
"CommitDate": "Tue Aug 14 14:33:27 2012 -0300",
"commit": "7debcf8a2f57f86663809c58b5c07a398be7674c",
"files": [
Expand Down Expand Up @@ -147,9 +147,9 @@
"backend_version": "0.8.10",
"category": "commit",
"data": {
"Author": "Eduardo Morais <[email protected]>",
"Author": "Eduardo Morais + Zhongpeng Lin <[email protected]>",
"AuthorDate": "Tue Aug 14 14:35:02 2012 -0300",
"Commit": "Eduardo Morais <[email protected]>",
"Commit": "Eduardo Morais + Zhongpeng Lin <[email protected]>",
"CommitDate": "Tue Aug 14 14:35:02 2012 -0300",
"commit": "c0d66f92a95e31c77be08dc9d0f11a16715d1885",
"files": [
Expand Down Expand Up @@ -200,9 +200,9 @@
"backend_version": "0.8.10",
"category": "commit",
"data": {
"Author": "Eduardo Morais <[email protected]>",
"Author": "Eduardo Morais And Zhongpeng Lin <[email protected]>",
"AuthorDate": "Tue Aug 14 14:45:51 2012 -0300",
"Commit": "Eduardo Morais <[email protected]>",
"Commit": "Eduardo Morais And Zhongpeng Lin <[email protected]>",
"CommitDate": "Tue Aug 14 14:45:51 2012 -0300",
"commit": "c6ba8f7a1058db3e6b4bc6f1090e932b107605fb",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion tests/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_raw_to_enrich_pair_programming(self):

result = self._test_raw_to_enrich(pair_programming=True)
self.assertEqual(result['raw'], 11)
self.assertEqual(result['enrich'], 13)
self.assertEqual(result['enrich'], 16)

enrich_backend = self.connectors[self.connector][2](pair_programming=True)
url = self.es_con + "/" + self.enrich_index + "/_search?size=20"
Expand Down

0 comments on commit d20bedc

Please sign in to comment.