github-linguist 2.9.7 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3f06b9230afcfcea464a68df82268ec42c98030
4
- data.tar.gz: 67e84ae38ba71cbb8c0dca2763a0d060bf764b84
3
+ metadata.gz: d32dfca063a58b4fdda048d20fbf9ee735a87a47
4
+ data.tar.gz: 8603ce6993bb645e7d847f991142436d999c5e96
5
5
  SHA512:
6
- metadata.gz: 09205a528b8b4903b5f8ecbbebd740fdfaccb71704fad5fba13de2261689094b6a60605cc03db997a9d3830f84c4bdfe0e26033d823c90a4230f7cdfdc0e1422
7
- data.tar.gz: f10dd819715aa9295d3e031097aecf68cb3ce66eb3553ec191d91155ec145de009c74245cc996877d77dd0510f45800808b68c5515e4a2a655f8f92009e67eb9
6
+ metadata.gz: db134aedc386ccc175b578474a84c75391814b235e01da962b6d2483453cfc80dec48670c5a23c65930fb723c92a0ca48df320c24eeead87fedbe5c6a21a448f
7
+ data.tar.gz: 89195a956fe06ab069fff7c4bf61c2324cb397964d818fcd7926eb8548b56e58ad73bf566b9cedd88275d10def55e3909e715bd686754b45b83e0aaacbb717b3
data/bin/linguist CHANGED
@@ -12,8 +12,9 @@ path = ARGV[0] || Dir.pwd
12
12
  if File.directory?(path)
13
13
  repo = Linguist::Repository.from_directory(path)
14
14
  repo.languages.sort_by { |_, size| size }.reverse.each do |language, size|
15
- percentage = ((size / repo.size.to_f) * 100).round
16
- puts "%-4s %s" % ["#{percentage}%", language]
15
+ percentage = ((size / repo.size.to_f) * 100)
16
+ percentage = sprintf '%.2f' % percentage
17
+ puts "%-7s %s" % ["#{percentage}%", language]
17
18
  end
18
19
  elsif File.file?(path)
19
20
  blob = Linguist::FileBlob.new(path, Dir.pwd)
@@ -15,8 +15,8 @@ module Linguist
15
15
  #
16
16
  # Returns nothing.
17
17
  #
18
- # Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token,
19
- # per-language. See also dump_all_tokens, below.
18
+ # Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token or
19
+ # per-language. See also #dump_all_tokens, below.
20
20
  def self.train!(db, language, data)
21
21
  tokens = Tokenizer.tokenize(data)
22
22
 
@@ -151,10 +151,10 @@ module Linguist
151
151
  printf "%#{maxlen}s", ""
152
152
  puts " #" + languages.map { |lang| sprintf("%10s", lang) }.join
153
153
 
154
- tokmap = Hash.new(0)
155
- tokens.each { |tok| tokmap[tok] += 1 }
154
+ token_map = Hash.new(0)
155
+ tokens.each { |tok| token_map[tok] += 1 }
156
156
 
157
- tokmap.sort.each { |tok, count|
157
+ token_map.sort.each { |tok, count|
158
158
  arr = languages.map { |lang| [lang, token_probability(tok, lang)] }
159
159
  min = arr.map { |a,b| b }.min
160
160
  minlog = Math.log(min)
@@ -58,7 +58,9 @@ module Linguist
58
58
  generated_parser? ||
59
59
  generated_net_docfile? ||
60
60
  generated_net_designer_file? ||
61
- generated_protocol_buffer?
61
+ generated_protocol_buffer? ||
62
+ generated_jni_header? ||
63
+ node_modules?
62
64
  end
63
65
 
64
66
  # Internal: Is the blob an XCode project file?
@@ -73,14 +75,16 @@ module Linguist
73
75
 
74
76
  # Internal: Is the blob minified files?
75
77
  #
76
- # Consider a file minified if it contains more than 5% spaces.
78
+ # Consider a file minified if the average line length is
79
+ # greater then 110c.
80
+ #
77
81
  # Currently, only JS and CSS files are detected by this method.
78
82
  #
79
83
  # Returns true or false.
80
84
  def minified_files?
81
85
  return unless ['.js', '.css'].include? extname
82
- if data && data.length > 200
83
- (data.each_char.count{ |c| c <= ' ' } / data.length.to_f) < 0.05
86
+ if lines.any?
87
+ (lines.inject(0) { |n, l| n += l.length } / lines.length) > 110
84
88
  else
85
89
  false
86
90
  end
@@ -181,5 +185,24 @@ module Linguist
181
185
 
182
186
  return lines[0].include?("Generated by the protocol buffer compiler. DO NOT EDIT!")
183
187
  end
188
+
189
+ # Internal: Is the blob a C/C++ header generated by the Java JNI tool javah?
190
+ #
191
+ # Returns true of false.
192
+ def generated_jni_header?
193
+ return false unless extname == '.h'
194
+ return false unless lines.count > 2
195
+
196
+ return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */") &&
197
+ lines[1].include?("#include <jni.h>")
198
+ end
199
+
200
+ # node_modules/ can contain large amounts of files, in general not meant
201
+ # for humans in pull requests.
202
+ #
203
+ # Returns true or false.
204
+ def node_modules?
205
+ !!name.match(/node_modules\//)
206
+ end
184
207
  end
185
208
  end
@@ -1,6 +1,10 @@
1
1
  require 'escape_utils'
2
2
  require 'pygments'
3
3
  require 'yaml'
4
+ begin
5
+ require 'json'
6
+ rescue LoadError
7
+ end
4
8
 
5
9
  require 'linguist/classifier'
6
10
  require 'linguist/samples'
@@ -27,7 +31,7 @@ module Linguist
27
31
  #
28
32
  # Returns an array
29
33
  def self.detectable_markup
30
- ["CSS", "Less", "Sass"]
34
+ ["CSS", "Less", "Sass", "TeX"]
31
35
  end
32
36
 
33
37
  # Internal: Create a new Language object
@@ -455,7 +459,16 @@ module Linguist
455
459
  filenames = Samples::DATA['filenames']
456
460
  popular = YAML.load_file(File.expand_path("../popular.yml", __FILE__))
457
461
 
458
- YAML.load_file(File.expand_path("../languages.yml", __FILE__)).each do |name, options|
462
+ languages_yml = File.expand_path("../languages.yml", __FILE__)
463
+ languages_json = File.expand_path("../languages.json", __FILE__)
464
+
465
+ if File.exist?(languages_json) && defined?(JSON)
466
+ languages = JSON.load(File.read(languages_json))
467
+ else
468
+ languages = YAML.load_file(languages_yml)
469
+ end
470
+
471
+ languages.each do |name, options|
459
472
  options['extensions'] ||= []
460
473
  options['filenames'] ||= []
461
474
 
@@ -29,6 +29,12 @@ ABAP:
29
29
  lexer: ABAP
30
30
  primary_extension: .abap
31
31
 
32
+ ANTLR:
33
+ type: programming
34
+ color: "#9DC3FF"
35
+ lexer: ANTLR
36
+ primary_extension: .g4
37
+
32
38
  ASP:
33
39
  type: programming
34
40
  color: "#6a40fd"
@@ -62,6 +68,10 @@ Ada:
62
68
  extensions:
63
69
  - .ads
64
70
 
71
+ Agda:
72
+ type: programming
73
+ primary_extension: .agda
74
+
65
75
  ApacheConf:
66
76
  type: markup
67
77
  aliases:
@@ -112,11 +122,21 @@ AutoHotkey:
112
122
  - ahk
113
123
  primary_extension: .ahk
114
124
 
125
+ AutoIt:
126
+ type: programming
127
+ color: "#36699B"
128
+ aliases:
129
+ - au3
130
+ - AutoIt3
131
+ - AutoItScript
132
+ primary_extension: .au3
133
+
115
134
  Awk:
116
135
  type: programming
117
136
  lexer: Awk
118
137
  primary_extension: .awk
119
138
  extensions:
139
+ - .auk
120
140
  - .gawk
121
141
  - .mawk
122
142
  - .nawk
@@ -134,9 +154,23 @@ Batchfile:
134
154
  Befunge:
135
155
  primary_extension: .befunge
136
156
 
157
+ BlitzBasic:
158
+ type: programming
159
+ aliases:
160
+ - blitzplus
161
+ - blitz3d
162
+ primary_extension: .bb
163
+ extensions:
164
+ - .decls
165
+
137
166
  BlitzMax:
138
167
  primary_extension: .bmx
139
168
 
169
+ Bluespec:
170
+ type: programming
171
+ lexer: verilog
172
+ primary_extension: .bsv
173
+
140
174
  Boo:
141
175
  type: programming
142
176
  color: "#d4bec1"
@@ -184,8 +218,10 @@ C++:
184
218
  - .H
185
219
  - .h++
186
220
  - .hh
221
+ - .hpp
187
222
  - .hxx
188
223
  - .tcc
224
+ - .tpp
189
225
 
190
226
  C-ObjDump:
191
227
  type: data
@@ -235,14 +271,26 @@ ChucK:
235
271
  lexer: Java
236
272
  primary_extension: .ck
237
273
 
274
+ Clean:
275
+ type: programming
276
+ color: "#3a81ad"
277
+ lexer: Text only
278
+ primary_extension: .icl
279
+ extensions:
280
+ - .dcl
281
+
238
282
  Clojure:
239
283
  type: programming
240
284
  ace_mode: clojure
241
285
  color: "#db5855"
242
286
  primary_extension: .clj
243
287
  extensions:
288
+ - .cl2
289
+ - .cljc
244
290
  - .cljs
291
+ - .cljscm
245
292
  - .cljx
293
+ - .hic
246
294
  filenames:
247
295
  - riemann.config
248
296
 
@@ -281,6 +329,7 @@ Common Lisp:
281
329
  primary_extension: .lisp
282
330
  extensions:
283
331
  - .asd
332
+ - .cl
284
333
  - .lsp
285
334
  - .ny
286
335
  - .podsl
@@ -301,6 +350,12 @@ Cucumber:
301
350
  lexer: Gherkin
302
351
  primary_extension: .feature
303
352
 
353
+ Cuda:
354
+ lexer: CUDA
355
+ primary_extension: .cu
356
+ extensions:
357
+ - .cuh
358
+
304
359
  Cython:
305
360
  type: programming
306
361
  group: Python
@@ -321,6 +376,14 @@ D-ObjDump:
321
376
  lexer: d-objdump
322
377
  primary_extension: .d-objdump
323
378
 
379
+ DM:
380
+ type: programming
381
+ color: "#075ff1"
382
+ lexer: Text only
383
+ primary_extension: .dm
384
+ aliases:
385
+ - byond
386
+
324
387
  DOT:
325
388
  type: programming
326
389
  lexer: Text only
@@ -338,6 +401,7 @@ Darcs Patch:
338
401
 
339
402
  Dart:
340
403
  type: programming
404
+ color: "#98BAD6"
341
405
  primary_extension: .dart
342
406
 
343
407
  DCPU-16 ASM:
@@ -363,7 +427,7 @@ Ecere Projects:
363
427
  lexer: JSON
364
428
  primary_extension: .epj
365
429
 
366
- Ecl:
430
+ ECL:
367
431
  type: programming
368
432
  color: "#8a1267"
369
433
  primary_extension: .ecl
@@ -397,6 +461,8 @@ Emacs Lisp:
397
461
  - elisp
398
462
  - emacs
399
463
  primary_extension: .el
464
+ filenames:
465
+ - .emacs
400
466
  extensions:
401
467
  - .emacs
402
468
 
@@ -512,6 +578,12 @@ Gettext Catalog:
512
578
  extensions:
513
579
  - .pot
514
580
 
581
+ Glyph:
582
+ type: programming
583
+ color: "#e4cc98"
584
+ lexer: Tcl
585
+ primary_extension: .glf
586
+
515
587
  Go:
516
588
  type: programming
517
589
  color: "#a89b4d"
@@ -612,7 +684,6 @@ Haskell:
612
684
 
613
685
  Haxe:
614
686
  type: programming
615
- lexer: haXe
616
687
  ace_mode: haxe
617
688
  color: "#346d51"
618
689
  primary_extension: .hx
@@ -627,6 +698,17 @@ INI:
627
698
  - .properties
628
699
  primary_extension: .ini
629
700
 
701
+ Idris:
702
+ type: programming
703
+ lexer: Text only
704
+ primary_extension: .idr
705
+ extensions:
706
+ - .lidr
707
+
708
+ Inno Setup:
709
+ primary_extension: .iss
710
+ lexer: Text only
711
+
630
712
  IRC log:
631
713
  lexer: IRC logs
632
714
  search_term: irc
@@ -657,6 +739,21 @@ JSON:
657
739
  ace_mode: json
658
740
  searchable: false
659
741
  primary_extension: .json
742
+ extensions:
743
+ - .sublime-keymap
744
+ - .sublime_metrics
745
+ - .sublime-mousemap
746
+ - .sublime-project
747
+ - .sublime_session
748
+ - .sublime-settings
749
+ - .sublime-workspace
750
+ filenames:
751
+ - composer.lock
752
+
753
+ Jade:
754
+ group: HTML
755
+ type: markup
756
+ primary_extension: .jade
660
757
 
661
758
  Java:
662
759
  type: programming
@@ -699,6 +796,12 @@ Julia:
699
796
  primary_extension: .jl
700
797
  color: "#a270ba"
701
798
 
799
+ KRL:
800
+ lexer: Text only
801
+ type: programming
802
+ color: "#f5c800"
803
+ primary_extension: .krl
804
+
702
805
  Kotlin:
703
806
  type: programming
704
807
  primary_extension: .kt
@@ -719,7 +822,6 @@ LLVM:
719
822
  Lasso:
720
823
  type: programming
721
824
  lexer: Lasso
722
- ace_mode: lasso
723
825
  color: "#2584c3"
724
826
  primary_extension: .lasso
725
827
 
@@ -727,7 +829,6 @@ Less:
727
829
  type: markup
728
830
  group: CSS
729
831
  lexer: CSS
730
- ace_mode: less
731
832
  primary_extension: .less
732
833
 
733
834
  LilyPond:
@@ -736,6 +837,13 @@ LilyPond:
736
837
  extensions:
737
838
  - .ily
738
839
 
840
+ Literate Agda:
841
+ type: programming
842
+ group: Agda
843
+ primary_extension: .lagda
844
+ extensions:
845
+ - .lagda
846
+
739
847
  Literate CoffeeScript:
740
848
  type: programming
741
849
  group: CoffeeScript
@@ -836,15 +944,17 @@ Matlab:
836
944
  Max:
837
945
  type: programming
838
946
  color: "#ce279c"
839
- lexer: Text only
947
+ lexer: JSON
840
948
  aliases:
841
949
  - max/msp
842
950
  - maxmsp
843
951
  search_term: max/msp
844
- primary_extension: .mxt
952
+ primary_extension: .maxpat
845
953
  extensions:
846
954
  - .maxhelp
847
- - .maxpat
955
+ - .maxproj
956
+ - .mxt
957
+ - .pat
848
958
 
849
959
  MiniD: # Legacy
850
960
  searchable: false
@@ -885,6 +995,12 @@ Nemerle:
885
995
  color: "#0d3c6e"
886
996
  primary_extension: .n
887
997
 
998
+ NetLogo:
999
+ type: programming
1000
+ lexer: Common Lisp
1001
+ color: "#ff2b2b"
1002
+ primary_extension: .nlogo
1003
+
888
1004
  Nginx:
889
1005
  type: markup
890
1006
  lexer: Nginx configuration file
@@ -975,6 +1091,12 @@ OpenEdge ABL:
975
1091
  - abl
976
1092
  primary_extension: .p
977
1093
 
1094
+ Oxygene:
1095
+ type: programming
1096
+ lexer: Text only
1097
+ color: "#5a63a3"
1098
+ primary_extension: .oxygene
1099
+
978
1100
  PHP:
979
1101
  type: programming
980
1102
  ace_mode: php
@@ -1056,6 +1178,9 @@ PowerShell:
1056
1178
  aliases:
1057
1179
  - posh
1058
1180
  primary_extension: .ps1
1181
+ extensions:
1182
+ - .psd1
1183
+ - .psm1
1059
1184
 
1060
1185
  Processing:
1061
1186
  type: programming
@@ -1070,6 +1195,13 @@ Prolog:
1070
1195
  extensions:
1071
1196
  - .pro
1072
1197
 
1198
+ Protocol Buffer:
1199
+ type: markup
1200
+ aliases:
1201
+ - protobuf
1202
+ - Protocol Buffers
1203
+ primary_extension: .proto
1204
+
1073
1205
  Puppet:
1074
1206
  type: programming
1075
1207
  color: "#cc5555"
@@ -1106,14 +1238,32 @@ Python traceback:
1106
1238
  searchable: false
1107
1239
  primary_extension: .pytb
1108
1240
 
1241
+ QML:
1242
+ type: markup
1243
+ color: "#44a51c"
1244
+ primary_extension: .qml
1245
+
1109
1246
  R:
1110
1247
  type: programming
1111
1248
  color: "#198ce7"
1112
1249
  lexer: S
1113
1250
  primary_extension: .r
1251
+ extensions:
1252
+ - .R
1114
1253
  filenames:
1115
1254
  - .Rprofile
1116
1255
 
1256
+ REALbasic:
1257
+ type: programming
1258
+ lexer: VB.net
1259
+ primary_extension: .rbbas
1260
+ extensions:
1261
+ - .rbfrm
1262
+ - .rbmnu
1263
+ - .rbres
1264
+ - .rbtbar
1265
+ - .rbuistate
1266
+
1117
1267
  RHTML:
1118
1268
  type: markup
1119
1269
  group: HTML
@@ -1152,6 +1302,12 @@ Rebol:
1152
1302
  Redcode:
1153
1303
  primary_extension: .cw
1154
1304
 
1305
+ RobotFramework:
1306
+ type: programming
1307
+ primary_extension: .robot
1308
+ # extensions:
1309
+ # - .txt
1310
+
1155
1311
  Rouge:
1156
1312
  type: programming
1157
1313
  lexer: Clojure
@@ -1175,6 +1331,7 @@ Ruby:
1175
1331
  - .gemspec
1176
1332
  - .god
1177
1333
  - .irbrc
1334
+ - .mspec
1178
1335
  - .podspec
1179
1336
  - .rbuild
1180
1337
  - .rbw
@@ -1183,6 +1340,7 @@ Ruby:
1183
1340
  - .thor
1184
1341
  - .watchr
1185
1342
  filenames:
1343
+ - Appraisals
1186
1344
  - Berksfile
1187
1345
  - Gemfile
1188
1346
  - Guardfile
@@ -1224,6 +1382,11 @@ Scala:
1224
1382
  color: "#7dd3b0"
1225
1383
  primary_extension: .scala
1226
1384
 
1385
+ Scaml:
1386
+ group: HTML
1387
+ type: markup
1388
+ primary_extension: .scaml
1389
+
1227
1390
  Scheme:
1228
1391
  type: programming
1229
1392
  color: "#1e4aec"
@@ -1302,6 +1465,8 @@ Tcl:
1302
1465
  type: programming
1303
1466
  color: "#e4cc98"
1304
1467
  primary_extension: .tcl
1468
+ extensions:
1469
+ - .adp
1305
1470
 
1306
1471
  Tcsh:
1307
1472
  type: programming
@@ -1322,6 +1487,9 @@ TeX:
1322
1487
  - .dtx
1323
1488
  - .ins
1324
1489
  - .ltx
1490
+ - .mkii
1491
+ - .mkiv
1492
+ - .mkvi
1325
1493
  - .sty
1326
1494
  - .toc
1327
1495
 
@@ -1365,6 +1533,12 @@ Unified Parallel C:
1365
1533
  color: "#755223"
1366
1534
  primary_extension: .upc
1367
1535
 
1536
+ UnrealScript:
1537
+ type: programming
1538
+ color: "#a54c4d"
1539
+ lexer: Java
1540
+ primary_extension: .uc
1541
+
1368
1542
  VHDL:
1369
1543
  type: programming
1370
1544
  lexer: vhdl
@@ -1384,9 +1558,7 @@ Verilog:
1384
1558
  color: "#848bf3"
1385
1559
  primary_extension: .v
1386
1560
  extensions:
1387
- - .sv
1388
- - .svh
1389
- - .vh
1561
+ - .veo
1390
1562
 
1391
1563
  VimL:
1392
1564
  type: programming
@@ -1396,6 +1568,7 @@ VimL:
1396
1568
  - vim
1397
1569
  primary_extension: .vim
1398
1570
  filenames:
1571
+ - .vimrc
1399
1572
  - vimrc
1400
1573
  - gvimrc
1401
1574
 
@@ -1406,6 +1579,7 @@ Visual Basic:
1406
1579
  primary_extension: .vb
1407
1580
  extensions:
1408
1581
  - .bas
1582
+ - .frm
1409
1583
  - .frx
1410
1584
  - .vba
1411
1585
  - .vbs
@@ -1432,6 +1606,8 @@ XML:
1432
1606
  extensions:
1433
1607
  - .axml
1434
1608
  - .ccxml
1609
+ - .clixml
1610
+ - .cproject
1435
1611
  - .dita
1436
1612
  - .ditamap
1437
1613
  - .ditaval
@@ -1439,12 +1615,17 @@ XML:
1439
1615
  - .grxml
1440
1616
  - .jelly
1441
1617
  - .kml
1618
+ - .launch
1442
1619
  - .mxml
1443
1620
  - .plist
1621
+ - .pluginspec
1622
+ - .ps1xml
1623
+ - .psc1
1444
1624
  - .pt
1445
1625
  - .rdf
1446
1626
  - .rss
1447
1627
  - .scxml
1628
+ - .srdf
1448
1629
  - .svg
1449
1630
  - .tmCommand
1450
1631
  - .tmLanguage
@@ -1453,12 +1634,14 @@ XML:
1453
1634
  - .tmTheme
1454
1635
  - .tml
1455
1636
  - .ui
1637
+ - .urdf
1456
1638
  - .vxml
1457
1639
  - .wsdl
1458
1640
  - .wxi
1459
1641
  - .wxl
1460
1642
  - .wxs
1461
1643
  - .x3d
1644
+ - .xacro
1462
1645
  - .xaml
1463
1646
  - .xlf
1464
1647
  - .xliff
@@ -1469,6 +1652,7 @@ XML:
1469
1652
  filenames:
1470
1653
  - .classpath
1471
1654
  - .project
1655
+ - phpunit.xml.dist
1472
1656
 
1473
1657
  XProc:
1474
1658
  type: programming
@@ -1483,6 +1667,8 @@ XQuery:
1483
1667
  primary_extension: .xquery
1484
1668
  extensions:
1485
1669
  - .xq
1670
+ - .xql
1671
+ - .xqm
1486
1672
  - .xqy
1487
1673
 
1488
1674
  XS:
@@ -1508,6 +1694,7 @@ YAML:
1508
1694
  primary_extension: .yml
1509
1695
  extensions:
1510
1696
  - .reek
1697
+ - .rviz
1511
1698
  - .yaml
1512
1699
 
1513
1700
  eC:
@@ -1534,6 +1721,11 @@ mupad:
1534
1721
  lexer: MuPAD
1535
1722
  primary_extension: .mu
1536
1723
 
1724
+ nesC:
1725
+ type: programming
1726
+ color: "#ffce3b"
1727
+ primary_extension: .nc
1728
+
1537
1729
  ooc:
1538
1730
  type: programming
1539
1731
  lexer: Ooc
@@ -1556,3 +1748,9 @@ wisp:
1556
1748
  ace_mode: clojure
1557
1749
  color: "#7582D1"
1558
1750
  primary_extension: .wisp
1751
+
1752
+ xBase:
1753
+ type: programming
1754
+ lexer: Text only
1755
+ color: "#3a4040"
1756
+ primary_extension: .prg