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
|
||||
|
||||
go:
|
||||
- 1.8
|
||||
- 1.9.x
|
||||
- tip
|
||||
|
||||
addons:
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
@ -217,7 +219,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"}},
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"},
|
||||
|
@ -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"},
|
||||
|
@ -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,
|
||||
|
@ -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"},
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user