From da7dbb72112bace99a22009f8cdcb8d1fa151e72 Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Wed, 8 Nov 2017 13:08:45 +0100 Subject: [PATCH 1/5] synchronized data/ directory Signed-off-by: Manuel Carmona --- data/alias.go | 2 +- data/commit.go | 4 ++-- data/content.go | 2 +- data/documentation.go | 2 +- data/extension.go | 2 +- data/filename.go | 2 +- data/frequencies.go | 2 +- data/interpreter.go | 2 +- data/mimeType.go | 2 +- data/type.go | 2 +- data/vendor.go | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/alias.go b/data/alias.go index 1995c63..c297072 100644 --- a/data/alias.go +++ b/data/alias.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // LanguagesByAlias keeps alias for different languages and use the name of the languages as an alias too. // All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores. diff --git a/data/commit.go b/data/commit.go index 64608e5..79fd398 100644 --- a/data/commit.go +++ b/data/commit.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // linguist's commit from which files were generated. -var LinguistCommit = "e98728595bc2f3e72b0668d60e31cbe441c48799" +var LinguistCommit = "4cd558c37482e8d2c535d8107f2d11b49afbc5b5" diff --git a/data/content.go b/data/content.go index 30e5a93..42c7ab3 100644 --- a/data/content.go +++ b/data/content.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 import "gopkg.in/toqueteos/substring.v1" diff --git a/data/documentation.go b/data/documentation.go index 4334a8d..999e8cc 100644 --- a/data/documentation.go +++ b/data/documentation.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 import "gopkg.in/toqueteos/substring.v1" diff --git a/data/extension.go b/data/extension.go index ddffeaf..d6bcf1a 100644 --- a/data/extension.go +++ b/data/extension.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 var LanguagesByExtension = map[string][]string{ ".1": {"Roff"}, diff --git a/data/filename.go b/data/filename.go index 583ee98..d1de99a 100644 --- a/data/filename.go +++ b/data/filename.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 var LanguagesByFilename = map[string][]string{ ".Rprofile": {"R"}, diff --git a/data/frequencies.go b/data/frequencies.go index a2d3f81..1164341 100644 --- a/data/frequencies.go +++ b/data/frequencies.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 var LanguagesLogProbabilities = map[string]float64{ "1C Enterprise": -5.774552, diff --git a/data/interpreter.go b/data/interpreter.go index 8797af5..02af4a7 100644 --- a/data/interpreter.go +++ b/data/interpreter.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 var LanguagesByInterpreter = map[string][]string{ "Rscript": {"R"}, diff --git a/data/mimeType.go b/data/mimeType.go index d947e3d..540cc11 100644 --- a/data/mimeType.go +++ b/data/mimeType.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 var LanguagesMime = map[string]string{ "AGS Script": "text/x-c++src", diff --git a/data/type.go b/data/type.go index 00ba272..94f9782 100644 --- a/data/type.go +++ b/data/type.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 var LanguagesType = map[string]int{ "1C Enterprise": 2, diff --git a/data/vendor.go b/data/vendor.go index 5f39290..3cc865f 100644 --- a/data/vendor.go +++ b/data/vendor.go @@ -2,7 +2,7 @@ package data // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: e98728595bc2f3e72b0668d60e31cbe441c48799 +// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 import "gopkg.in/toqueteos/substring.v1" From f6649550f0b4909da9add448229fa7b5e4c90239 Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Wed, 8 Nov 2017 13:14:40 +0100 Subject: [PATCH 2/5] fixed test for GetLanguagesByShebang function Signed-off-by: Manuel Carmona --- common_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common_test.go b/common_test.go index de332de..6bb145f 100644 --- a/common_test.go +++ b/common_test.go @@ -217,7 +217,7 @@ println("The shell script says ",vm.arglist.concat(" "));` {name: "TestGetLanguagesByShebang_3", content: []byte(`#!/usr/bin/env`), expected: nil}, {name: "TestGetLanguagesByShebang_4", content: []byte(`#!/usr/bin/python -tt`), expected: []string{"Python"}}, {name: "TestGetLanguagesByShebang_5", content: []byte(`#!/usr/bin/env python2.6`), expected: []string{"Python"}}, - {name: "TestGetLanguagesByShebang_6", content: []byte(`#!/usr/bin/env perl`), expected: []string{"Perl"}}, + {name: "TestGetLanguagesByShebang_6", content: []byte(`#!/usr/bin/env perl`), expected: []string{"Perl", "Pod"}}, {name: "TestGetLanguagesByShebang_7", content: []byte(`#! /bin/sh`), expected: []string{"Shell"}}, {name: "TestGetLanguagesByShebang_8", content: []byte(`#!bash`), expected: []string{"Shell"}}, {name: "TestGetLanguagesByShebang_9", content: []byte(multilineExecHack), expected: []string{"Tcl"}}, From 8ddce8bc4bed12dc021c4e70d1a9fdcb0cbbed5c Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Wed, 8 Nov 2017 13:16:40 +0100 Subject: [PATCH 3/5] Added cases with nil and empty content to TestGetLanguagesByModeline Signed-off-by: Manuel Carmona --- common_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common_test.go b/common_test.go index 6bb145f..74920e7 100644 --- a/common_test.go +++ b/common_test.go @@ -157,6 +157,8 @@ func (s *EnryTestSuite) TestGetLanguagesByModeline() { {name: "TestGetLanguagesByModeline_1", content: []byte(wrongVim), expected: nil}, {name: "TestGetLanguagesByModeline_2", content: []byte(rightVim), expected: []string{"Python"}}, {name: "TestGetLanguagesByModeline_3", content: []byte(noLangVim), expected: nil}, + {name: "TestGetLanguagesByModeline_4", content: nil, expected: nil}, + {name: "TestGetLanguagesByModeline_5", content: []byte{}, expected: nil}, } for _, test := range tests { From 5dad184af0ebf10e3c96e796d4a1b74da7752f75 Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Wed, 8 Nov 2017 13:20:52 +0100 Subject: [PATCH 4/5] check for empty content in getHeaderAndFooter function Signed-off-by: Manuel Carmona --- common.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common.go b/common.go index 2e2013b..3ccd34b 100644 --- a/common.go +++ b/common.go @@ -158,6 +158,11 @@ var modelinesFunc = []Strategy{ func getHeaderAndFooter(content []byte) []byte { const searchScope = 5 + + if len(content) == 0 { + return content + } + if bytes.Count(content, []byte("\n")) < 2*searchScope { return content } From 0984e07415081ff4085e4cbeb3818f60be83205d Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Wed, 8 Nov 2017 13:23:54 +0100 Subject: [PATCH 5/5] use of go 1.9.x in travis Signed-off-by: Manuel Carmona --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0965377..76893f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.8 + - 1.9.x - tip addons: