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:
Miguel Molina
2020-05-27 15:07:57 +02:00
parent bda45fdc8e
commit 8ff885a3a8
54 changed files with 4513 additions and 98 deletions

View File

@ -0,0 +1,2 @@
.accordion{padding:0;margin:0;position:relative;list-style:none}.accordion>*{position:absolute;overflow:hidden;padding:0;margin:0}.accordion .accordion,.accordion.edge-visible,.accordion>*{-webkit-transition:.3s ease all;-moz-transition:.3s ease all;-o-transition:.3s ease all;transition:.3s ease all}.accordion,.accordion>*{will-change:height,transform;-webkit-perspective:90em;-moz-perspective:90em;perspective:90em;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translateY(0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.snap.accordion .accordion,.snap.accordion>*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.accordion>*>:first-child{cursor:pointer;margin:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.accordion>*>:last-child{overflow:hidden;-webkit-transition:.3s ease height,.3s step-start visibility;-moz-transition:.3s ease height,.3s step-start visibility;-o-transition:.3s ease height,.3s step-start visibility;transition:.3s ease height,.3s step-start visibility}.accordion>.closed .accordion>.open>:last-child,.accordion>.closed>:last-child{-webkit-transition-timing-function:ease,step-end;-moz-transition-timing-function:ease,step-end;-o-transition-timing-function:ease,step-end;transition-timing-function:ease,step-end;visibility:hidden}
/*# sourceMappingURL=linked.css.map */