remove unnecessary comparison with second match
This commit is contained in:
parent
84b130acdb
commit
cc7c023e7a
1 changed files with 2 additions and 7 deletions
|
|
@ -77,7 +77,6 @@ exports.$detectIndentation = function(lines, fallback) {
|
||||||
changesTotal += changes[i];
|
changesTotal += changes[i];
|
||||||
|
|
||||||
var first = {score: 0, length: 0};
|
var first = {score: 0, length: 0};
|
||||||
var second = {score: 0, length: 0};
|
|
||||||
var spaceIndents = 0;
|
var spaceIndents = 0;
|
||||||
for (var i = 1; i < 12; i++) {
|
for (var i = 1; i < 12; i++) {
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
|
|
@ -90,15 +89,11 @@ exports.$detectIndentation = function(lines, fallback) {
|
||||||
score += changes[i] / changesTotal;
|
score += changes[i] / changesTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (score > first.score) {
|
if (score > first.score)
|
||||||
second = first;
|
|
||||||
first = {score: score, length: i};
|
first = {score: score, length: i};
|
||||||
} else if (score > second.score) {
|
|
||||||
second = {score: score, length: i};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (second.score < 0.9 * first.score && first.score > 1.4)
|
if (first.score && first.score > 1.4)
|
||||||
var tabLength = first.length;
|
var tabLength = first.length;
|
||||||
|
|
||||||
if (tabIndents > spaceIndents + 1)
|
if (tabIndents > spaceIndents + 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue