Nixinova / LinguistJS

Analyse and list all languages used in a folder. Implementation of and powered by GitHub's Linguist.
ISC License
39 stars 12 forks source link

Attributes wildcards do not match into subfolders #17

Closed Nixinova closed 1 year ago

Nixinova commented 1 year ago

When parsing gitattributes files, **/*.ext is treated differently from *.ext. *.ext is treated the same as ./*.ext while **/*.ext is the one that matches into subfolders. GitHub Linguist treats these the same.


Using a .gitattributes of *.ext linguist-language=Lang:`

  1. File structure of .gitattributes, file.ext. Result: file classified as Lang.
  2. File structure of .gitattributes, folder/file.ext. Result: under 'Unknown files and extensions'.

Running with versions 2.4.0 vs 2.4.1 https://github.com/Nixinova/LinguistJS/compare/2.4.0...2.4.1

Relevant changes in v 2.4.1:

- "glob-to-regexp": "~0.4.1",
+ "ignore": "^5.2.0",
Output difference ``` >npx linguist-js@2.4.0 -a Need to install the following packages: linguist-js@2.4.0 Ok to proceed? (y) y Analysed 1,633 B from 1 files with linguist-js Language analysis results: 1. █ Less 100.00% 1,633 B Total: 1,633 B >npx linguist-js@2.4.1 -a Need to install the following packages: linguist-js@2.4.1 Ok to proceed? (y) y Analysed 1,633 B from 1 files with linguist-js Language analysis results: None Total: 0 B Unknown files and extensions: '*.ext': 1,633 B Total: 1,633 B ```
Nixinova commented 1 year ago

This is because *.ext whatever is parsed into overridesArray as /*.ext - a qualified path