Exclude files from being counted under code frequency #21858
-
|
Hi all, I am working on a project in MATLAB to do some basic data processing and instrument communication, for which I have made a GitHub repository (https://github.com/engelsen/Instrument-control). Recently, I committed a couple of data files (tab delimited .txt files) for a test case. These are now being counted as code under code frequency, despite my attempt to tell linguist that I would like it to ignore these files. Can anyone see what is going wrong here? I made a .gitattributes file that only contains the following: Thanks for any help. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 4 replies
-
|
It looks like your project is being reported as 100% MatLab at this point. The job that calculates code frequency doesn’t run immediately so it can take a little while for things to update once you’ve uploaded a .gitattributes file. Things look good now though 👍 |
Beta Was this translation helpful? Give feedback.
-
|
Hi, thanks for the reply. I can see that it says 100% MATLAB, so it seems that part is indeed working well. However, under Insights->Pulse, it claims that I have so far made 21390 additions, which is apparently counting the data files I uploaded. Is there any way to fix this? |
Beta Was this translation helpful? Give feedback.
-
No, there isn’t. If you want to exclude data files from all of the stats reported about your repository then you should probably store the data files somewhere outside of the repository. |
Beta Was this translation helpful? Give feedback.
-
|
The problem described by @engelsen is not related to git repo, but to the statistics counting tool. The tool is not flexible enough to support required scenario. On my projects I also have “data” files or “generated code” which I must commit to the repo. package-lock.json can take 40 000 lines and must be commited for repo to work properly. Test data can take kilo-megabytes and also msut be commited for tests to work for everyone who clones the repo, including CI machines. I wasn’t able to find “dislike” or “lower votes” for this message and think it is inappropriate solution. |
Beta Was this translation helpful? Give feedback.
-
|
|
Beta Was this translation helpful? Give feedback.
-
|
Try this https://proandroiddev.com/removing-noise-from-your-github-language-stats-e96113f8183d |
Beta Was this translation helpful? Give feedback.
-
|
Same thing. Data files sometimes need to be updated in the repository, but it feels silly it's counting as additions/deletions, and it would be nice to ignore specific files (preferrably retro-actively too, for example let the user set the start date and end date optionally for a stat ignored file path). |
Beta Was this translation helpful? Give feedback.
-
|
I found this issue a few days ago because I was also in this dilemma, I wanted to exclude some files from being counted as part of code_frequency, so I built this tool https://www.npmjs.com/package/git-repo-lines-of-code/v/1.0.2, this solved the problem for me. You will pass in the relative paths of the files you want to exclude as an array of strings along with your repository details also. |
Beta Was this translation helpful? Give feedback.
No, there isn’t. If you want to exclude data files from all of the stats reported about your repository then you should probably store the data files somewhere outside of the repository.