From 9009a50227c533e5f322b2d70bb57db71bd37aff Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Thu, 11 Oct 2018 14:17:53 +0200 Subject: [PATCH] Java: Adjust comment style. --- .../code/java/security/FileReadWrite.qll | 12 +++------ .../code/java/security/FileWritable.qll | 25 ++++--------------- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/java/ql/src/semmle/code/java/security/FileReadWrite.qll b/java/ql/src/semmle/code/java/security/FileReadWrite.qll index dac80d4dbcd..68cd987532c 100644 --- a/java/ql/src/semmle/code/java/security/FileReadWrite.qll +++ b/java/ql/src/semmle/code/java/security/FileReadWrite.qll @@ -4,10 +4,7 @@ import java * Holds if `fileAccess` is used in the `fileReadingExpr` to read the represented file. */ private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) { - /* - * `fileAccess` used to construct a class that reads a file. - */ - + // `fileAccess` used to construct a class that reads a file. exists(ClassInstanceExpr cie | cie = fileReadingExpr and cie.getArgument(0) = fileAccess @@ -21,11 +18,8 @@ private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) { ma = fileReadingExpr and filesMethod = ma.getMethod() | ( - /* - * Identify all method calls on the `Files` class that imply that we are reading the file - * represented by the first argument. - */ - + // Identify all method calls on the `Files` class that imply that we are reading the file + // represented by the first argument. filesMethod.getDeclaringType().hasQualifiedName("java.nio.file", "Files") and fileAccess = ma.getArgument(0) and ( diff --git a/java/ql/src/semmle/code/java/security/FileWritable.qll b/java/ql/src/semmle/code/java/security/FileWritable.qll index 9bad12704fb..cc27f5f779d 100644 --- a/java/ql/src/semmle/code/java/security/FileWritable.qll +++ b/java/ql/src/semmle/code/java/security/FileWritable.qll @@ -66,10 +66,7 @@ private EnumConstant getAContainedEnumConstant(Expr enumSetRef) { private VarAccess getFileForPathConversion(Expr pathExpr) { pathExpr.getType().(RefType).hasQualifiedName("java.nio.file", "Path") and ( - /* - * Look for conversion from `File` to `Path` using `file.getPath()`. - */ - + // Look for conversion from `File` to `Path` using `file.getPath()`. exists(MethodAccess fileToPath | fileToPath = pathExpr and result = fileToPath.getQualifier() and @@ -77,10 +74,7 @@ private VarAccess getFileForPathConversion(Expr pathExpr) { fileToPath.getMethod().getDeclaringType().hasQualifiedName("java.io", "File") ) or - /* - * Look for the pattern `Paths.get(file.get*Path())` for converting between a `File` and a `Path`. - */ - + // Look for the pattern `Paths.get(file.get*Path())` for converting between a `File` and a `Path`. exists(MethodAccess pathsGet, MethodAccess fileGetPath | pathsGet = pathExpr and pathsGet.getMethod().hasName("get") and @@ -99,10 +93,7 @@ private VarAccess getFileForPathConversion(Expr pathExpr) { * Holds if `fileAccess` is used in the `setWorldWritableExpr` to set the file to be world writable. */ private predicate fileSetWorldWritable(VarAccess fileAccess, Expr setWorldWritable) { - /* - * Calls to `File.setWritable(.., false)`. - */ - + // Calls to `File.setWritable(.., false)`. exists(MethodAccess fileSetWritable | // A call to the `setWritable` method. fileSetWritable.getMethod() instanceof SetWritable and @@ -114,10 +105,7 @@ private predicate fileSetWorldWritable(VarAccess fileAccess, Expr setWorldWritab fileAccess = fileSetWritable.getQualifier() ) or - /* - * Calls to `Files.setPosixFilePermissions(...)`. - */ - + // Calls to `Files.setPosixFilePermissions(...)`. exists(MethodAccess setPosixPerms | setPosixPerms = setWorldWritable and setPosixPerms.getMethod().hasName("setPosixFilePermissions") and @@ -132,10 +120,7 @@ private predicate fileSetWorldWritable(VarAccess fileAccess, Expr setWorldWritab getAContainedEnumConstant(setPosixPerms.getArgument(1)).hasName("OTHERS_WRITE") ) or - /* - * Calls to something that indirectly sets the file permissions. - */ - + // Calls to something that indirectly sets the file permissions. exists(Call call, int parameterPos, VarAccess nestedFileAccess, Expr nestedSetWorldWritable | call = setWorldWritable and fileSetWorldWritable(nestedFileAccess, nestedSetWorldWritable) and