github-linguist 8.0.1 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/grammars/go.mod.json +1 -1
  3. data/grammars/markdown.vue.codeblock.json +1 -0
  4. data/grammars/mdx.vue.codeblock.json +1 -0
  5. data/grammars/source.QB64.json +1 -0
  6. data/grammars/source.abap.json +1 -1
  7. data/grammars/source.abl.json +1 -1
  8. data/grammars/source.angelscript.json +1 -1
  9. data/grammars/source.basic.json +1 -1
  10. data/grammars/source.bb.json +1 -1
  11. data/grammars/source.brs.json +1 -1
  12. data/grammars/source.bsl.json +1 -1
  13. data/grammars/source.cmake.json +1 -1
  14. data/grammars/source.cmakecache.json +1 -0
  15. data/grammars/source.cobol.json +1 -1
  16. data/grammars/source.dart.json +1 -1
  17. data/grammars/source.fsharp.json +1 -1
  18. data/grammars/source.gdscript.json +1 -1
  19. data/grammars/source.graphql.json +1 -1
  20. data/grammars/source.hcl.json +1 -1
  21. data/grammars/source.hcl.terraform.json +1 -1
  22. data/grammars/source.julia.json +1 -1
  23. data/grammars/source.just.json +1 -1
  24. data/grammars/source.luau.json +1 -1
  25. data/grammars/source.matlab.json +1 -1
  26. data/grammars/source.mdx.astro.json +1 -0
  27. data/grammars/source.mdx.json +1 -1
  28. data/grammars/source.moonbit.json +1 -0
  29. data/grammars/source.msg.json +1 -0
  30. data/grammars/source.ned.json +1 -0
  31. data/grammars/source.nushell.json +1 -1
  32. data/grammars/source.odin.json +1 -1
  33. data/grammars/source.openesql.json +1 -0
  34. data/grammars/source.p4.json +1 -1
  35. data/grammars/source.polar.json +1 -1
  36. data/grammars/source.powerbuilder.json +1 -1
  37. data/grammars/source.rescript.json +1 -1
  38. data/grammars/source.rpgle.json +1 -1
  39. data/grammars/source.scala.json +1 -1
  40. data/grammars/source.sdbl.json +1 -1
  41. data/grammars/source.tact.json +1 -0
  42. data/grammars/source.toc.json +1 -1
  43. data/grammars/source.ts.json +1 -1
  44. data/grammars/source.tsp.json +1 -0
  45. data/grammars/source.tsx.json +1 -1
  46. data/grammars/source.vba.json +1 -1
  47. data/grammars/source.vue.json +1 -0
  48. data/grammars/source.wdl.json +1 -1
  49. data/grammars/text.adblock.json +1 -1
  50. data/grammars/text.md.json +1 -1
  51. data/grammars/version +1 -1
  52. data/grammars/vue.directives.json +1 -0
  53. data/grammars/vue.interpolations.json +1 -0
  54. data/grammars/vue.sfc.style.variable.injection.json +1 -0
  55. data/lib/linguist/VERSION +1 -1
  56. data/lib/linguist/generated.rb +31 -0
  57. data/lib/linguist/generic.yml +1 -0
  58. data/lib/linguist/heuristics.yml +55 -11
  59. data/lib/linguist/languages.json +1 -1
  60. data/lib/linguist/languages.yml +93 -3
  61. data/lib/linguist/lazy_blob.rb +15 -7
  62. data/lib/linguist/repository.rb +18 -13
  63. data/lib/linguist/samples.json +1 -1
  64. data/lib/linguist/source/diff.rb +72 -0
  65. data/lib/linguist/source/repository.rb +64 -0
  66. data/lib/linguist/source/rugged.rb +95 -0
  67. metadata +21 -6
  68. data/grammars/source.cache.cmake.json +0 -1
  69. data/grammars/text.html.vue.json +0 -1
  70. data/grammars/text.mdx.astro.codeblock.json +0 -1
@@ -908,7 +908,7 @@ CSS:
908
908
  ace_mode: css
909
909
  codemirror_mode: css
910
910
  codemirror_mime_type: text/css
911
- color: "#563d7c"
911
+ color: "#663399"
912
912
  extensions:
913
913
  - ".css"
914
914
  language_id: 50
@@ -1632,6 +1632,7 @@ Dockerfile:
1632
1632
  tm_scope: source.dockerfile
1633
1633
  extensions:
1634
1634
  - ".dockerfile"
1635
+ - ".containerfile"
1635
1636
  filenames:
1636
1637
  - Containerfile
1637
1638
  - Dockerfile
@@ -2166,7 +2167,7 @@ Fortran Free Form:
2166
2167
  codemirror_mode: fortran
2167
2168
  codemirror_mime_type: text/x-fortran
2168
2169
  language_id: 761352333
2169
- FreeBasic:
2170
+ FreeBASIC:
2170
2171
  type: programming
2171
2172
  color: "#141AC9"
2172
2173
  extensions:
@@ -2945,6 +2946,14 @@ Harbour:
2945
2946
  tm_scope: source.harbour
2946
2947
  ace_mode: text
2947
2948
  language_id: 156
2949
+ Hare:
2950
+ type: programming
2951
+ color: "#9d7424"
2952
+ extensions:
2953
+ - ".ha"
2954
+ ace_mode: text
2955
+ language_id: 463518941
2956
+ tm_scope: none
2948
2957
  Haskell:
2949
2958
  type: programming
2950
2959
  color: "#5e5086"
@@ -3058,6 +3067,7 @@ INI:
3058
3067
  - ".properties"
3059
3068
  - ".url"
3060
3069
  filenames:
3070
+ - ".buckconfig"
3061
3071
  - ".coveragerc"
3062
3072
  - ".flake8"
3063
3073
  - ".pylintrc"
@@ -3111,9 +3121,11 @@ Ignore List:
3111
3121
  - ".coffeelintignore"
3112
3122
  - ".cvsignore"
3113
3123
  - ".dockerignore"
3124
+ - ".easignore"
3114
3125
  - ".eleventyignore"
3115
3126
  - ".eslintignore"
3116
3127
  - ".gitignore"
3128
+ - ".ignore"
3117
3129
  - ".markdownlintignore"
3118
3130
  - ".nodemonignore"
3119
3131
  - ".npmignore"
@@ -3270,9 +3282,11 @@ JSON:
3270
3282
  - ".har"
3271
3283
  - ".ice"
3272
3284
  - ".JSON-tmLanguage"
3285
+ - ".json.example"
3273
3286
  - ".jsonl"
3274
3287
  - ".mcmeta"
3275
3288
  - ".sarif"
3289
+ - ".tact"
3276
3290
  - ".tfstate"
3277
3291
  - ".tfstate.backup"
3278
3292
  - ".topojson"
@@ -4489,6 +4503,14 @@ Moocode:
4489
4503
  tm_scope: none
4490
4504
  ace_mode: text
4491
4505
  language_id: 237
4506
+ MoonBit:
4507
+ type: programming
4508
+ color: "#b92381"
4509
+ extensions:
4510
+ - ".mbt"
4511
+ tm_scope: source.moonbit
4512
+ ace_mode: text
4513
+ language_id: 181453007
4492
4514
  MoonScript:
4493
4515
  type: programming
4494
4516
  color: "#ff4585"
@@ -5835,6 +5857,22 @@ Quake:
5835
5857
  ace_mode: text
5836
5858
  tm_scope: source.quake
5837
5859
  language_id: 375265331
5860
+ QuickBASIC:
5861
+ type: programming
5862
+ color: "#008080"
5863
+ extensions:
5864
+ - ".bas"
5865
+ tm_scope: source.QB64
5866
+ aliases:
5867
+ - qb
5868
+ - qbasic
5869
+ - qb64
5870
+ - classic qbasic
5871
+ - classic quickbasic
5872
+ ace_mode: text
5873
+ codemirror_mode: vb
5874
+ codemirror_mime_type: text/x-vb
5875
+ language_id: 593107205
5838
5876
  R:
5839
5877
  type: programming
5840
5878
  color: "#198CE7"
@@ -6522,6 +6560,11 @@ SRecode Template:
6522
6560
  SSH Config:
6523
6561
  type: data
6524
6562
  group: INI
6563
+ aliases:
6564
+ - sshconfig
6565
+ - sshdconfig
6566
+ - ssh_config
6567
+ - sshd_config
6525
6568
  filenames:
6526
6569
  - ssh-config
6527
6570
  - ssh_config
@@ -7013,6 +7056,7 @@ Starlark:
7013
7056
  - Tiltfile
7014
7057
  - WORKSPACE
7015
7058
  - WORKSPACE.bazel
7059
+ - WORKSPACE.bzlmod
7016
7060
  aliases:
7017
7061
  - bazel
7018
7062
  - bzl
@@ -7170,6 +7214,16 @@ TOML:
7170
7214
  codemirror_mode: toml
7171
7215
  codemirror_mime_type: text/x-toml
7172
7216
  language_id: 365
7217
+ TSPLIB data:
7218
+ aliases:
7219
+ - travelling salesman problem
7220
+ - traveling salesman problem
7221
+ type: data
7222
+ extensions:
7223
+ - ".tsp"
7224
+ tm_scope: none
7225
+ ace_mode: text
7226
+ language_id: 89289301
7173
7227
  TSQL:
7174
7228
  type: programming
7175
7229
  color: "#e38c00"
@@ -7208,6 +7262,14 @@ TXL:
7208
7262
  tm_scope: source.txl
7209
7263
  ace_mode: text
7210
7264
  language_id: 366
7265
+ Tact:
7266
+ type: programming
7267
+ color: "#48b5ff"
7268
+ extensions:
7269
+ - ".tact"
7270
+ ace_mode: text
7271
+ tm_scope: source.tact
7272
+ language_id: 606708469
7211
7273
  Talon:
7212
7274
  type: programming
7213
7275
  ace_mode: text
@@ -7465,6 +7527,16 @@ TypeScript:
7465
7527
  codemirror_mode: javascript
7466
7528
  codemirror_mime_type: application/typescript
7467
7529
  language_id: 378
7530
+ TypeSpec:
7531
+ type: programming
7532
+ color: "#4A3665"
7533
+ aliases:
7534
+ - tsp
7535
+ extensions:
7536
+ - ".tsp"
7537
+ tm_scope: source.tsp
7538
+ ace_mode: text
7539
+ language_id: 952272597
7468
7540
  Typst:
7469
7541
  type: programming
7470
7542
  color: "#239dad"
@@ -7755,7 +7827,7 @@ Vue:
7755
7827
  color: "#41b883"
7756
7828
  extensions:
7757
7829
  - ".vue"
7758
- tm_scope: text.html.vue
7830
+ tm_scope: source.vue
7759
7831
  ace_mode: html
7760
7832
  language_id: 391
7761
7833
  Vyper:
@@ -8254,9 +8326,11 @@ YAML:
8254
8326
  filenames:
8255
8327
  - ".clang-format"
8256
8328
  - ".clang-tidy"
8329
+ - ".clangd"
8257
8330
  - ".gemrc"
8258
8331
  - CITATION.cff
8259
8332
  - glide.lock
8333
+ - pixi.lock
8260
8334
  - yarn.lock
8261
8335
  ace_mode: yaml
8262
8336
  codemirror_mode: yaml
@@ -8532,6 +8606,22 @@ nesC:
8532
8606
  ace_mode: text
8533
8607
  tm_scope: source.nesc
8534
8608
  language_id: 417
8609
+ omnetpp-msg:
8610
+ type: programming
8611
+ extensions:
8612
+ - ".msg"
8613
+ color: "#a0e0a0"
8614
+ tm_scope: source.msg
8615
+ ace_mode: text
8616
+ language_id: 664100008
8617
+ omnetpp-ned:
8618
+ type: programming
8619
+ extensions:
8620
+ - ".ned"
8621
+ color: "#08607c"
8622
+ tm_scope: source.ned
8623
+ ace_mode: text
8624
+ language_id: 924868392
8535
8625
  ooc:
8536
8626
  type: programming
8537
8627
  color: "#b0b77e"
@@ -1,6 +1,7 @@
1
1
  require 'linguist/blob_helper'
2
2
  require 'linguist/language'
3
- require 'rugged'
3
+ require 'linguist/source/repository'
4
+ require 'linguist/source/rugged'
4
5
 
5
6
  module Linguist
6
7
  class LazyBlob
@@ -10,8 +11,11 @@ module Linguist
10
11
  'linguist-generated',
11
12
  'linguist-detectable']
12
13
 
13
- GIT_ATTR_OPTS = { :priority => [:index], :skip_system => true }
14
- GIT_ATTR_FLAGS = Rugged::Repository::Attributes.parse_opts(GIT_ATTR_OPTS)
14
+ # DEPRECATED: use Linguist::Source::RuggedRepository::GIT_ATTR_OPTS instead
15
+ GIT_ATTR_OPTS = Linguist::Source::RuggedRepository::GIT_ATTR_OPTS
16
+
17
+ # DEPRECATED: use Linguist::Source::RuggedRepository::GIT_ATTR_FLAGS instead
18
+ GIT_ATTR_FLAGS = Linguist::Source::RuggedRepository::GIT_ATTR_FLAGS
15
19
 
16
20
  include BlobHelper
17
21
 
@@ -25,7 +29,12 @@ module Linguist
25
29
  alias :name :path
26
30
 
27
31
  def initialize(repo, oid, path, mode = nil)
28
- @repository = repo
32
+ @repository = if repo.is_a? Linguist::Source::Repository
33
+ repo
34
+ else
35
+ # Allow this for backward-compatibility purposes
36
+ Linguist::Source::RuggedRepository.new(repo)
37
+ end
29
38
  @oid = oid
30
39
  @path = path
31
40
  @mode = mode
@@ -33,8 +42,7 @@ module Linguist
33
42
  end
34
43
 
35
44
  def git_attributes
36
- @git_attributes ||= repository.fetch_attributes(
37
- name, GIT_ATTR, GIT_ATTR_FLAGS)
45
+ @git_attributes ||= repository.load_attributes_for_path(name, GIT_ATTR)
38
46
  end
39
47
 
40
48
  def documentation?
@@ -106,7 +114,7 @@ module Linguist
106
114
  end
107
115
 
108
116
  def load_blob!
109
- @data, @size = Rugged::Blob.to_buffer(repository, oid, MAX_SIZE) if @data.nil?
117
+ @data, @size = repository.load_blob(oid, MAX_SIZE) if @data.nil?
110
118
  end
111
119
  end
112
120
  end
@@ -1,5 +1,6 @@
1
1
  require 'linguist/lazy_blob'
2
- require 'rugged'
2
+ require 'linguist/source/repository'
3
+ require 'linguist/source/rugged'
3
4
 
4
5
  module Linguist
5
6
  # A Repository is an abstraction of a Grit::Repo or a basic file
@@ -23,14 +24,19 @@ module Linguist
23
24
  # Public: Initialize a new Repository to be analyzed for language
24
25
  # data
25
26
  #
26
- # repo - a Rugged::Repository object
27
+ # repo - a Linguist::Source::Repository object
27
28
  # commit_oid - the sha1 of the commit that will be analyzed;
28
29
  # this is usually the master branch
29
30
  # max_tree_size - the maximum tree size to consider for analysis (default: MAX_TREE_SIZE)
30
31
  #
31
32
  # Returns a Repository
32
33
  def initialize(repo, commit_oid, max_tree_size = MAX_TREE_SIZE)
33
- @repository = repo
34
+ @repository = if repo.is_a? Linguist::Source::Repository
35
+ repo
36
+ else
37
+ # Allow this for backward-compatibility purposes
38
+ Linguist::Source::RuggedRepository.new(repo)
39
+ end
34
40
  @commit_oid = commit_oid
35
41
  @max_tree_size = max_tree_size
36
42
 
@@ -123,26 +129,25 @@ module Linguist
123
129
  end
124
130
 
125
131
  def read_index
126
- attr_index = Rugged::Index.new
127
- attr_index.read_tree(current_tree)
128
- repository.index = attr_index
132
+ raise NotImplementedError, "read_index is deprecated" unless repository.is_a? Linguist::Source::RuggedRepository
133
+ repository.set_attribute_source(@commit_oid)
129
134
  end
130
135
 
131
136
  def current_tree
132
- @tree ||= Rugged::Commit.lookup(repository, @commit_oid).tree
137
+ raise NotImplementedError, "current_tree is deprecated" unless repository.is_a? Linguist::Source::RuggedRepository
138
+ repository.get_tree(@commit_oid)
133
139
  end
134
140
 
135
141
  protected
136
142
  def compute_stats(old_commit_oid, cache = nil)
137
- return {} if current_tree.count_recursive(@max_tree_size) >= @max_tree_size
143
+ return {} if repository.get_tree_size(@commit_oid, @max_tree_size) >= @max_tree_size
138
144
 
139
- old_tree = old_commit_oid && Rugged::Commit.lookup(repository, old_commit_oid).tree
140
- read_index
141
- diff = Rugged::Tree.diff(repository, old_tree, current_tree)
145
+ repository.set_attribute_source(@commit_oid)
146
+ diff = repository.diff(old_commit_oid, @commit_oid)
142
147
 
143
148
  # Clear file map and fetch full diff if any .gitattributes files are changed
144
149
  if cache && diff.each_delta.any? { |delta| File.basename(delta.new_file[:path]) == ".gitattributes" }
145
- diff = Rugged::Tree.diff(repository, old_tree = nil, current_tree)
150
+ diff = repository.diff(nil, @commit_oid)
146
151
  file_map = {}
147
152
  else
148
153
  file_map = cache ? cache.dup : {}
@@ -153,7 +158,7 @@ module Linguist
153
158
  new = delta.new_file[:path]
154
159
 
155
160
  file_map.delete(old)
156
- next if delta.binary
161
+ next if delta.binary?
157
162
 
158
163
  if [:added, :modified].include? delta.status
159
164
  # Skip submodules and symlinks