MolSSI / cookiecutter-cms

Python-centric Cookiecutter for Molecular Computational Chemistry Packages
MIT License
385 stars 89 forks source link

Improve default .gitignore defaults for common IDEs #111

Open mattwthompson opened 4 years ago

mattwthompson commented 4 years ago

Some IDEs store settings in folders that are not automatically .gitignore'd here. The three IDEs I know of that computational chemistry-ish developers use are

Googling around indicates that ignoring the entirety of these folders can be dangerous (https://stackoverflow.com/a/24530928, https://stackoverflow.com/q/32964920), but I would argue that this is appropriate for a blanket default. Any project that wishes to track important settings in one of these folders can update their .gitignore. My impression is that organizations/projects using common IDE setting is quite uncommon, at least in this community.

Repeating #110 for PyCharm (or just taking it on to that PR) is a small change, just wanted to see if there's something I'm neglecting.

Lnaden commented 4 years ago

This is an interesting idea. Its not one I think I'm sold on yet. As you identify, there are several cases where ignoring all the files of this type can be harmful. Leaving these present does add a small amount of annoyance to the end-user (it does annoy me), but my personal stance for the Cookiecutter is this really is a flavor choice based on IDE, not so much about the cookiecutter or Python Dev more generally, where I would be more inclined to add these to a .gitignore.

My impression is that organizations/projects using common IDE setting is quite uncommon, at least in this community.

My intuition agrees with this, but I still feel this is more a user-choice than something we should try to enforce. Some people may want to have these files present, and at least PyCharm (the one I use) asks about it first. However, I don't want to automatically mask things that the IDEs may want people to include, or mask features that are 100% based on per-user software choice.

I'm open to the idea and happy to have a debate on this topic though. I'd also love to get feedback from other people on this topic.

mattwthompson commented 4 years ago

Those are each good reasons to leave it as-is. We agree that it is annoying but I certainly grant that it does not squarely fit into the scope of the cookiecutter. Let's see what others think

j-wags commented 4 years ago

I would be in favor of adding as many default IDE directories to gitignore as possible. One of the big strengths of the cookiecutter is that it just “does the right thing” for new developers and makes a minimal, clean package. I wasn’t aware that people ever intended to record their IDE settings on GitHub at all. Generally when I see IDE directories in a repository, I assume that it is unintentional.

dgasmith commented 4 years ago

I lean a bit more toward teaching people how to ~/.git/gitignore_global for their own personal use case. For example I use tmp* there so I can write tmp.py, tmp/, etc for toying around knowing that it will not be committed. But I think its a bit extreme to add that globally.

cat ~/.git/gitignore_global
tmp*
.vscode
*.swp

# Psi
timer.dat
scratch/

# Random Python
Untitled*.ipynb

.DS_Store # What is this? Keeps popping up.
dgasmith commented 3 years ago

To kick this off again, we can do both 1) teach people to use ~/.git/gitignore_global for most cases and 2) block out most common editors such as Sublime/VSCode/PyCharm/Atom.

justinGilmer commented 3 years ago

To add a bit to this discussion. I am in a similar thought process to @dgasmith . It makes sense to add to the local project .gitignore file things directly pertaining to the project and its source code. And possibly some basic support for some ides. But other files should probably fit into a user's global .gitignore.

janash commented 3 years ago

I agree with @j-wags 💯 and with @mattwthompson's original post.

I would be in favor of adding as many default IDE directories to gitignore as possible. One of the big strengths of the cookiecutter is that it just “does the right thing” for new developers and makes a minimal, clean package. I wasn’t aware that people ever intended to record their IDE settings on GitHub at all. Generally when I see IDE directories in a repository, I assume that it is unintentional.

I think we should add as many IDEs as possible to the gitignore. If someone wants their settings transferred and wants to include them, they probably know enough to know how to edit the gitignore. I agree that it looks unintentional to me when they are included in a repo.

It's also great to teach people about a global gitignore, but I don't see that as a job of or part of the cookiecutter. It isn't that cumbersome to have a few extra lines in the gitignore to ignore common IDEs and it will make pushed projects much cleaner for newbies.

eirrgang commented 3 years ago

The directories ignored for the MolSSI repo don't need to be coupled to those automatically ignored for generated projects. I'm not sure if the current conversation is considering them as uncoupled questions, but I don't think this issue should block additions to the base .gitignore for this repository.

I'm not sure if there is any "danger" in adding anything to gitignore. One can always manually add a file to git and, once tracked, it is no longer ignored.

mikemhenry commented 2 years ago

I also think we should add as many IDEs as possible to make things JustWork :tm: If a user needs/wants to add a file, git provides a pretty helpful hint:

$ git add .env                                                                                                                                                                         
The following paths are ignored by one of your .gitignore files:
.env
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"

So I don't think it will be too harmful to include.