mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Remove samples/LANG/filenames as a source of truth (#4078)
All filenames must now be explicitly listed in languages.yml. A test makes sure they are.
This commit is contained in:
@@ -539,14 +539,6 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
if fns = filenames[name]
|
||||
fns.each do |filename|
|
||||
if !options['filenames'].include?(filename)
|
||||
options['filenames'] << filename
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Language.create(
|
||||
:name => name,
|
||||
:color => options['color'],
|
||||
|
||||
@@ -239,6 +239,10 @@ ApacheConf:
|
||||
extensions:
|
||||
- ".apacheconf"
|
||||
- ".vhost"
|
||||
filenames:
|
||||
- ".htaccess"
|
||||
- apache2.conf
|
||||
- httpd.conf
|
||||
tm_scope: source.apache-config
|
||||
ace_mode: apache_conf
|
||||
language_id: 16
|
||||
@@ -1467,6 +1471,8 @@ GN:
|
||||
- ".gni"
|
||||
interpreters:
|
||||
- gn
|
||||
filenames:
|
||||
- ".gn"
|
||||
tm_scope: source.gn
|
||||
ace_mode: python
|
||||
codemirror_mode: python
|
||||
@@ -1925,6 +1931,8 @@ INI:
|
||||
- ".pro"
|
||||
- ".properties"
|
||||
filenames:
|
||||
- ".editorconfig"
|
||||
- ".gitconfig"
|
||||
- buildozer.spec
|
||||
tm_scope: source.ini
|
||||
aliases:
|
||||
@@ -3226,6 +3234,7 @@ PHP:
|
||||
- ".phps"
|
||||
- ".phpt"
|
||||
filenames:
|
||||
- ".php"
|
||||
- ".php_cs"
|
||||
- ".php_cs.dist"
|
||||
- Phakefile
|
||||
@@ -3370,6 +3379,7 @@ Perl:
|
||||
- ".psgi"
|
||||
- ".t"
|
||||
filenames:
|
||||
- ack
|
||||
- cpanfile
|
||||
interpreters:
|
||||
- perl
|
||||
@@ -3709,6 +3719,7 @@ R:
|
||||
- ".rsx"
|
||||
filenames:
|
||||
- ".Rprofile"
|
||||
- expr-dist
|
||||
interpreters:
|
||||
- Rscript
|
||||
ace_mode: r
|
||||
@@ -4035,6 +4046,7 @@ Ruby:
|
||||
- Berksfile
|
||||
- Brewfile
|
||||
- Buildfile
|
||||
- Capfile
|
||||
- Dangerfile
|
||||
- Deliverfile
|
||||
- Fastfile
|
||||
@@ -4298,8 +4310,29 @@ Shell:
|
||||
- ".bash_logout"
|
||||
- ".bash_profile"
|
||||
- ".bashrc"
|
||||
- ".cshrc"
|
||||
- ".login"
|
||||
- ".profile"
|
||||
- ".zlogin"
|
||||
- ".zlogout"
|
||||
- ".zprofile"
|
||||
- ".zshenv"
|
||||
- ".zshrc"
|
||||
- 9fs
|
||||
- PKGBUILD
|
||||
- bash_logout
|
||||
- bash_profile
|
||||
- bashrc
|
||||
- cshrc
|
||||
- gradlew
|
||||
- login
|
||||
- man
|
||||
- profile
|
||||
- zlogin
|
||||
- zlogout
|
||||
- zprofile
|
||||
- zshenv
|
||||
- zshrc
|
||||
interpreters:
|
||||
- ash
|
||||
- bash
|
||||
@@ -4568,6 +4601,9 @@ Tcl:
|
||||
- ".tcl"
|
||||
- ".adp"
|
||||
- ".tm"
|
||||
filenames:
|
||||
- owh
|
||||
- starfield
|
||||
interpreters:
|
||||
- tclsh
|
||||
- wish
|
||||
@@ -4643,6 +4679,7 @@ Text:
|
||||
- ".no"
|
||||
filenames:
|
||||
- COPYING
|
||||
- COPYING.regex
|
||||
- COPYRIGHT.regex
|
||||
- FONTLOG
|
||||
- INSTALL
|
||||
@@ -4657,6 +4694,7 @@ Text:
|
||||
- delete.me
|
||||
- keep.me
|
||||
- read.me
|
||||
- readme.1st
|
||||
- test.me
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
@@ -4844,6 +4882,7 @@ Vim script:
|
||||
extensions:
|
||||
- ".vim"
|
||||
filenames:
|
||||
- ".gvimrc"
|
||||
- ".nvimrc"
|
||||
- ".vimrc"
|
||||
- _vimrc
|
||||
@@ -5082,6 +5121,7 @@ XML:
|
||||
- ".zcml"
|
||||
filenames:
|
||||
- ".classpath"
|
||||
- ".cproject"
|
||||
- ".project"
|
||||
- App.config
|
||||
- NuGet.config
|
||||
@@ -5190,6 +5230,7 @@ YAML:
|
||||
filenames:
|
||||
- ".clang-format"
|
||||
- ".clang-tidy"
|
||||
- ".gemrc"
|
||||
ace_mode: yaml
|
||||
codemirror_mode: yaml
|
||||
codemirror_mime_type: text/x-yaml
|
||||
|
||||
@@ -42,6 +42,15 @@ class TestSamples < Minitest::Test
|
||||
end
|
||||
end
|
||||
|
||||
def test_filename_listed
|
||||
Samples.each do |sample|
|
||||
if sample[:filename]
|
||||
listed_filenames = Language[sample[:language]].filenames
|
||||
assert_includes listed_filenames, sample[:filename], "#{sample[:path]} isn't listed as a filename for #{sample[:language]} in languages.yml"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Check that there aren't samples with extensions or interpreters that
|
||||
# aren't explicitly defined in languages.yml
|
||||
languages_yml = File.expand_path("../../lib/linguist/languages.yml", __FILE__)
|
||||
|
||||
Reference in New Issue
Block a user