gitlabgame-makergitattributesgithub-linguist

.gitattributes for linguist doesn't work correctly with gitlab


I have a (private) project on Gitlab which uses GameMaker, and the .yy files were being detected as Yacc. I looked up how to change this, so I came across .gitattributes files, as described here and here. I created a .gitattributes file in the project directory with the following content:

*.yy linguist-language=GameMaker JSON
*.yy linguist-detectable=true
*.yyp linguist-language=GameMaker JSON
*.yyp linguist-detectable=true

The files are no longer being detected as Yacc, but they are also not detected as "GameMaker JSON", Gitlab now shows the repository as 100% GameMaker Language. I have tried both *.yy linguist-detectable syntax without the =true and with it, I have tried writing GameMaker-JSON with hyphens instead of spaces, and I have confirmed that the .gitattributes file was pushed onto the main branch (which is the only branch). How can I resolve this so that the .yy and .yyp files get recognized correctly, am I missing something?


Solution

  • It seems I mistakenly assumed that linguist allows you to specify custom language names in .gitattributes, but to my current knowledge, that is unfortunately not possible. I will henceforth specify to mark .yy and .yyp files as JSON in my project (refer to this comment I made), which I have already confirmed to work correctly.

    My intention was to mark files that are specifically used as GameMaker project files or asset files (which are created and used by the GameMaker editor and not intended to be edited manually) differently from other files with JSON syntax (GameMaker also allows you to parse data from JSON files within your game code, these files would usually use the .json extension and not .yy or .yyp).

    For now, it seems advisable for GameMaker projects to either specify .yy and .yyp as JSON or specify them to not be counted by linguist at all, since they aren't code that is manually written by the user.