Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better default branch rules #210

Merged
merged 3 commits into from
Sep 19, 2022
Merged

Better default branch rules #210

merged 3 commits into from
Sep 19, 2022

Conversation

internalsystemerror
Copy link
Member

@internalsystemerror internalsystemerror commented Sep 16, 2022

Q A
Documentation no
Bugfix no
BC Break no
New Feature yes
RFC no
QA yes

Description

This PR:

  • Fixes Better default branch rules #209)
  • Adds further feature documentation to describe this PRs intention to fix the above
  • Adds a failing test to ensure what is documented
  • Updates dependencies in composer.lock

I'm not certain if this is the best approach, as it just ignores the new major branches when computing the new default.

Edit: I've reviewed the logs generated by the infection check showing 14 escaped mutants (including from this change) and 1 error, however when I run the tool locally I get 6 and this change is not mentioned:

Local logs
$ roave-infection-static-analysis-plugin --psalm-config psalm.xml.dist 

    ____      ____          __  _
   /  _/___  / __/__  _____/ /_(_)___  ____
   / // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
 _/ // / / / __/  __/ /__/ /_/ / /_/ / / / /
/___/_/ /_/_/  \___/\___/\__/_/\____/_/ /_/

#StandWithUkraine

Infection - PHP Mutation Testing Framework version 0.26.14

[notice] You are running Infection with PCOV enabled.

Running initial test suite...

PHPUnit version: 9.5.24

  228 [============================] 14 secs

Generate mutants...

Processing source code files: 59/59
.: killed, M: escaped, U: uncovered, E: fatal error, X: syntax error, T: timed out, S: skipped, I: ignored

UUUUUU............................................   ( 50 / 679)
..................................................   (100 / 679)
..................................................   (150 / 679)
..................................................   (200 / 679)
..................................................   (250 / 679)
..................................................   (300 / 679)
..................................................   (350 / 679)
..................................................   (400 / 679)
..................................................   (450 / 679)
..................................................   (500 / 679)
..................................................   (550 / 679)
..................................................   (600 / 679)
..................................................   (650 / 679)
.............................                        (679 / 679)

679 mutations were generated:
     673 mutants were killed
       0 mutants were configured to be ignored
       6 mutants were not covered by tests
       0 covered mutants were not detected
       0 errors were encountered
       0 syntax errors were encountered
       0 time outs were encountered
       0 mutants required more time than configured

Metrics:
         Mutation Score Indicator (MSI): 99%
         Mutation Code Coverage: 99%
         Covered Code MSI: 100%

Note: to see escaped mutants run Infection with "--show-mutations" or configure file loggers.

Please note that some mutants will inevitably be harmless (i.e. false positives).
Escaped mutants:
================

Timed Out mutants:
==================

Skipped mutants:
================

Not Covered mutants:
====================

1) /laminas/automatic-releases/src/Changelog/ChangelogReleaseNotes.php:61    [M] Concat

--- Original
+++ New
@@ @@
     public function merge(self $next) : self
     {
         if ($this->changelogEntry && $next->changelogEntry) {
-            throw new RuntimeException('Aborting: Both current release notes and next contain a ChangelogEntry;' . ' only one CreateReleaseText implementation should resolve one.');
+            throw new RuntimeException(' only one CreateReleaseText implementation should resolve one.' . 'Aborting: Both current release notes and next contain a ChangelogEntry;');
         }
         $changelogEntry = $this->changelogEntry ?: $next->changelogEntry;
         if ($changelogEntry) {


2) /laminas/automatic-releases/src/Changelog/ChangelogReleaseNotes.php:61    [M] ConcatOperandRemoval

--- Original
+++ New
@@ @@
     public function merge(self $next) : self
     {
         if ($this->changelogEntry && $next->changelogEntry) {
-            throw new RuntimeException('Aborting: Both current release notes and next contain a ChangelogEntry;' . ' only one CreateReleaseText implementation should resolve one.');
+            throw new RuntimeException(' only one CreateReleaseText implementation should resolve one.');
         }
         $changelogEntry = $this->changelogEntry ?: $next->changelogEntry;
         if ($changelogEntry) {


3) /laminas/automatic-releases/src/Changelog/ChangelogReleaseNotes.php:61    [M] ConcatOperandRemoval

--- Original
+++ New
@@ @@
     public function merge(self $next) : self
     {
         if ($this->changelogEntry && $next->changelogEntry) {
-            throw new RuntimeException('Aborting: Both current release notes and next contain a ChangelogEntry;' . ' only one CreateReleaseText implementation should resolve one.');
+            throw new RuntimeException('Aborting: Both current release notes and next contain a ChangelogEntry;');
         }
         $changelogEntry = $this->changelogEntry ?: $next->changelogEntry;
         if ($changelogEntry) {


4) /laminas/automatic-releases/src/Environment/EnvironmentVariables.php:56    [M] Concat

--- Original
+++ New
@@ @@
     private function __construct(private readonly string $githubToken, private readonly SecretKeyId $signingSecretKey, private readonly string $gitAuthorName, private readonly string $gitAuthorEmail, private readonly string $githubEventPath, private readonly string $workspacePath, private readonly string $logLevel)
     {
         /** @psalm-suppress ImpureFunctionCall the {@see \Psl\Iter\contains()} API is conditionally pure */
-        Psl\invariant(Iter\contains(self::LOG_LEVELS, $logLevel), 'LOG_LEVEL env MUST be a valid monolog/monolog log level constant name or value;' . ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels');
+        Psl\invariant(Iter\contains(self::LOG_LEVELS, $logLevel), ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels' . 'LOG_LEVEL env MUST be a valid monolog/monolog log level constant name or value;');
     }
     public static function fromEnvironment(ImportGpgKeyFromString $importKey) : self
     {


5) /laminas/automatic-releases/src/Environment/EnvironmentVariables.php:56    [M] ConcatOperandRemoval

--- Original
+++ New
@@ @@
     private function __construct(private readonly string $githubToken, private readonly SecretKeyId $signingSecretKey, private readonly string $gitAuthorName, private readonly string $gitAuthorEmail, private readonly string $githubEventPath, private readonly string $workspacePath, private readonly string $logLevel)
     {
         /** @psalm-suppress ImpureFunctionCall the {@see \Psl\Iter\contains()} API is conditionally pure */
-        Psl\invariant(Iter\contains(self::LOG_LEVELS, $logLevel), 'LOG_LEVEL env MUST be a valid monolog/monolog log level constant name or value;' . ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels');
+        Psl\invariant(Iter\contains(self::LOG_LEVELS, $logLevel), ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels');
     }
     public static function fromEnvironment(ImportGpgKeyFromString $importKey) : self
     {


6) /laminas/automatic-releases/src/Environment/EnvironmentVariables.php:56    [M] ConcatOperandRemoval

--- Original
+++ New
@@ @@
     private function __construct(private readonly string $githubToken, private readonly SecretKeyId $signingSecretKey, private readonly string $gitAuthorName, private readonly string $gitAuthorEmail, private readonly string $githubEventPath, private readonly string $workspacePath, private readonly string $logLevel)
     {
         /** @psalm-suppress ImpureFunctionCall the {@see \Psl\Iter\contains()} API is conditionally pure */
-        Psl\invariant(Iter\contains(self::LOG_LEVELS, $logLevel), 'LOG_LEVEL env MUST be a valid monolog/monolog log level constant name or value;' . ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels');
+        Psl\invariant(Iter\contains(self::LOG_LEVELS, $logLevel), 'LOG_LEVEL env MUST be a valid monolog/monolog log level constant name or value;');
     }
     public static function fromEnvironment(ImportGpgKeyFromString $importKey) : self
     {
 ! [NOTE] The MSI is 2.12% percentage points over the required MSI. Consider increasing the required MSI percentage the 
 !        next time you run Infection.                                                                                  


Time: 4m 39s. Memory: 0.14GB

Gary Lockett added 3 commits September 16, 2022 00:53
Signed-off-by: Gary Lockett <gary@creativecow.uk>
Signed-off-by: Gary Lockett <gary@creativecow.uk>
Signed-off-by: Gary Lockett <gary@creativecow.uk>
@internalsystemerror
Copy link
Member Author

This PR makes one big assumption I should add:

  • If there is only a 2.0.x branch and there is NO 2.1.x branch, then there has NOT yet been a release of a v2 major and should be considered as in development.

@Ocramius Ocramius self-assigned this Sep 19, 2022
@Ocramius Ocramius added this to the 1.18.0 milestone Sep 19, 2022
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 let's try this out :)

@Ocramius Ocramius merged commit e5e024e into laminas:1.18.x Sep 19, 2022
@Ocramius
Copy link
Member

Feedback here: seems that it worked!

Ref: https://github.com/laminas/laminas-view/actions/runs/3083745956/jobs/4985056587
Ref: https://github.com/laminas/laminas-view/milestone/31
Ref: https://github.com/laminas/laminas-view/releases/tag/2.23.0
Ref: https://github.com/laminas/laminas-view/tree/2.24.x

The default branch switched from 2.23.x to 2.24.x, and a merge-up PR to 3.0.x was still created @ laminas/laminas-view#176

Thanks @internalsystemerror!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better default branch rules
2 participants