Coder Social home page Coder Social logo

Comments (8)

veewee avatar veewee commented on August 25, 2024 1

That could be a nice addition to the task.
There is some sense of merge commit detection already, but we could add a flag to skip the task on merge commits.
Care to give it a try?

from grumphp.

veewee avatar veewee commented on August 25, 2024 1

The code for this specific task is located here:
https://github.com/phpro/grumphp/blob/v2.x/src/Task/Git/CommitMessage.php

Currently, there is a merge matching mechanism for skipping validation on scope conventions:

$mergePattern =
'(Merge branch|tag \'.+\'(?:\s.+)?|Merge remote-tracking branch \'.+\'|Merge pull request #\d+\s.+)';
if (count($types) > 0) {
$types = implode('|', $types);
$typesPattern = '(' . $types . ')';
}
if (count($scopes) > 0) {
$scopes = implode('|', $scopes);
$scopesPattern = '(:\s|(\((?:' . $scopes . ')\)?:\s))';
}
$rule = '/^' . $specialPrefix . $typesPattern . $scopesPattern . $subjectPattern . '|' . $mergePattern . '/';
try {
$this->runMatcher($config, $subjectLine, $rule, 'Invalid Type/Scope Format');
} catch (RuntimeException $e) {
throw $e;
}

It might make sense to extract these merge patterns into a separate function so that it can be used to determine if the task needs to run at all. You could use that same check to skip running the scope conventions.

That specific task is becoming a bit messy because of historical reasons and is open for improvements :)

from grumphp.

delboy1978uk avatar delboy1978uk commented on August 25, 2024

@veewee sure, can you point me to the code I should be looking at?

from grumphp.

delboy1978uk avatar delboy1978uk commented on August 25, 2024

Thanks @veewee I'll have a look!
BTW I see you're in Belgium, me too! (ik woon al 7 jaar in Leuven)

from grumphp.

veewee avatar veewee commented on August 25, 2024

Nice :) (Ik ben van de Kempen!)

from grumphp.

delboy1978uk avatar delboy1978uk commented on August 25, 2024

I'm now able to merge without a JIRA number on a merge! But let me know if I should move that is merge commit check further up or down the chain of events, I allowed it to still go through the first rules, like not empty message etc. Also, you mentioned a flag setting so we can have the merge skip enabled or disabled, how/where do we go about adding the setting?

from grumphp.

delboy1978uk avatar delboy1978uk commented on August 25, 2024

Of course, I have broken your tests in doing this :P But I'll wait for your feedback first before continuing work!

from grumphp.

veewee avatar veewee commented on August 25, 2024

Cool. Let's continue the discussion in the PR.

from grumphp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.