Skip to content

Commit e8df86e

Browse files
authored
Merge pull request #4 from hvitved/csharp/whitespaces
C#: Fix whitespaces
2 parents 5089281 + 5d498fd commit e8df86e

38 files changed

+199
-176
lines changed

csharp/fix-whitespaces.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
BASEDIR=$(dirname "$0")
2+
3+
cat > "$BASEDIR/reformat.vim" <<"EOF"
4+
:set ff=unix ts=2 et
5+
:retab!
6+
:%s/\r//g
7+
:%s/ \+$//
8+
:wq
9+
EOF
10+
11+
find "$BASEDIR" \( -name "*.ql" -or -name "*.qll" -or -name "*.csv" \) -exec vim -u /dev/null -s reformat.vim {} \;
12+
13+
cat > reformat.vim <<"EOF"
14+
:set ff=unix ts=4 et
15+
:retab!
16+
:%s/\r//g
17+
:%s/ \+$//
18+
:wq
19+
EOF
20+
21+
find "$BASEDIR" \( -name "*.cs" \) -exec vim -u /dev/null -s reformat.vim {} \;
22+
23+
rm "$BASEDIR/reformat.vim"

csharp/ql/src/Likely Bugs/NestedLoopsSameVariable.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import semmle.code.csharp.commons.StructuralComparison as SC
1919
/** A structural comparison configuration for comparing the conditions of nested `for` loops. */
2020
class NestedForConditions extends SC::StructuralComparisonConfiguration {
2121
NestedForConditions() { this = "Compare nested for conditions" }
22-
22+
2323
override predicate candidate(Element e1, Element e2) {
2424
exists(NestedForLoopSameVariable nested |
2525
e1 = nested.getInnerForStmt().getCondition() and

csharp/ql/src/Likely Bugs/Statements/UseBraces.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ abstract class UnbracedControlStmt extends Stmt
6262
getSuccessorStmt() = result
6363
and getBlockStmt(this) = getBlockStmt(result)
6464
}
65-
65+
6666
private Location getBodyLocation() {
6767
result = getBody().getLocation()
6868
}

csharp/ql/src/Metrics/Callables/CCyclomaticComplexity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ public static void foo(int count)
1414
}
1515
timesLeft--;
1616
}
17-
}
17+
}

csharp/ql/src/Metrics/Callables/CCyclomaticComplexity.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ import csharp
1515
from Callable c
1616
where c.isSourceDeclaration()
1717
select c, c.getCyclomaticComplexity() as n
18-
order by n desc
18+
order by n desc

csharp/ql/src/Metrics/Callables/CLinesOfCode.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ import csharp
1414
from Callable c
1515
where c.isSourceDeclaration()
1616
select c, c.getNumberOfLinesOfCode() as n
17-
order by n desc
17+
order by n desc

csharp/ql/src/Metrics/Callables/CLinesOfComment.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ import csharp
1414
from Callable c
1515
where c.isSourceDeclaration()
1616
select c, c.getNumberOfLinesOfComments() as n
17-
order by n desc
17+
order by n desc

csharp/ql/src/Metrics/Callables/CNumberOfStatements.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import csharp
1313

1414
from Callable c, int n
1515
where c.isSourceDeclaration()
16-
and n = count(Stmt s | s.getEnclosingCallable() = c
16+
and n = count(Stmt s | s.getEnclosingCallable() = c
1717
and s != c.getAChild()) // we do not count the top-level block
1818
select c, n
1919
order by n desc

csharp/ql/src/Metrics/Callables/CPercentageOfComments.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ import csharp
1313

1414
from Callable f, int loc
1515
where f.isSourceDeclaration() and loc = f.getNumberOfLines() and loc > 0
16-
select f, 100.0 * ((float)f.getNumberOfLinesOfComments() / (float)loc)
16+
select f, 100.0 * ((float)f.getNumberOfLinesOfComments() / (float)loc)

csharp/ql/src/Metrics/Callables/StatementNestingDepth.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ public void printCharacterCodes(string[] strings)
1212
}
1313
}
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)