@toptal/davinci-ci 1.13.4-alpha-fx-upgrade-stylelint-rules.1335 → 1.13.4-alpha-fix-testid-eslint-rule-bug.1335

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-ci",
3
- "version": "1.13.4-alpha-fx-upgrade-stylelint-rules.1335+72109f9",
3
+ "version": "1.13.4-alpha-fix-testid-eslint-rule-bug.1335+94c355e",
4
4
  "description": "Continuos integrations tools for frontend projects",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -32,9 +32,9 @@
32
32
  "dependencies": {
33
33
  "@commitlint/cli": "^12.1.4",
34
34
  "@commitlint/config-conventional": "^12.1.4",
35
- "@toptal/davinci-cli-shared": "1.4.2-alpha-fx-upgrade-stylelint-rules.1335+72109f9",
35
+ "@toptal/davinci-cli-shared": "1.4.2-alpha-fix-testid-eslint-rule-bug.1335+94c355e",
36
36
  "danger": "^10.7.1",
37
37
  "markdown-table": "^2.0.0"
38
38
  },
39
- "gitHead": "72109f93ee9cf82099b24934b322929fe3e9b883"
39
+ "gitHead": "94c355e157c825baf75e8de94c43766d1c4cd8e1"
40
40
  }
@@ -1,6 +1,12 @@
1
1
  const WHITELISTED_USERS = ['dependabot-preview[bot]', 'dependabot[bot]', 'toptal-devbot']
2
2
  const VALID_PR_CODE_REGEX = /\[[A-Z]{1,4}-.*]\s/
3
- const VALID_COMMIT_MESSAGE_REGEX = /^[A-Z]\w[^.\n]*[^.\s](\n\n(.|\n)*)*$/
3
+ // Valid commit titles:
4
+ // "Regular commit message"
5
+ // "Commit with sentence. But does not end with a full-stop"
6
+ // "[FOO-1234] Commit with prefix"
7
+ // "[FOO] Prefix numbers can be omitted"
8
+ // "[FOO][BAR] Prefixes can couple"
9
+ const VALID_COMMIT_TITLE_REGEX = /^((\[[A-Z]+(-\d+)?])+ )?[A-Z]\w[^\n]*[^.]$/
4
10
  const MAX_COMMIT_LINE_LENGTH = 79
5
11
  const ENGINEERING_DOCS_LINK =
6
12
  'https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/210665897/Commit+Message+Quality'
@@ -14,7 +20,7 @@ module.exports = {
14
20
  ENGINEERING_DOCS_LINK,
15
21
  MAX_COMMIT_LINE_LENGTH,
16
22
  MISSING_TICKET_CODE_ERROR_MESSAGE,
17
- VALID_COMMIT_MESSAGE_REGEX,
23
+ VALID_COMMIT_TITLE_REGEX,
18
24
  VALID_PR_CODE_REGEX,
19
25
  WHITELISTED_USERS
20
26
  }
@@ -1,6 +1,6 @@
1
1
  const {
2
2
  MAX_COMMIT_LINE_LENGTH,
3
- VALID_COMMIT_MESSAGE_REGEX,
3
+ VALID_COMMIT_TITLE_REGEX,
4
4
  WHITELISTED_USERS
5
5
  } = require('../../config')
6
6
 
@@ -8,14 +8,20 @@ const validateCommitMessage = message => {
8
8
  const errors = []
9
9
  const [title = '', body = ''] = message.split(/\n\n/)
10
10
  const bodyLines = body.split(/\n/)
11
- const isFormatValid = VALID_COMMIT_MESSAGE_REGEX.test(message)
11
+ const isTitleFormatValid = VALID_COMMIT_TITLE_REGEX.test(title)
12
12
  const isTitleLengthValid = title.length <= MAX_COMMIT_LINE_LENGTH
13
13
  const isBodyLinesLengthValid = bodyLines.every(
14
14
  line => line.length <= MAX_COMMIT_LINE_LENGTH
15
15
  )
16
16
 
17
- if (!isFormatValid) {
18
- errors.push('- format of commit title or body is not correct')
17
+ if (!isTitleFormatValid) {
18
+ errors.push(`- format of commit title is not correct ([read more](https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/210665897/Commit+Message+Quality)):
19
+ - Title should start with capital letter
20
+ - Title should not end with a full-stop (i.e .)\n
21
+ Example of a valid commit title:
22
+ - Regular commit message
23
+ - [FOO-1234] Commit with prefix
24
+ - [FOO][BAR] Coupled prefixes`)
19
25
  }
20
26
 
21
27
  if (!isTitleLengthValid) {
@@ -1,5 +1,5 @@
1
1
  const {
2
- VALID_COMMIT_MESSAGE_REGEX,
2
+ VALID_COMMIT_TITLE_REGEX,
3
3
  VALID_PR_CODE_REGEX,
4
4
  WHITELISTED_USERS,
5
5
  DEFAULT_PR_TITLE_ERROR_MESSAGE,
@@ -47,7 +47,7 @@ const toptalPRTitle = () => {
47
47
  }
48
48
 
49
49
  const titleText = splitTitle[splitTitle.length - 1]
50
- const isTitleFormatValid = VALID_COMMIT_MESSAGE_REGEX.test(titleText)
50
+ const isTitleFormatValid = VALID_COMMIT_TITLE_REGEX.test(titleText)
51
51
 
52
52
  if (!isTitleFormatValid) {
53
53
  showError()