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

3

21

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.

Gardenia answered 29/4, 2015 at 0:34 Comment(1)
Possible duplicate of Is it possible to exclude files from git language statistics?Herminiahermione
D
29

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.

Domingodominguez answered 13/8, 2017 at 7:13 Comment(0)
D
8

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

Dekaliter answered 31/12, 2021 at 13:58 Comment(0)
A
1

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.

Abstriction answered 27/3, 2023 at 14:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.