[AutoDetectIndent] getTotalLinesWithLeadingSpaces returns value needed, no need in subtracting

This commit is contained in:
Yaroslav Lepenkin
2014-09-25 15:06:10 +04:00
parent 9e2260094e
commit a8808bcf46
3 changed files with 27 additions and 2 deletions
@@ -99,8 +99,7 @@ public class IndentOptionsDetectorImpl implements IndentOptionsDetector {
}
if (maxUsedIndentSize <= MAX_INDENT_TO_DETECT) {
int totalUsagesWithoutZeroIndent = stats.getTotalLinesWithLeadingSpaces() - stats.getTimesIndentUsed(0);
double usageRate = (double)maxUsedIndentInfo.getTimesUsed() / totalUsagesWithoutZeroIndent;
double usageRate = (double)maxUsedIndentInfo.getTimesUsed() / stats.getTotalLinesWithLeadingSpaces();
if (usageRate > RATE_THRESHOLD) {
return maxUsedIndentSize;
}
@@ -0,0 +1,24 @@
# Assignment:
number = 42
opposite = true
# Conditions:
number = -42 if opposite
# Functions:
square = (x) -> x * x
# Arrays:
list = [1, 2, 3, 4, 5]
# Objects:
math =
root: Math.sqrt
square: square
cube: (x) -> x * square x
# Existence:
alert "I knew it!" if elvis?
# Array comprehensions:
cubes = (math.cube num for num in list)
@@ -74,6 +74,8 @@ public class IndentAutoDetectionTest extends LightPlatformCodeInsightTestCase {
doTestIndentSize(4);
}
public void testManyZeroIndents() { doTestIndentSize(2); }
public void testSpacesToNumbers() throws Exception {
String text = " i\n" +
" a\n" +