It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to enforce naming conventions using ScriptRunner add-on with Bitbucket

Hello,

Using ScriptRunner add-on 5.1.8 with Bitbucket 5.3.2, is there a way to enforce naming conventions for projects and repos? If so, how?

I see that there is enforcing naming conventions for feature and bugfix branches using the Pre-receive Hooks, but is there anything for project and repo names?

Thanks,

Mary

2 answers

1 accepted

0 votes
Answer accepted

You could do that using a custom event handler.

For example you can use the following script for the ProjectCreationRequestedEvent. You'll need to change the regex part. At the moment it enforces that project keys must begin with a C followed by at least one upper case character in A-Z.

def regex = "C[A-Z]+"

if (! (event.project.key ==~ /${regex}/)) {
event.cancel("Project key must start with C!")
}

Let us know how that goes.

Works great! Thank you so much for your help :)

 

Mary

0 votes

Hi Mary,

There is an event handler for that using ScriptRunner. It's called "Naming standard enforcement" with the description "Enforce project and repository naming standards".

The documentation can be found here but it's works similarly to the branch and tag naming convention one.

Let us know how you get on.

Thanks,
Adam

Thanks, Adam!

I was on an older version, so I didn't see that available.

But, is there a way to enforce a naming convention for the Project Key? I'm now fine with the Project Name being descriptive, but I need to enforce a naming convention on the Project Key.

Mary

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Apr 03, 2019 in Marketplace Apps

How to estimate projects more accurately?

Gaining insight into your team’s effectiveness and choosing the right estimation technique.   Estimating projects is hard. It is because people have the tendency to underestimate the time thin...

299 views 2 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you