Merge pull request #4 from hvitved/csharp/whitespaces

C#: Fix whitespaces
This commit is contained in:
calumgrant
2018-08-03 16:06:47 +01:00
committed by GitHub
38 changed files with 199 additions and 176 deletions

23
csharp/fix-whitespaces.sh Executable file
View File

@@ -0,0 +1,23 @@
BASEDIR=$(dirname "$0")
cat > "$BASEDIR/reformat.vim" <<"EOF"
:set ff=unix ts=2 et
:retab!
:%s/\r//g
:%s/ \+$//
:wq
EOF
find "$BASEDIR" \( -name "*.ql" -or -name "*.qll" -or -name "*.csv" \) -exec vim -u /dev/null -s reformat.vim {} \;
cat > reformat.vim <<"EOF"
:set ff=unix ts=4 et
:retab!
:%s/\r//g
:%s/ \+$//
:wq
EOF
find "$BASEDIR" \( -name "*.cs" \) -exec vim -u /dev/null -s reformat.vim {} \;
rm "$BASEDIR/reformat.vim"

View File

@@ -15,10 +15,10 @@ import external.CodeDuplication
from SourceFile f, int n
where n = count(int line |
exists(DuplicateBlock d | d.sourceFile() = f |
line in [d.sourceStartLine()..d.sourceEndLine()] and
not whitelistedLineForDuplication(f, line)
)
)
exists(DuplicateBlock d | d.sourceFile() = f |
line in [d.sourceStartLine()..d.sourceEndLine()] and
not whitelistedLineForDuplication(f, line)
)
)
select f, n
order by n desc

View File

@@ -11,7 +11,7 @@ import csharp
import external.VCS
int committedFiles(Commit commit) {
result = count(commit.getAnAffectedFile())
result = count(commit.getAnAffectedFile())
}
from File f

View File

@@ -11,16 +11,16 @@ import csharp
import external.VCS
predicate inRange(Commit first, Commit second) {
first.getAnAffectedFile() = second.getAnAffectedFile() and
first != second and
exists(int n | n = first.getDate().daysTo(second.getDate()) and
n >= 0 and n < 5)
first.getAnAffectedFile() = second.getAnAffectedFile() and
first != second and
exists(int n | n = first.getDate().daysTo(second.getDate()) and
n >= 0 and n < 5)
}
int recommitsForFile(File f) {
result = count(Commit recommit |
f = recommit.getAnAffectedFile() and
exists(Commit prev | inRange(prev, recommit)))
result = count(Commit recommit |
f = recommit.getAnAffectedFile() and
exists(Commit prev | inRange(prev, recommit)))
}
from File f

View File

@@ -11,10 +11,10 @@ import csharp
from ValueOrRefType t, int n
where
t.isSourceDeclaration()
and n = count(Field f |
f.getDeclaringType() = t
and not(f instanceof MemberConstant)
)
t.isSourceDeclaration()
and n = count(Field f |
f.getDeclaringType() = t
and not(f instanceof MemberConstant)
)
select t, n
order by n desc