Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from PrestaShop/boom-1597-commit-name-validation
Browse files Browse the repository at this point in the history
Introduced Commit name validator
  • Loading branch information
mickaelandrieu authored Oct 17, 2016
2 parents 85e96ec + 784cc74 commit 40bdb37
Show file tree
Hide file tree
Showing 18 changed files with 473 additions and 78 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
var/bootstrap.php.cache
var/bootstrap.php.cache
web/config.php
35 changes: 35 additions & 0 deletions app/Resources/views/markdown/pr_commit_name_nok.md.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!-- PR_COMMIT_NAME_ERROR -->
Hi!

These(s) commit(s) name(s) seems to be incomplete or malformed, regarding our [guidelines](http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message):

{% if commits|length > 1 %}
<table>
<tr>
<th>Malformed commits</th>
</tr>
{% for commit in commits %}
<tr>
<td>{{ commit }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>`{{ commits[0] }}` is malformed or incomplete.</p>
{% endif %}

A valid commit name can be, for instance:

```
BO: Shows company in BO search if B2B is enabled
```

Would you mind to amend your commits' names?

To do this, open a command line window and use `git commit --amend` for the commit's name. See [GitHub's help page](https://help.github.com/articles/changing-a-commit-message/) for more information.

_Note: this **must** be done via the command line: you can't do this just by changing the title of the pull-request from the GitHub interface!_ :)

Thank you!

(note: this is an automated message, but answering it will reach a real human )
1 change: 1 addition & 0 deletions app/Resources/views/markdown/pr_table_errors.md.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- PR_TABLE_DESCRIPTION_ERROR -->
Hi!

Your pull request description seems to be incomplete or malformed:
Expand Down
27 changes: 24 additions & 3 deletions app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
class: Github\Api\Issue
factory: ['@app.github.client', api]
arguments: [issue]

app.github.comments_api:
class: Github\Api\Issue\Comments
factory: ['@app.github.issues_api', comments]
Expand All @@ -34,7 +34,7 @@ services:
class: Github\Api\Repo
factory: ['@app.github.client', api]
arguments: [repository]

app.github.organizations_api:
class: Github\Api\Organization
factory: ['@app.github.client', api]
Expand All @@ -49,6 +49,15 @@ services:
class: Github\Api\Issue\Labels
factory: ['@app.github.issues_api', labels]

app.github.gitdata_api:
class: Github\Api\GitData
factory: ['@app.github.client', api]
arguments: [gitData]

app.github.commits_api:
class: Github\Api\GitData\Commits
factory: ['@app.github.gitdata_api', commits]

# Application GitHub API

app.github.cached_labels_api:
Expand All @@ -75,7 +84,11 @@ services:

app.pullrequest_listener:
class: AppBundle\PullRequests\Listener
arguments: ['@app.comment_api', '@validator', '@app.pull_request.repository']
arguments:
- '@app.comment_api'
- '@app.commit.repository'
- '@validator'
- '@app.pull_request.repository'

# Event subscribers

Expand Down Expand Up @@ -127,6 +140,14 @@ services:
class: AppBundle\Search\Repository
arguments: ['@app.github.search_api', '%repository_username%', '%repository_name%']

app.commit.repository:
class: AppBundle\Commits\Repository
arguments:
- '@app.github.commits_api'
- '@app.github.pullrequests_api'
- '%repository_username%'
- '%repository_name%'

# Reporters

app.pull_requests.reporter:
Expand Down
6 changes: 5 additions & 1 deletion app/config/services_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ services:
# Your integrations tests shouldn't post comments to github
app.pullrequest_listener:
class: Tests\AppBundle\PullRequests\FakeListener
arguments: ['@app.comment_api', '@validator', '@twig']
arguments:
- '@app.comment_api'
- '@validator'
- '@twig'
- '@app.commit.repository'
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"knplabs/github-api": "^1.4",
"knplabs/github-api": "^1.7",
"lp-digital/github-event-parser": "~0.7"
},
"require-dev": {
Expand Down
89 changes: 49 additions & 40 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 40bdb37

Please sign in to comment.