diff --git a/lib/linguist/blob.rb b/lib/linguist/blob.rb index a11e6074..dc0cf2ac 100644 --- a/lib/linguist/blob.rb +++ b/lib/linguist/blob.rb @@ -63,7 +63,7 @@ module Linguist # # Returns an Array def extensions - basename, *segments = name.downcase.split(".") + _, *segments = name.downcase.split(".") segments.map.with_index do |segment, index| "." + segments[index..-1].join(".") diff --git a/lib/linguist/lazy_blob.rb b/lib/linguist/lazy_blob.rb index e828dca6..339c2e36 100644 --- a/lib/linguist/lazy_blob.rb +++ b/lib/linguist/lazy_blob.rb @@ -28,6 +28,7 @@ module Linguist @oid = oid @path = path @mode = mode + @data = nil end def git_attributes diff --git a/lib/linguist/repository.rb b/lib/linguist/repository.rb index 51040734..700d1a11 100644 --- a/lib/linguist/repository.rb +++ b/lib/linguist/repository.rb @@ -30,6 +30,9 @@ module Linguist @repository = repo @commit_oid = commit_oid + @old_commit_oid = nil + @old_stats = nil + raise TypeError, 'commit_oid must be a commit SHA1' unless commit_oid.is_a?(String) end diff --git a/lib/linguist/shebang.rb b/lib/linguist/shebang.rb index 5b27532a..7e5f9833 100644 --- a/lib/linguist/shebang.rb +++ b/lib/linguist/shebang.rb @@ -42,10 +42,10 @@ module Linguist return unless script # "python2.6" -> "python2" - script.sub! /(\.\d+)$/, '' + script.sub!(/(\.\d+)$/, '') # #! perl -> perl - script.sub! /^#!\s*/, '' + script.sub!(/^#!\s*/, '') # Check for multiline shebang hacks that call `exec` if script == 'sh' && diff --git a/test/test_blob.rb b/test/test_blob.rb index 352d4b07..9a73662b 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -132,7 +132,7 @@ class TestBlob < Minitest::Test end def test_csv - assert fixture_blob_memory("Data/cars.csv").csv? + assert sample_blob_memory("CSV/cars.csv").csv? end def test_pdf diff --git a/test/test_file_blob.rb b/test/test_file_blob.rb index 1b83a0fb..98a73ba2 100644 --- a/test/test_file_blob.rb +++ b/test/test_file_blob.rb @@ -1,6 +1,6 @@ require_relative "./helper" -class TestBlob < Minitest::Test +class TestFileBlob < Minitest::Test include Linguist def setup diff --git a/test/test_repository.rb b/test/test_repository.rb index a1f9fc86..0a81fae1 100644 --- a/test/test_repository.rb +++ b/test/test_repository.rb @@ -81,7 +81,7 @@ class TestRepository < Minitest::Test def test_linguist_override_vendored? attr_commit = '351c1cc8fd57340839bdb400d7812332af80e9bd' - repo = linguist_repo(attr_commit).read_index + linguist_repo(attr_commit).read_index override_vendored = Linguist::LazyBlob.new(rugged_repository, attr_commit, 'Gemfile') @@ -91,7 +91,7 @@ class TestRepository < Minitest::Test def test_linguist_override_unvendored? attr_commit = '351c1cc8fd57340839bdb400d7812332af80e9bd' - repo = linguist_repo(attr_commit).read_index + linguist_repo(attr_commit).read_index # lib/linguist/vendor.yml defines this as vendored. override_unvendored = Linguist::LazyBlob.new(rugged_repository, attr_commit, 'test/fixtures/foo.rb') @@ -102,7 +102,7 @@ class TestRepository < Minitest::Test def test_linguist_override_documentation? attr_commit = "d4c8fb8a28e91f97a7e53428a365c0abbac36d3d" - repo = linguist_repo(attr_commit).read_index + linguist_repo(attr_commit).read_index readme = Linguist::LazyBlob.new(rugged_repository, attr_commit, "README.md") arduino = Linguist::LazyBlob.new(rugged_repository, attr_commit, "samples/Arduino/hello.ino") @@ -114,7 +114,7 @@ class TestRepository < Minitest::Test def test_linguist_override_generated? attr_commit = "351c1cc8fd57340839bdb400d7812332af80e9bd" - repo = linguist_repo(attr_commit).read_index + linguist_repo(attr_commit).read_index rakefile = Linguist::LazyBlob.new(rugged_repository, attr_commit, "Rakefile")