Alexito's World

A world of coding 💻, by Alejandro Martinez

JIRA reports with Swift

One of the things I think is really important in any team is to keep track of the performance. Not to use it as ammo to blame individuals but to learn and have data to keep improving.

Our team uses JIRA and our workflow is based in story points and sprints. What I've been doing for a while is to track the story points our team has commited to deliver in a sprint and when the sprint has finished check what we've acomplished.

Until a couple of sprints ago this task took me more time that what I was comfortable with. The reason of this is because as powerful as JIRA is there are some things that are ridiculously hard to acomplish. As much as I think this tasks are important, I don't like to waste time on them, time that could be invested in improving the product. So a Sunday afternoon I decided to do what any other developer would have done: automate the process.

Our team is divided in feature teams that take care of different components of the product. I also want to know how many story points we commited to do, how much we have done and how many of the tasks have actually been completed. The difference between the work we have done (what I call resolved) and the tasks that have been completed is quite important for us. Issues that are implemented, reviewed and merged is what we consider resolved, we have done our part. But the product is not only done by developers, there are other parts involved. QA, designers product owners... a task is not fully completed until it has been tested and approved by them. That difference has enough relevance for me to want to have this numbers separated.

To have all of this I used to have many different filters in JIRA and had to do the sum of the story points by hand over and over. And summing numbers in a long column of issues is one of those tasks that is tricky to finish, as any distraction makes you lose track of where you were.

That's why I built a simple Playground in Swift, in less time that took me to do one of these reports by hand! You can take a look at jirareports in GitHub. It's a really simple project that doesn't try to be useful for everyone, it implements my specific needs and the configuration is based in our workflow. But it can serve as a good starting point if someone else needs this kind of tool, a couple of modifications should be enough to fit your team requirements.

This is another installment on my usage of Swift for scripting and I'm sad to say that is still not there. It has improved in many ways, and I really love the language itself for scripting, but the tooling, specially for quickly import and use dependencies is not there yet. I eneded up just copy and pasting source code from GitHub, much faster for this kind of task that messing around with dependency managers.

On the other hand there are things that are super easy to do thanks to the amazing Foundation framework that is avialable without requiring any effort, that's how the usages of any third party library should be. Network connections, JSON parsing and many other thigns, you don't need third party libraries for that. The only thing I miss in Foundation's URLSession is a better support for syncronous downloads. When you are writing a playground or a script you don't to mess with asyncronous APIs, so I always end up adding a little extension to URLSession for syncronous donwloads.

For that reason I quickly abandoned the idea of trying to build a command line tool (you can see that the project is setup for that) and just started playing in a Playground. Is good enough for my needs and easier to handle. I really hope that the Swift Package Manager fixes this issues this year and we can see Swift growing for scripting as it is growing for server side development.

If you liked this article please consider supporting me