mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #4 from hvitved/csharp/whitespaces
C#: Fix whitespaces
This commit is contained in:
23
csharp/fix-whitespaces.sh
Executable file
23
csharp/fix-whitespaces.sh
Executable 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"
|
||||
@@ -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
|
||||
@@ -11,7 +11,7 @@ import csharp
|
||||
import external.VCS
|
||||
|
||||
int committedFiles(Commit commit) {
|
||||
result = count(commit.getAnAffectedFile())
|
||||
result = count(commit.getAnAffectedFile())
|
||||
}
|
||||
|
||||
from File f
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user