mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
Merge pull request #130 from mcarmonaa/fix/get-header-footer
Fixing getHeaderAndFooter issues
This commit is contained in:
commit
c256de15c1
@ -1,7 +1,7 @@
|
|||||||
language: go
|
language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.8
|
- 1.9.x
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
|
@ -158,6 +158,11 @@ var modelinesFunc = []Strategy{
|
|||||||
|
|
||||||
func getHeaderAndFooter(content []byte) []byte {
|
func getHeaderAndFooter(content []byte) []byte {
|
||||||
const searchScope = 5
|
const searchScope = 5
|
||||||
|
|
||||||
|
if len(content) == 0 {
|
||||||
|
return content
|
||||||
|
}
|
||||||
|
|
||||||
if bytes.Count(content, []byte("\n")) < 2*searchScope {
|
if bytes.Count(content, []byte("\n")) < 2*searchScope {
|
||||||
return content
|
return content
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,8 @@ func (s *EnryTestSuite) TestGetLanguagesByModeline() {
|
|||||||
{name: "TestGetLanguagesByModeline_1", content: []byte(wrongVim), expected: nil},
|
{name: "TestGetLanguagesByModeline_1", content: []byte(wrongVim), expected: nil},
|
||||||
{name: "TestGetLanguagesByModeline_2", content: []byte(rightVim), expected: []string{"Python"}},
|
{name: "TestGetLanguagesByModeline_2", content: []byte(rightVim), expected: []string{"Python"}},
|
||||||
{name: "TestGetLanguagesByModeline_3", content: []byte(noLangVim), expected: nil},
|
{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 {
|
for _, test := range tests {
|
||||||
@ -217,7 +219,7 @@ println("The shell script says ",vm.arglist.concat(" "));`
|
|||||||
{name: "TestGetLanguagesByShebang_3", content: []byte(`#!/usr/bin/env`), expected: nil},
|
{name: "TestGetLanguagesByShebang_3", content: []byte(`#!/usr/bin/env`), expected: nil},
|
||||||
{name: "TestGetLanguagesByShebang_4", content: []byte(`#!/usr/bin/python -tt`), expected: []string{"Python"}},
|
{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_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_7", content: []byte(`#! /bin/sh`), expected: []string{"Shell"}},
|
||||||
{name: "TestGetLanguagesByShebang_8", content: []byte(`#!bash`), expected: []string{"Shell"}},
|
{name: "TestGetLanguagesByShebang_8", content: []byte(`#!bash`), expected: []string{"Shell"}},
|
||||||
{name: "TestGetLanguagesByShebang_9", content: []byte(multilineExecHack), expected: []string{"Tcl"}},
|
{name: "TestGetLanguagesByShebang_9", content: []byte(multilineExecHack), expected: []string{"Tcl"}},
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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.
|
// 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.
|
// All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores.
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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.
|
// linguist's commit from which files were generated.
|
||||||
var LinguistCommit = "e98728595bc2f3e72b0668d60e31cbe441c48799"
|
var LinguistCommit = "4cd558c37482e8d2c535d8107f2d11b49afbc5b5"
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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"
|
import "gopkg.in/toqueteos/substring.v1"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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"
|
import "gopkg.in/toqueteos/substring.v1"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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{
|
var LanguagesByExtension = map[string][]string{
|
||||||
".1": {"Roff"},
|
".1": {"Roff"},
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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{
|
var LanguagesByFilename = map[string][]string{
|
||||||
".Rprofile": {"R"},
|
".Rprofile": {"R"},
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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{
|
var LanguagesLogProbabilities = map[string]float64{
|
||||||
"1C Enterprise": -5.774552,
|
"1C Enterprise": -5.774552,
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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{
|
var LanguagesByInterpreter = map[string][]string{
|
||||||
"Rscript": {"R"},
|
"Rscript": {"R"},
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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{
|
var LanguagesMime = map[string]string{
|
||||||
"AGS Script": "text/x-c++src",
|
"AGS Script": "text/x-c++src",
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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{
|
var LanguagesType = map[string]int{
|
||||||
"1C Enterprise": 2,
|
"1C Enterprise": 2,
|
||||||
|
@ -2,7 +2,7 @@ package data
|
|||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
// 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"
|
import "gopkg.in/toqueteos/substring.v1"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user