Skip to content

Instantly share code, notes, and snippets.

@jiahao
Last active May 17, 2022 08:30
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiahao/8b19775cee3a6d51706acf0a8c0ec376 to your computer and use it in GitHub Desktop.
Save jiahao/8b19775cee3a6d51706acf0a8c0ec376 to your computer and use it in GitHub Desktop.
What do .gitignore files tell us about the inherent complexity of programming languages? This gist can be run on data from GitHub's own collection of gitignore templates, whose repository is at https://github.com/github/gitignore, and counts how many rules are present in the template for each programming language.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
546 Joomla
142 VisualStudio
104 Magento
100 TeX
50 Python
33 UnrealEngine
32 ROS
29 Drupal
29 Delphi
27 Symfony
27 Lua
25 Swift
25 Ruby
25 Qt
25 Eagle
23 Rails
22 C
21 Unity
21 Prestashop
20 Zephir
20 Perl
20 Objective-C
20 LemonStand
19 Haskell
18 Plone
18 CakePHP
17 Fortran
17 C++
16 WordPress
16 Node
16 Jboss
16 Go
16 Android
14 Typo3
14 R
14 PlayFramework
14 OCaml
13 ZendFramework
13 SugarCRM
13 Scala
13 Mercury
13 Grails
13 ExpressionEngine
13 Dart
13 Autotools
12 Leiningen
12 GWT
12 Clojure
12 ArchLinuxPackages
11 Textpattern
11 Opa
11 KiCad
11 Finale
11 D
10 TurboGears2
10 SeamGen
10 OpenCart
10 MetaProgrammingSystem
10 Laravel
10 Erlang
10 Actionscript
9 Xojo
9 RhodesRhomobile
9 Maven
9 LabVIEW
8 Umbraco
7 Smalltalk
7 Sdcc
7 Scrivener
7 Processing
6 Yii
6 SymphonyCMS
6 Scheme
6 Lilypond
6 Java
6 GitBook
6 CUDA
6 CodeIgniter
6 CMake
6 ChefCookbook
5 Yeoman
5 Stella
5 Qooxdoo
5 Gradle
5 FuelPHP
5 Elixir
5 DM
5 CFWheels
4 IGORPro
4 ForceDotCom
4 ExtJs
4 Concrete5
3 Waf
3 OracleForms
3 Nanoc
3 Jekyll
3 Gcov
3 Coq
3 CommonLisp
2 VVVV
2 Terraform
2 Sass
2 Rust
2 Phalcon
2 Packer
2 Lithium
2 Kohana
2 Idris
2 Fancy
2 Elm
2 Elisp
2 CraftCMS
2 Composer
2 AppceleratorTitanium
2 Ada
1 SketchUp
1 SCons
1 Nim
1 EPiServer
1 AppEngine
1 Agda
#Plots a bar chart of the number of rules in GitHub's .gitignore templates by language
#
#Produces a plot in a file specified by plotfile
using Gadfly
plotfile = "nrules.svg"
fileformat = SVG #You can emit other formats, like PNG
io = IOBuffer(readall(`sh rulecounter.sh`))
t = readdlm(io)
draw(fileformat(plotfile, 12inch, 6inch),
plot(x=t[:,2], y=t[:,1], Coord.Cartesian(ymin=0),Geom.bar,
Guide.xlabel("Language"), Guide.title("Number of .gitignore rules"),
Guide.ylabel(""), Theme(background_color=colorant"white", grid_color=colorant"white"))
)
#!/bin/sh
#Path to the local copy of https://github.com/github/gitignore
REPO=../gitignore
for f in $REPO/*.gitignore; do
nrules=`grep -v ^\# $f | sed '/^$/d;' | wc -l`
basef=`basename $f | sed 's/.gitignore$//'`
echo $nrules\\\t$basef
done | sort -nr
@thewhitetulip
Copy link

Well, for Go, it depends on which platform you use, if you not use Windows then one less rule in gitignore :)

@mascot6699
Copy link

Hmm, Python projects seems to be simple although it has 50 rules!!

@alexmick
Copy link

I don't think this is a measurement of the inherent complexity of each language as you put it (OK the top ones are unnecessarily complex) but more the complexity of what people decided to make with these languages. Python for instance is used for so many things that indeed the most generic .gitignore is very large. But PHP would be even worse if you put all Symfony, Joomla, Wordpress, CakePHP, etc. together into one generic file for use in any project.
Your idea is very clever though, don't get me wrong : It would be interesting to run these statistics against real code repositories and looking at their .gitignore file length to see how it really comes out in reality ! (Although this might also be subject to added complexity by each project's specific configuration and add-ons)

@drguildo
Copy link

Since when is Joomla a programming language? This has nothing to do with programming language complexity and is a pretty poor metric when it comes to tooling complexity.

@svarcoe
Copy link

svarcoe commented May 10, 2016

Visual Studio is big because it includes ignores for many of its most common plugins, not to mention it supports a ton of the other languages on this list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment