From 3191ff498d759bed414801fea8c29bd6cc04ed4f Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Fri, 6 May 2016 15:36:07 -0600 Subject: [PATCH] 2945 local (#2992) * Added Django environment folder in exclusion Django projects have env/ folder in which dependencies of the project like Django, Pillow, and other libraries are installed from the requirements.txt file. It would be best if this folder of dependencies is ignored from the language statistics. * Corrected Errors Corrected the misplaced code and put removed the start character as the environment folder may not always be in the root. * Adding test for env folder --- lib/linguist/vendor.yml | 1 + test/test_file_blob.rb | 6 ++++-- test/test_generated.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index 124a3428..938bfa10 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -190,6 +190,7 @@ # django - (^|/)admin_media/ +- (^|/)env/ # Fabric - ^fabfile\.py$ diff --git a/test/test_file_blob.rb b/test/test_file_blob.rb index 98a73ba2..332f4a77 100644 --- a/test/test_file_blob.rb +++ b/test/test_file_blob.rb @@ -19,7 +19,7 @@ class TestFileBlob < Minitest::Test blob.instance_variable_set(:@name, 'script') blob end - + def test_extensions assert_equal [".gitignore"], Linguist::FileBlob.new(".gitignore").extensions assert_equal [".xml"], Linguist::FileBlob.new("build.xml").extensions @@ -312,11 +312,13 @@ class TestFileBlob < Minitest::Test # Debian packaging assert sample_blob("debian/cron.d").vendored? + # Django env + assert sample_blob("env/foo.py").vendored? + # Erlang assert sample_blob("rebar").vendored? # git config files - assert_predicate fixture_blob("some/path/.gitattributes"), :vendored? assert_predicate fixture_blob(".gitignore"), :vendored? assert_predicate fixture_blob("special/path/.gitmodules"), :vendored? diff --git a/test/test_generated.rb b/test/test_generated.rb index 3a32e8fc..b18aaada 100644 --- a/test/test_generated.rb +++ b/test/test_generated.rb @@ -36,7 +36,7 @@ class TestGenerated < Minitest::Test generated_loading_data(File.join(samples_path, name)) end - def test_check_generated + def test_check_generated # Xcode project files generated_sample_without_loading_data("Binary/MainMenu.nib") generated_sample_without_loading_data("Dummy/foo.xcworkspacedata")