Compare commits

..

11 Commits

Author SHA1 Message Date
Brandon Black
d761658f8b Release v5.0.4 (#3445)
* bumping to v5.0.3

* updating rugged
2017-01-31 15:08:52 -08:00
Brandon Black
3719214aba fixing null reference in yarn.lock check (#3444) 2017-01-31 14:45:22 -08:00
Paul Chaignon
47b109be36 Improve heuristic for Modula-2 (#3434)
Module names can contain dots
2017-01-24 15:10:46 -08:00
Javier Honduvilla Coto
1ec4db97c2 Be able to configure the number of threads for git submodules update (#3438)
* make the number of submodule update threads configurable

* change thread number to be a script argument
2017-01-24 09:55:31 -08:00
Brandon Black
9fe5fe0de2 v5.0.3 Release (#3436)
* bumping to v5.0.3

* updating grammars
2017-01-23 20:09:26 -08:00
sunderls
b36ea7ac9d Add yarn (#3432)
* add yarn.lock

* fix comment

* remove yarn test

* add test

* fix test

* try fix again

* try 3rd time

* check filename and firstline for yarn lockfile
2017-01-23 10:58:53 -08:00
Yuki Izumi
625b06c30d Use textmate/diff.tmbundle again (#3429)
Upstream textmate/diff.tmbundle#6 was merged.
2017-01-17 17:02:10 +11:00
Brandon Black
28bce533b2 Release v5.0.2 (#3427)
* updated grammars

* bumping version

* adding .gem files to gitignore
2017-01-11 16:08:31 -08:00
John Gardner
93ec1922cb Swap grammar used for CSS highlighting (#3426)
* Swap grammar used for CSS highlighting

* Whitelist license of Atom's CSS grammar

* Explicitly declare grammar as MIT-licensed

Source: https://github.com/atom/language-css/blob/5d4af/package.json#L14
2017-01-11 16:16:25 +11:00
Yuki Izumi
5d09fb67dd Allow for split(",") returning nil (#3424) 2017-01-10 11:44:24 +11:00
Arfon Smith
93dcb61742 Removing references to @arfon (#3423) 2017-01-09 11:54:55 -08:00
39 changed files with 109 additions and 54 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.gem
/Gemfile.lock /Gemfile.lock
.bundle/ .bundle/
.idea .idea

8
.gitmodules vendored
View File

@@ -244,15 +244,12 @@
[submodule "vendor/grammars/cpp-qt.tmbundle"] [submodule "vendor/grammars/cpp-qt.tmbundle"]
path = vendor/grammars/cpp-qt.tmbundle path = vendor/grammars/cpp-qt.tmbundle
url = https://github.com/textmate/cpp-qt.tmbundle url = https://github.com/textmate/cpp-qt.tmbundle
[submodule "vendor/grammars/css.tmbundle"]
path = vendor/grammars/css.tmbundle
url = https://github.com/textmate/css.tmbundle
[submodule "vendor/grammars/d.tmbundle"] [submodule "vendor/grammars/d.tmbundle"]
path = vendor/grammars/d.tmbundle path = vendor/grammars/d.tmbundle
url = https://github.com/textmate/d.tmbundle url = https://github.com/textmate/d.tmbundle
[submodule "vendor/grammars/diff.tmbundle"] [submodule "vendor/grammars/diff.tmbundle"]
path = vendor/grammars/diff.tmbundle path = vendor/grammars/diff.tmbundle
url = https://github.com/kivikakk/diff.tmbundle url = https://github.com/textmate/diff.tmbundle
[submodule "vendor/grammars/dylan.tmbundle"] [submodule "vendor/grammars/dylan.tmbundle"]
path = vendor/grammars/dylan.tmbundle path = vendor/grammars/dylan.tmbundle
url = https://github.com/textmate/dylan.tmbundle url = https://github.com/textmate/dylan.tmbundle
@@ -815,3 +812,6 @@
[submodule "vendor/grammars/atom-language-rust"] [submodule "vendor/grammars/atom-language-rust"]
path = vendor/grammars/atom-language-rust path = vendor/grammars/atom-language-rust
url = https://github.com/zargony/atom-language-rust url = https://github.com/zargony/atom-language-rust
[submodule "vendor/grammars/language-css"]
path = vendor/grammars/language-css
url = https://github.com/atom/language-css

View File

@@ -17,7 +17,7 @@ To add support for a new extension:
In addition, if this extension is already listed in [`languages.yml`][languages] then sometimes a few more steps will need to be taken: In addition, if this extension is already listed in [`languages.yml`][languages] then sometimes a few more steps will need to be taken:
0. Make sure that example `.yourextension` files are present in the [samples directory][samples] for each language that uses `.yourextension`. 0. Make sure that example `.yourextension` files are present in the [samples directory][samples] for each language that uses `.yourextension`.
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.yourextension` files. (ping **@arfon** or **@bkeepers** to help with this) to ensure we're not misclassifying files. 0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.yourextension` files. (ping **@bkeepers** to help with this) to ensure we're not misclassifying files.
0. If the Bayesian classifier does a bad job with the sample `.yourextension` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help. 0. If the Bayesian classifier does a bad job with the sample `.yourextension` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.
@@ -36,7 +36,7 @@ To add support for a new language:
In addition, if your new language defines an extension that's already listed in [`languages.yml`][languages] (such as `.foo`) then sometimes a few more steps will need to be taken: In addition, if your new language defines an extension that's already listed in [`languages.yml`][languages] (such as `.foo`) then sometimes a few more steps will need to be taken:
0. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`. 0. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`.
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping **@arfon** or **@bkeepers** to help with this) to ensure we're not misclassifying files. 0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping **@bkeepers** to help with this) to ensure we're not misclassifying files.
0. If the Bayesian classifier does a bad job with the sample `.foo` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help. 0. If the Bayesian classifier does a bad job with the sample `.foo` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.
Remember, the goal here is to try and avoid false positives! Remember, the goal here is to try and avoid false positives!
@@ -80,7 +80,6 @@ Here's our current build status: [![Build Status](https://api.travis-ci.org/gith
Linguist is maintained with :heart: by: Linguist is maintained with :heart: by:
- **@Alhadis** - **@Alhadis**
- **@arfon**
- **@brandonblack** (GitHub staff) - **@brandonblack** (GitHub staff)
- **@larsbrinkhoff** - **@larsbrinkhoff**
- **@lildude** (GitHub staff) - **@lildude** (GitHub staff)

View File

@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.add_dependency 'charlock_holmes', '~> 0.7.3' s.add_dependency 'charlock_holmes', '~> 0.7.3'
s.add_dependency 'escape_utils', '~> 1.1.0' s.add_dependency 'escape_utils', '~> 1.1.0'
s.add_dependency 'mime-types', '>= 1.19' s.add_dependency 'mime-types', '>= 1.19'
s.add_dependency 'rugged', '0.25.0b10' s.add_dependency 'rugged', '0.25.1.1'
s.add_development_dependency 'minitest', '>= 5.0' s.add_development_dependency 'minitest', '>= 5.0'
s.add_development_dependency 'mocha' s.add_development_dependency 'mocha'

View File

@@ -234,8 +234,6 @@ vendor/grammars/cpp-qt.tmbundle:
- source.qmake - source.qmake
vendor/grammars/creole: vendor/grammars/creole:
- text.html.creole - text.html.creole
vendor/grammars/css.tmbundle:
- source.css
vendor/grammars/cucumber-tmbundle: vendor/grammars/cucumber-tmbundle:
- source.ruby.rspec.cucumber.steps - source.ruby.rspec.cucumber.steps
- text.gherkin.feature - text.gherkin.feature
@@ -369,6 +367,8 @@ vendor/grammars/language-csound:
- source.csound - source.csound
- source.csound-document - source.csound-document
- source.csound-score - source.csound-score
vendor/grammars/language-css:
- source.css
vendor/grammars/language-emacs-lisp: vendor/grammars/language-emacs-lisp:
- source.emacs.lisp - source.emacs.lisp
vendor/grammars/language-fontforge: vendor/grammars/language-fontforge:

View File

@@ -80,7 +80,8 @@ module Linguist
generated_jflex? || generated_jflex? ||
generated_grammarkit? || generated_grammarkit? ||
generated_roxygen2? || generated_roxygen2? ||
generated_jison? generated_jison? ||
generated_yarn_lock?
end end
# Internal: Is the blob an Xcode file? # Internal: Is the blob an Xcode file?
@@ -479,5 +480,14 @@ module Linguist
return lines[0].start_with?("/* parser generated by jison ") || return lines[0].start_with?("/* parser generated by jison ") ||
lines[0].start_with?("/* generated by jison-lex ") lines[0].start_with?("/* generated by jison-lex ")
end end
# Internal: Is the blob a generated yarn lockfile?
#
# Returns true or false.
def generated_yarn_lock?
return false unless name.match(/yarn\.lock/)
return false unless lines.count > 0
return lines[0].include?("# THIS IS AN AUTOGENERATED FILE")
end
end end
end end

View File

@@ -278,7 +278,7 @@ module Linguist
disambiguate ".mod" do |data| disambiguate ".mod" do |data|
if data.include?('<!ENTITY ') if data.include?('<!ENTITY ')
Language["XML"] Language["XML"]
elsif /MODULE\s\w+\s*;/i.match(data) || /^\s*END \w+;$/i.match(data) elsif /^\s*MODULE [\w\.]+;/i.match(data) || /^\s*END [\w\.]+;/i.match(data)
Language["Modula-2"] Language["Modula-2"]
else else
[Language["Linux Kernel Module"], Language["AMPL"]] [Language["Linux Kernel Module"], Language["AMPL"]]

View File

@@ -215,7 +215,14 @@ module Linguist
# Returns the Language or nil if none was found. # Returns the Language or nil if none was found.
def self.[](name) def self.[](name)
return nil if name.to_s.empty? return nil if name.to_s.empty?
name && (@index[name.downcase] || @index[name.split(',').first.downcase])
lang = @index[name.downcase]
return lang if lang
name = name.split(',').first
return nil if name.to_s.empty?
@index[name.downcase]
end end
# Public: A List of popular languages # Public: A List of popular languages

View File

@@ -1,3 +1,3 @@
module Linguist module Linguist
VERSION = "5.0.1" VERSION = "5.0.4"
end end

View File

@@ -51,7 +51,7 @@ SUBMODULES.partition { |submodule| SLOW_SUBMODULES.include?(submodule) }.flatten
submodules.push(submodule) submodules.push(submodule)
end end
8.times do (ARGV.first || 8).to_i.times do
Thread.new { run_thread(submodules, results) } Thread.new { run_thread(submodules, results) }
end end

9
test/fixtures/Data/yarn.lock vendored Normal file
View File

@@ -0,0 +1,9 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
abab@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
abbrev@1, abbrev@1.0.x:
version "1.0.9"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"

View File

@@ -79,6 +79,9 @@ class TestGenerated < Minitest::Test
generated_fixture_loading_data("Data/sourcemap.v3.map") generated_fixture_loading_data("Data/sourcemap.v3.map")
generated_fixture_loading_data("Data/sourcemap.v1.map") generated_fixture_loading_data("Data/sourcemap.v1.map")
# Yarn locfile
generated_fixture_loading_data("Data/yarn.lock")
# Specflow # Specflow
generated_fixture_without_loading_data("Features/BindingCulture.feature.cs") generated_fixture_without_loading_data("Features/BindingCulture.feature.cs")

View File

@@ -41,7 +41,8 @@ class TestGrammars < Minitest::Test
"241e5ddbb4423d792216783e9f668bd670b026e4", # ant.tmbundle "241e5ddbb4423d792216783e9f668bd670b026e4", # ant.tmbundle
"bdab9fdc21e6790b479ccb5945b78bc0f6ce2493", # language-blade "bdab9fdc21e6790b479ccb5945b78bc0f6ce2493", # language-blade
"81711c69aa40135de7266c88b2f6ab28dbc1d81e", # atom-language-perl6 "81711c69aa40135de7266c88b2f6ab28dbc1d81e", # atom-language-perl6
"808e27f5e44167113198d277f47926c5d482eac8" # atom-language-rust "808e27f5e44167113198d277f47926c5d482eac8", # atom-language-rust
"304be6184f7f344d44a1d13bddf511019624fd22", # language-css
].freeze ].freeze
# List of allowed SPDX license names # List of allowed SPDX license names

View File

@@ -460,4 +460,8 @@ class TestLanguage < Minitest::Test
assert !language.color, "Unused colour assigned to #{language.name}" assert !language.color, "Unused colour assigned to #{language.name}"
end end
end end
def test_non_crash_on_comma
assert_nil Language[',']
end
end end

4
vendor/README.md vendored
View File

@@ -76,7 +76,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Csound:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) - **Csound:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound)
- **Csound Document:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) - **Csound Document:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound)
- **Csound Score:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound) - **Csound Score:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound)
- **CSS:** [textmate/css.tmbundle](https://github.com/textmate/css.tmbundle) - **CSS:** [atom/language-css](https://github.com/atom/language-css)
- **Cuda:** [harrism/sublimetext-cuda-cpp](https://github.com/harrism/sublimetext-cuda-cpp) - **Cuda:** [harrism/sublimetext-cuda-cpp](https://github.com/harrism/sublimetext-cuda-cpp)
- **Cycript:** [atom/language-javascript](https://github.com/atom/language-javascript) - **Cycript:** [atom/language-javascript](https://github.com/atom/language-javascript)
- **Cython:** [textmate/cython.tmbundle](https://github.com/textmate/cython.tmbundle) - **Cython:** [textmate/cython.tmbundle](https://github.com/textmate/cython.tmbundle)
@@ -84,7 +84,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **D-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle) - **D-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle)
- **Dart:** [guillermooo/dart-sublime-bundle](https://github.com/guillermooo/dart-sublime-bundle) - **Dart:** [guillermooo/dart-sublime-bundle](https://github.com/guillermooo/dart-sublime-bundle)
- **desktop:** [Mailaender/desktop.tmbundle](https://github.com/Mailaender/desktop.tmbundle) - **desktop:** [Mailaender/desktop.tmbundle](https://github.com/Mailaender/desktop.tmbundle)
- **Diff:** [textmate/diff.tmbundle](https://github.com/textmate/diff.tmbundle) - **Diff:** [kivikakk/diff.tmbundle](https://github.com/kivikakk/diff.tmbundle)
- **DM:** [PJB3005/atomic-dreams](https://github.com/PJB3005/atomic-dreams) - **DM:** [PJB3005/atomic-dreams](https://github.com/PJB3005/atomic-dreams)
- **DNS Zone:** [sixty4k/st2-zonefile](https://github.com/sixty4k/st2-zonefile) - **DNS Zone:** [sixty4k/st2-zonefile](https://github.com/sixty4k/st2-zonefile)
- **Dockerfile:** [asbjornenge/Docker.tmbundle](https://github.com/asbjornenge/Docker.tmbundle) - **Dockerfile:** [asbjornenge/Docker.tmbundle](https://github.com/asbjornenge/Docker.tmbundle)

1
vendor/grammars/language-css vendored Submodule

View File

@@ -1,15 +0,0 @@
---
type: grammar
name: css.tmbundle
license: permissive
curated: true
---
If not otherwise specified (see below), files in this repository fall under the following license:
Permission to copy, use, modify, sell and distribute this
software is granted. This software is provided "as is" without
express or implied warranty, and with no claim as to its
suitability for any purpose.
An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”.

View File

@@ -0,0 +1,36 @@
---
type: grammar
name: language-css
license: mit
---
Copyright (c) 2014 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------
This package was derived from a TextMate bundle located at
https://github.com/textmate/css.tmbundle and distributed under the following
license, located in `README.mdown`:
Permission to copy, use, modify, sell and distribute this
software is granted. This software is provided "as is" without
express or implied warranty, and with no claim as to its
suitability for any purpose.