• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eliashaeussler / version-bumper / 12771487519

14 Jan 2025 03:58PM UTC coverage: 89.652% (-0.04%) from 89.693%
12771487519

push

github

web-flow
Merge pull request #27 from eliashaeussler/feature/conventional-commits

[FEATURE] Add preset for Conventional Commits 1.0.0

31 of 35 new or added lines in 1 file covered. (88.57%)

849 of 947 relevant lines covered (89.65%)

4.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.57
/src/Config/Preset/ConventionalCommitsPreset.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "eliashaeussler/version-bumper".
7
 *
8
 * Copyright (C) 2024-2025 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\VersionBumper\Config\Preset;
25

26
use EliasHaeussler\VersionBumper\Config;
27
use EliasHaeussler\VersionBumper\Enum;
28

29
/**
30
 * ConventionalCommitsPreset.
31
 *
32
 * @author Elias Häußler <elias@haeussler.dev>
33
 * @license GPL-3.0-or-later
34
 *
35
 * @see https://www.conventionalcommits.org/en/v1.0.0/
36
 */
37
final class ConventionalCommitsPreset implements Preset
38
{
39
    public function getConfig(): Config\VersionBumperConfig
25✔
40
    {
41
        $versionRangeIndicators = [
25✔
42
            // Major
43
            new Config\VersionRangeIndicator(
25✔
44
                Enum\VersionRange::Major,
25✔
45
                [
25✔
46
                    new Config\VersionRangePattern(
25✔
47
                        Enum\VersionRangeIndicatorType::CommitMessage,
25✔
48
                        '/^[a-z]+(\([\w\-\.]+\))?!:/',
25✔
49
                    ),
25✔
50
                ],
25✔
51
            ),
25✔
52

53
            // Minor
54
            new Config\VersionRangeIndicator(
25✔
55
                Enum\VersionRange::Minor,
25✔
56
                [
25✔
57
                    new Config\VersionRangePattern(
25✔
58
                        Enum\VersionRangeIndicatorType::CommitMessage,
25✔
59
                        '/^feat(\([\w\-\.]+\))?:/',
25✔
60
                    ),
25✔
61
                ],
25✔
62
            ),
25✔
63

64
            // Patch
65
            new Config\VersionRangeIndicator(
25✔
66
                Enum\VersionRange::Patch,
25✔
67
                [
25✔
68
                    new Config\VersionRangePattern(
25✔
69
                        Enum\VersionRangeIndicatorType::CommitMessage,
25✔
70
                        '/^(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\([\w\-\.]+\))?:/',
25✔
71
                    ),
25✔
72
                ],
25✔
73
            ),
25✔
74
        ];
25✔
75

76
        return new Config\VersionBumperConfig(versionRangeIndicators: $versionRangeIndicators);
25✔
77
    }
78

NEW
79
    public static function getIdentifier(): string
×
80
    {
NEW
81
        return 'conventional-commits';
×
82
    }
83

NEW
84
    public static function getDescription(): string
×
85
    {
NEW
86
        return 'Conventional Commits 1.0.0';
×
87
    }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc