Skip to content

Commit

Permalink
Create .githint.json
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamOswald authored Sep 14, 2022
1 parent 15d4fb2 commit 78cc7b8
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions .githint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"options": {
"detectPull": true
},
"checks": {
".gitignore": {
"script": "!!(tree.tree.find(t => t.path === '.gitignore'))",
"message": [
"The repository must contain a .gitignore file"
]
},
"CHANGELOG": {
"script": "!!(tree.tree.find(t => t.path === 'CHANGELOG' || t.path === 'CHANGELOG.md'))",
"message": [
"The repository must contain a CHANGELOG(.md) file"
]
},
"CODE_OF_CONDUCT": {
"script": "!!(tree.tree.find(t => t.path === 'CODE_OF_CONDUCT.md'))",
"message": [
"The repository must contain a CODE_OF_CONDUCT.md file"
]
},
"CONTRIBUTING": {
"script": "!!(tree.tree.find(t => t.path === 'CONTRIBUTING.md'))",
"message": [
"The repository must contain a CONTRIBUTING.md file"
]
},
"LICENSE": {
"script": "!!(tree.tree.find(t => t.path === 'LICENSE'))",
"message": [
"The repository must contain a LICENSE file"
]
},
"README": {
"script": "!!(tree.tree.find(t => t.path === 'README.md'))",
"message": [
"Help people interested in this repository understand your project by adding a README."
]
},
"Branch Name": {
"script": "/^((ft-)|(ch-)|(bg-))[a-z0-9\\-]+$/.test(branch.name)",
"message": [
"Branches created should be named using the following format:",
"{story type}-{2-3 word summary}",
"",
"{story type} - Indicates the context of the branch and should be one of:",
" * bg = Bug",
" * ch = Chore",
" * ft = Feature",
"",
],
"message": [
"Started, finished, fixed or delivered stories should be listed in the footer",
"prefixed with 'Finishes', 'Fixes' , or 'Delivers' keyword like this:",
"",
"[Finishes #1234567]"
]
},
"PR Title": {
"script": "/^[\\w\\s-().]+$/.test(pull.title)",
"message": [
"The PR title should be in the following format:",
"`{story description}`",
"",
"Example of a valid PR title:",
"",
"Build out REST Endpoint for Resources (CRUD)"
]
},
"PR Description": {
"script": [
"const body = pull.body",
"return body.indexOf('#### What does this PR do?') > -1",
" && body.indexOf('#### Description of task to be completed?') > -1",
" && body.indexOf('#### How should this be manually tested?') > -1",
" && body.indexOf('#### Any background context you want to provide?') > -1",
" && body.indexOf('#### What are the relevant pivotal tracker stories?') > -1",
" && body.indexOf('#### Screenshots (if appropriate)') > -1",
" && body.indexOf('#### Questions') > -1"
],
"message": [
"The description of the PR should contain the following headings",
"and corresponding content in Markdown format.",
"",
"`#### What does this PR do?`",
"`#### Description of task to be completed?`",
"`#### How should this be manually tested?`",
"`#### Any background context you want to provide?`",
"`#### What are the relevant pivotal tracker stories?`",
"`#### Screenshots (if appropriate)`",
"`#### Questions:`"
]
},
"PR 'ready' Label": {
"script": "pull.labels.length === 1 && !!(pull.labels.find(l => l.name === 'ready'))",
"message": "PR must have label 'ready'"
}
}
}

{
"options": {
"detectPull": true
},
"checks": {
"This check always passes": "true",
"A commit cannot touch more than 1 file": "commit.files.length < 2",
"The message of a head commit must match the name of the branch": [
"const commitMessage = commit.commit.message;",
"const branchName = branch.name;",
"return commitMessage === branchName;"
],
"Branch name must start with 'ft-' or 'ch-' or 'bug-' followed by stuff": {
"script": "/^((ft-)|(ch-)|(bug-))[a-z0-9\-]+$/.test(branch.name)",
"message": "The name of this branch doesn't meet the specified criteria"
},
"Only Franklin can edit the .githint.json file": {
"script": [
"let file = commit.files[0].filename",
"let editor = commit.commit.author.name",
"return (file != '.githint.json' || editor == 'Chieze Franklin');"
],
"message": "The .githint.json file shouldn't be touched; Only Franklin can edit the file."
},
"Repo must contain CONTRIBUTING.md": "tree.tree.filter(t => t.path === 'CONTRIBUTING.md').length === 1",
"A PR cannot touch more than 1 file": "pull.changed_files < 2"
}
}

0 comments on commit 78cc7b8

Please sign in to comment.