mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-18 22:23:07 -03:00
implement IsGenerated helper to filter out generated files
Closes #17 Implements the IsGenerated helper function to filter out generated files using the rules and matchers in: - https://github.com/github/linguist/blob/master/lib/linguist/generated.rb Since the vast majority of matchers have very different logic, it cannot be autogenerated directly from linguist like other logics in enry, so it's translated by hand. There are three different types of matchers in this implementation: - By extension, which mark as generated based only in the extension. These are the fastest matchers, so they're done first. - By file name, which matches patterns against the filename. These are performed in second place. Unlike linguist, we try to use string functions instead of regexps as much as possible. - Finally, the rest of the matchers, which go into the content and try to identify if they're generated or not based on the content. Unlike linguist, we try to only read the content we need and not split it all unless it's necessary and use byte functions instead of regexps as much as possible. Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
This commit is contained in:
1
_testdata/Data/bootstrap.css.map
Normal file
1
_testdata/Data/bootstrap.css.map
Normal file
File diff suppressed because one or more lines are too long
12
_testdata/Data/sourcemap.v1.map
Normal file
12
_testdata/Data/sourcemap.v1.map
Normal file
@ -0,0 +1,12 @@
|
||||
/** Begin line maps. **/{ “file”:”out.js”, "count": 2 }
|
||||
[0,0,0,0,0,0,1,1,1,1,2]
|
||||
[2,2,2,2,2,2,3,4,4,4,4,4]
|
||||
/** Begin file information. **/
|
||||
[“a.js”, “b.js”]
|
||||
[“b.js”, “c.js”, “d.js”]
|
||||
/** Begin mapping definitions. **/
|
||||
["a.js", 1, 34]
|
||||
["a.js", 5, 2]
|
||||
["b.js", 1, 3, "event"]
|
||||
["c.js", 1, 4]
|
||||
["d.js", 3, 78, "foo"]
|
1
_testdata/Data/sourcemap.v3.map
Normal file
1
_testdata/Data/sourcemap.v3.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"out.js","sourceRoot":"","sources":["foo.js","bar.js"],"sourcesContent":[null,null],"names":["src","maps","are","fun"],"mappings":"A,AAAB;;ABCDE;"}
|
Reference in New Issue
Block a user