Skip to content

Commit e799afd

Browse files
committed
feature #155 Remove complements (Nyholm)
This PR was squashed before being merged into the master branch. Discussion ---------- Remove complements Update: This PR will remove all bot complements Commits ------- c806f91 Remove complements
2 parents 6f9982f + c806f91 commit e799afd

File tree

5 files changed

+4
-65
lines changed

5 files changed

+4
-65
lines changed

src/Command/SuggestReviewerCommand.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace App\Command;
44

55
use App\Api\Issue\IssueApi;
6-
use App\Service\ComplementGenerator;
76
use App\Service\RepositoryProvider;
87
use App\Service\ReviewerFilter;
98
use Symfony\Component\Console\Command\Command;
@@ -24,15 +23,13 @@ class SuggestReviewerCommand extends Command
2423
private $issueApi;
2524
private $repositoryProvider;
2625
private $reviewerFilter;
27-
private $complementGenerator;
2826

29-
public function __construct(RepositoryProvider $repositoryProvider, IssueApi $issueApi, ReviewerFilter $reviewerFilter, ComplementGenerator $complementGenerator)
27+
public function __construct(RepositoryProvider $repositoryProvider, IssueApi $issueApi, ReviewerFilter $reviewerFilter)
3028
{
3129
parent::__construct();
3230
$this->issueApi = $issueApi;
3331
$this->repositoryProvider = $repositoryProvider;
3432
$this->reviewerFilter = $reviewerFilter;
35-
$this->complementGenerator = $complementGenerator;
3633
}
3734

3835
protected function configure()
@@ -91,12 +88,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
9188
return 0;
9289
}
9390

94-
$complement = $this->complementGenerator->getPullRequestComplement();
9591
$this->issueApi->commentOnIssue($repository, $pullRequestNumber, <<<TXT
9692
Hey!
9793
98-
$complement
99-
10094
I think @$reviewer has recently worked with this code. Maybe they can help review this?
10195
10296
Cheers!

src/Service/ComplementGenerator.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/Subscriber/CloseDraftPRSubscriber.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use App\Entity\Task;
77
use App\Event\GitHubEvent;
88
use App\GitHubEvents;
9-
use App\Service\ComplementGenerator;
109
use App\Service\TaskScheduler;
1110
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1211

@@ -16,13 +15,11 @@
1615
class CloseDraftPRSubscriber implements EventSubscriberInterface
1716
{
1817
private $issueApi;
19-
private $complementGenerator;
2018
private $scheduler;
2119

22-
public function __construct(IssueApi $issueApi, ComplementGenerator $complementGenerator, TaskScheduler $scheduler)
20+
public function __construct(IssueApi $issueApi, TaskScheduler $scheduler)
2321
{
2422
$this->issueApi = $issueApi;
25-
$this->complementGenerator = $complementGenerator;
2623
$this->scheduler = $scheduler;
2724
}
2825

@@ -35,12 +32,9 @@ public function onPullRequest(GitHubEvent $event)
3532
}
3633

3734
$number = $data['pull_request']['number'];
38-
$complement = $this->complementGenerator->getPullRequestComplement();
3935
$this->issueApi->commentOnIssue($repository, $number, <<<TXT
4036
Hey!
4137
42-
$complement
43-
4438
To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?
4539
4640
Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

src/Subscriber/UnsupportedBranchSubscriber.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use App\Api\Issue\IssueApi;
66
use App\Event\GitHubEvent;
77
use App\GitHubEvents;
8-
use App\Service\ComplementGenerator;
98
use App\Service\SymfonyVersionProvider;
109
use Psr\Log\LoggerInterface;
1110
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -17,15 +16,12 @@ class UnsupportedBranchSubscriber implements EventSubscriberInterface
1716
{
1817
private $symfonyVersionProvider;
1918
private $issueApi;
20-
private $complementGenerator;
2119
private $logger;
2220

23-
public function __construct(SymfonyVersionProvider $symfonyVersionProvider, IssueApi $issueApi, ComplementGenerator $complementGenerator, LoggerInterface $logger)
21+
public function __construct(SymfonyVersionProvider $symfonyVersionProvider, IssueApi $issueApi, LoggerInterface $logger)
2422
{
2523
$this->symfonyVersionProvider = $symfonyVersionProvider;
26-
2724
$this->issueApi = $issueApi;
28-
$this->complementGenerator = $complementGenerator;
2925
$this->logger = $logger;
3026
}
3127

@@ -57,13 +53,10 @@ public function onPullRequest(GitHubEvent $event)
5753
}
5854

5955
$number = $data['pull_request']['number'];
60-
$complement = $this->complementGenerator->getPullRequestComplement();
6156
$validBranchesString = implode(', ', $validBranches);
6257
$this->issueApi->commentOnIssue($event->getRepository(), $number, <<<TXT
6358
Hey!
6459
65-
$complement
66-
6760
But you have made this PR towards a branch that is not maintained anymore. :/
6861
Could you update the [PR base branch](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/changing-the-base-branch-of-a-pull-request) to target one of these branches instead? $validBranchesString.
6962

tests/Subscriber/UnsupportedBranchSubscriberTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use App\Event\GitHubEvent;
88
use App\GitHubEvents;
99
use App\Model\Repository;
10-
use App\Service\ComplementGenerator;
1110
use App\Service\SymfonyVersionProvider;
1211
use App\Subscriber\UnsupportedBranchSubscriber;
1312
use PHPUnit\Framework\TestCase;
@@ -40,7 +39,7 @@ protected function setUp()
4039
->getMock();
4140
$symfonyVersionProvider->method('getSupportedVersions')->willReturn(['4.4', '5.1']);
4241

43-
$subscriber = new UnsupportedBranchSubscriber($symfonyVersionProvider, $this->issueApi, new ComplementGenerator(), new NullLogger());
42+
$subscriber = new UnsupportedBranchSubscriber($symfonyVersionProvider, $this->issueApi, new NullLogger());
4443
$this->repository = new Repository('carsonbot-playground', 'symfony', null);
4544

4645
$this->dispatcher = new EventDispatcher();

0 commit comments

Comments
 (0)