Dizzykiwi
Dizzykiwi

Reputation: 505

Is there a way to ignore calculating language statistics for a directory on Github?

I am currently creating a lot of small experimental game projects in Lua that include a framework written in C, which dominates the code percentages and declares my project as being in C when it is not.

I do however want to keep this framework, as it allows me to add on the playable version of the game.

I am partially familiar with the concept of removing language statistics on a file, but is there a way to omit a directory?

I have also seen most answers link to this answer but as I am new to github I don't quite know how to decipher it.

Upvotes: 21

Views: 4591

Answers (3)

Muhammed Gül
Muhammed Gül

Reputation: 875

To give an example on an actual project, to disable this folder in the statistics of Alamofire project, the command would be:

Alamofire/Example/Resources/* linguist-vendored

inside the project's .gitattributes file.

Upvotes: 1

Sukhdeep
Sukhdeep

Reputation: 168

This will ignore all the files in the given folder and subfolders from the stats.

linguist-vendored: This attribute helps us exclude files from stats.

In the .gitattributes file:

folder_to_ignore_files_from/** linguist-vendored

For e.g. I had a static_root folder in my root directory from which I wanted to ignore files from. So,

static_root/** linguist-vendored

I had created the .gitattributes in root directory.

Ref: link

Upvotes: 8

pchaigno
pchaigno

Reputation: 13063

To ignore all files from a particular directory when computing statistics, you can use the following .gitattributes:

your/framework/directory/* linguist-vendored

If you think your framework is common enough through github.com, you can make a pull request to Linguist to add it to the list of ignored directories. That way, you won't need to ignore it on a per-repository basis.

Upvotes: 29

Related Questions