mirror of
https://github.com/github/codeql.git
synced 2026-03-23 16:06:47 +01:00
JavaScript: Autoformat.
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
|
||||
private import semmle.javascript.dataflow.internal.FlowSteps as FlowSteps
|
||||
private import semmle.javascript.dependencies.Dependencies
|
||||
private import semmle.javascript.dependencies.FrameworkLibraries
|
||||
@@ -96,17 +95,13 @@ predicate isExternalLibrary(string name) {
|
||||
* Holds if the global variable `name` is defined externally.
|
||||
*/
|
||||
predicate isExternalGlobal(string name) {
|
||||
exists(ExternalGlobalDecl decl |
|
||||
decl.getName() = name
|
||||
)
|
||||
exists(ExternalGlobalDecl decl | decl.getName() = name)
|
||||
or
|
||||
exists(Dependency dep |
|
||||
// If name is never assigned anywhere, and it coincides with a dependency,
|
||||
// it's most likely coming from there.
|
||||
dep.info(name, _) and
|
||||
not exists(Assignment assign |
|
||||
assign.getLhs().(GlobalVarAccess).getName() = name
|
||||
)
|
||||
not exists(Assignment assign | assign.getLhs().(GlobalVarAccess).getName() = name)
|
||||
)
|
||||
or
|
||||
name = "_"
|
||||
@@ -229,9 +224,7 @@ class UnresolvableCall extends RelevantInvoke {
|
||||
* A call that is believed to call a function within the same project.
|
||||
*/
|
||||
class NonExternalCall extends RelevantInvoke {
|
||||
NonExternalCall() {
|
||||
not this instanceof ExternalCall
|
||||
}
|
||||
NonExternalCall() { not this instanceof ExternalCall }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +242,5 @@ class FunctionWithCallers extends RelevantFunction {
|
||||
* A function without any call sites.
|
||||
*/
|
||||
class FunctionWithoutCallers extends RelevantFunction {
|
||||
FunctionWithoutCallers() {
|
||||
not this instanceof FunctionWithCallers
|
||||
}
|
||||
FunctionWithoutCallers() { not this instanceof FunctionWithCallers }
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/**
|
||||
* @name Called function candidates
|
||||
* @description The number of functions for which finding call sites is relevant
|
||||
* for analysis quality.
|
||||
* for analysis quality.
|
||||
* @kind metric
|
||||
* @metricType project
|
||||
* @metricAggregate sum
|
||||
* @tags meta
|
||||
* @id js/meta/called-function-candidates
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* @tags meta
|
||||
* @id js/meta/called-function-ratio
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
select projectRoot(), 100.0 * count(FunctionWithCallers f) / (float) count(RelevantFunction f)
|
||||
select projectRoot(), 100.0 * count(FunctionWithCallers f) / count(RelevantFunction f).(float)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @tags meta
|
||||
* @id js/meta/called-functions
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @tags meta
|
||||
* @id js/meta/resolvable-call-candidates
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* @tags meta
|
||||
* @id js/meta/resolvable-call-ratio
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
select projectRoot(), 100.0 * count(ResolvableCall call) / (float) count(NonExternalCall call)
|
||||
select projectRoot(), 100.0 * count(ResolvableCall call) / count(NonExternalCall call).(float)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @tags meta
|
||||
* @id js/meta/resolvable-calls
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @tags meta
|
||||
* @id js/meta/uncalled-functions
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @tags meta
|
||||
* @id js/meta/unresolvable-calls
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
|
||||
Reference in New Issue
Block a user