1
|
|
|
<?php |
2
|
|
|
declare(strict_types = 1); |
3
|
|
|
namespace PurpleBooth\GitGitHubLint\Status; |
4
|
|
|
|
5
|
|
|
use PurpleBooth\GitGitHubLint\Validator\SoftLimitTheTitleLengthTo50CharactersValidator; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* This is the status returned when the SoftLimitTheTitleLengthTo50CharactersValidator identifies a problem |
9
|
|
|
* |
10
|
|
|
* @see SoftLimitTheTitleLengthTo50CharactersValidator |
11
|
|
|
* |
12
|
|
|
* @package PurpleBooth\GitGitHubLint\Status |
13
|
|
|
*/ |
14
|
|
|
class SoftLimitTheTitleLengthTo50CharactersStatus implements Status |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* Get the importance of this status. |
18
|
|
|
* |
19
|
|
|
* The lower the value the less important it is, the higher the more important. |
20
|
|
|
* |
21
|
|
|
* @return int |
22
|
|
|
*/ |
23
|
|
|
public function getWeight() : int |
24
|
|
|
{ |
25
|
|
|
return Status::WEIGHT_WARN; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* A human readable message that describes this state |
30
|
|
|
* |
31
|
|
|
* This will be displayed to the user via the GitHub state |
32
|
|
|
* |
33
|
|
|
* @return string |
34
|
|
|
*/ |
35
|
|
|
public function getMessage() : string |
36
|
|
|
{ |
37
|
|
|
return 'Looks good, but can you shorten the subject of the commit message to 50 characters or less?'; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Is true if the status on GitHub would be success |
42
|
|
|
* |
43
|
|
|
* @return boolean |
44
|
|
|
*/ |
45
|
|
|
public function isPositive() : bool |
46
|
|
|
{ |
47
|
|
|
return $this->getState() == Status::STATE_SUCCESS; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* The GitHub equivalent of this state |
52
|
|
|
* |
53
|
|
|
* Can be one of pending, success, error, or failure. |
54
|
|
|
* |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
public function getState() : string |
58
|
|
|
{ |
59
|
|
|
return Status::STATE_SUCCESS; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get a URL with further explanation about this commit message status |
64
|
|
|
* |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
|
|
public function getDetailsUrl() : string |
68
|
|
|
{ |
69
|
|
|
return "http://chris.beams.io/posts/git-commit/#limit-50"; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|