DEV Community

Abdulbasid Guled
Abdulbasid Guled

Posted on

Release 0.2 Part 3: When asking to work on an issue is not enough

Maintainer was cool, but I disagree heavily with his notion that issues are open to work on. Just me though

Last time, we worked on a script to gather useful information that could easily be used in any front-end app. This time, I worked on an issue for a console application that simulates registration and user logins. It's actually cool in that it doesn't just use python, but it also has implementations in C# and Ruby, 2 languages that have intrigued me in the past. The maintainer maintained that any issue for the repo were open for anyone and that you did not need to ask to be assigned to one. This made it a race against the clock to get the issue done and unfortunately, someone else beat me to it. It's a little disheartening, but what can you do.

I decided to work on the name validation portion of this application in Python. These were the following rules the maintainer had:

NameValidationRules

Interesting set of rules. Working on this also gave me memories of working on my Release 0.1, which also had to follow a specific set of rules regarding urls. I used my knowledge from working on that here. I made a regex that takes care of the allowed characters inside the name

NameRegex

The next few lines were just checks if a name exists, if the first letter was capitalized, and if the last character was a space. If these 3 cases were true, then the name is invalid. The real magic came here:

ValidationCode

So I had two loops here. The first one splits based on a space in between 2 words, since there had to be 2 or more words in a name, while the second splits based on whether a "-" exists. Afterwards, it just becomes a matter of checking to see if the name matched the regex.

Because my PR came after another one that fixed the issue, my PR was unfortunately closed without being merged. Regardless, it was something I liked working on, while also taking some inspiration from work that I had done previously. Slowly, but surely, I'm getting used to working and making regex. It's something that I despised beforehand, but now, I can see why it's a powerful tool in both Open Source and beyond.

Next time, one last PR. One last challenge. The PR to end them all. Stay tuned!

Top comments (0)