mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Detect CoffeeScript with generated comment
This commit is contained in:
@@ -280,6 +280,11 @@ module Linguist
|
||||
def generated_coffeescript?
|
||||
return unless extname == '.js'
|
||||
|
||||
# CoffeeScript generated by > 1.2 include a comment on the first line
|
||||
if lines[0] =~ /^\/\/ Generated by /
|
||||
return true
|
||||
end
|
||||
|
||||
if lines[0] == '(function() {' && # First line is module closure opening
|
||||
lines[-2] == '}).call(this);' && # Second to last line closes module closure
|
||||
lines[-1] == '' # Last line is blank
|
||||
|
||||
Reference in New Issue
Block a user