Stratus3D

Software Engineering, Web Development and 3D Design

Maintaining an Open Source Project

This was a talk I gave at the Sarasota Software Engineers User Group in Sarasota on July 26, 2018

Maintaining open source software is often time consuming and difficult. Open source maintainers have to deal with reports of hard to reproduce bugs, incomplete and buggy pull requests, requests for support, and bug reports mistakenly opened by confused users. Despite the challenges maintainers face they can still greatly benefit from the support of their software’s users and contributors. Through proper organization and automation maintainers can better manage their project and have more time to focus on the long term goals of the software. In this talk I will talk about my experience working as a maintainer of asdf, an open source version management tool. I’ll talk about how I got started as a contributor and what I learned throughout my work. I’ll share the techniques I have learned that make open source maintenance easier. You will learn how to apply these techniques to your own open source (and closed source) projects to improve efficiency and speed of development. Geared for those have some experience with software development and want to begin contributing to open source projects or get better at maintaining existing software.

My Experience as a Maintainer of asdf

In the talk I gave I talked a lot about my experience with asdf and how I got started in open source. I explained how asdf works, talked about my work as a maintainer, and presented some of the tools that have helped us build asdf. All of these things can be found in other places, I previously written about how asdf works and the tools we use for asdf can all be seen at work in the build for the project. In this post I’m only going to list the advice I gave at the end of the talk. First is advice for users and contributors.

Advice for users and contributors

  • Fastest way to get something done is to do it yourself
  • Be extremely detailed when reporting bugs and proposing features
  • PRs and issue tracker are your friend
    • Look and see if the issue or patch you want to contribute already exists
    • Look at past PRs and comments to determine if your changes would be welcome
  • Don’t get discouraged by lack of attention
  • Don’t assume maintainers know more than you
  • Have a backup plan

Advice for maintainers

Automate automate automate!

  • Automate all repetitive tasks that can be automated
  • Linting, tests, builds, releases/tags, deployments
  • Try to codify all requirements in something that’s automated

Be nice, But also be strict

  • Be thankful for all contributions
  • Be open to different solutions
  • But don’t merge PRs that:
    • Are confusing
    • For bugs that are not understood or documented
    • Violate project standards
    • Negatively affect the existing code in the codebase
  • Don’t give someone commit access until they’ve proven themselves with their contributions

Encourage contribution

  • Make it easy to contribute
  • Have well defined standards for contributions that users can read
  • Point people in the right direction
  • Offer contributors help when it makes sense

Be organized

  • Repositories, files, and directories should have descriptive names
  • All code should have corresponding unit tests
  • Everything should be under version control (GitHub makes this easy)
  • Software should versioned
    • Tagging should be automated
    • Users should be encouraged to use the latest stable version when installing
    • Users should have an easy way to view version and other environmental information to make bug reporting easier

Have good docs

  • Everything should be documented
    • Usage, APIs, bug reporting, contribution guidelines, standards, review and release processes, and on and on…
  • Have official documentation that goes through a review process
  • Have a wiki so users can easily share unofficial documentation on specific use cases of the software

Resources

Stop Excluding Editor Temp Files in .gitignore

Many of the open source projects that I rely on have large .gitignore files with rules for ignoring temp files that their contributor’s editors generate. Sometimes these rules are added to the .gitignore intentionally by well meaning developers, other times they are copied in from other repository’s .gitignore files, sometimes build tools generate .gitignore files that contain these rules when generating new projects. It’s easy to see how repositories come to have editor-specific ignore rules in their .gitignore files. From ordinary libraries to massive open source projects like Electron ignore editor-specific files you will find editor-specific rules in the .gitignore file.

In this blog post I’ll explain why it’s unwise to try to ignore editor temp files with rules in a repository’s .gitignore file.

What’s wrong with excluding editor temp files in a project’s .gitignore?

Defining rules that properly exclude temporary files generated by text editors and IDEs can be very difficult if not impossible to do properly, and excluding temporary files for all editors is impossible. It may seem a little extreme to consider all editors when creating a .gitignore, but if your repository is open source or has many committers it’s possible that many different text editors or IDEs will be used. It’s hard to know ahead of time what tools the committers will choose to use. It’s much safer to have individual committers exclude the temp files generated by their own tools in their own global gitignore files.

The global gitignore

Creating a global gitignore is easy and the rules in the global gitignore will be applied to every repository you work on. To setup a global gitignore create file somewhere on your file system with rules to exclude the temporary files generated by your editor (I use ~/.gitignore_global. See my dotfiles for more details). Then run:

1
git config --global core.excludesfile <path to the file you created>

That’s all you need to do. Every rule you defined in the global excludes file will be ignored in every repository to you work on. The git config command will add a line to your .gitconfig file in your home directory that will look like this:

1
2
[core]
excludesfile = ~/.gitignore_global

You can edit your .gitconfig manually if you prefer.

But why not ignore editor temp files in each .gitignore to be safe?

Properly ignoring all temp files for an editor isn’t always as simple as it might seem. Take for example Vim, often you will find .gitignores with a single line like this intended to ignore all Vim swap files:

1
*.swp

This rule is similar to the rule you would get in a StackOverflow answer if you asked about this on there. But this ignore rule is wrong. Vim’s swap files may have the .swp extension, but they may also have many other extensions as well. StackOverflow answerers aren’t the only ones who get this wrong, gitignore.io also gets it wrong. It takes multiple rules to exclude all Vim swap files:

1
2
3
4
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]

In other words, Vim swap files don’t just have the extenions .swp or .sw*, they could be *.saa or *.sab if the other extensions have been taken. Here is the source code that generates these extensions if you are curious. And because these rules for excluding Vim swap files are so broad, they will exclude files that might not be swap files at all. For example, a file ending in .swf may be a Shockwave Flash file, but it will be ignored by these Vim swap file rules.

Worse still, some editors allow you to customize the names of the temp files they generate. This makes it impossible to define rules in a repository’s .gitignore that properly exclude editor temp files, even if you are only targeting a small set of editors and IDEs. It’s far better for developers to define their own rules to exclude their own editors temp files.

What’s wrong with trying to ignore what we can?

The problem is ignoring what you know about will result in most things being ignored most of the time. Most temp files will be caught by the rules and ignored. But from time to time a temp file might slip through and get staged or committed. If no editor temp files are ignored by the repository’s .gitignore it will be more clear to the developer that their Git configuration isn’t excluding files it should. This will prompt them to add more ignore rules; hopefully in their global ignore file.

But then contributors will check in their temp files!

Most will notice their mistake. And the few that don’t can be asked to remove the temp files from their PR. We get several PRs a week for asdf, many from new contributors, and I have never once seen a contributor accidentally check in a temp file. The asdf .gitignore file does not ignore any editor specific files and we have never had any trouble with this.

Conclusion

My approach to ignore rules is very simple.

I put any ignore rules that are specific to the tools I choose to use in my global ignore file. Any ignore rules that are specific to the language or tools required by a project I put in the project’s .gitignore file.

References

Erlang Cheatsheet

Erlang cheatsheet webpage screenshot

I have been writing Erlang for over 4 years now and there are still a few things I struggle to remember. Remembering all the core concepts is easy but it can be hard to remember the nuances of exit signals or exit trapping. Through the years I have cobbled together some notes on the things I found hard to remember, and I finally compiled them all into a presentable format. I created a printable cheatsheet from my notes that documents the easily forgotten quirks of the language. This cheatsheet isn’t intended for beginners because it does not cover any of the fundamentals of the language.

The cheatsheet is available for you to freely print or download at https://stratus3d.com/erlang-cheatsheet/. The source code has been released under the MIT license and is available on GitHub at Stratus3D/erlang-cheatsheet.

I’d really like to hear your thoughts on the cheatsheet. Is there something my cheatsheet is missing? Is there something that can be simplified or removed? What do you think of the design?

Let me know via email or twitter. If you want to contribute directly feel free to create an issue or pull request on the GitHub repository.

References