Skip to content

Rename all upper-case variables, and all lower-case modules #8403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 15, 2022
Merged
2 changes: 1 addition & 1 deletion java/ql/test/library-tests/frameworks/JaxWs/JaxRs.ql
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class JaxRsTest extends InlineExpectationsTest {
or
tag = "ResourceMethodOnResourceClass" and
exists(JaxRsResourceMethod resourceMethod |
resourceMethod = any(JaxRsResourceClass ResourceClass).getAResourceMethod()
resourceMethod = any(JaxRsResourceClass resourceClass).getAResourceMethod()
|
resourceMethod.getLocation() = location and
element = resourceMethod.toString() and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import semmle.code.java.Type

predicate typeIsInCU(Type tpe, CompilationUnit cu) { tpe.getCompilationUnit() = cu }

from Type tpe, CompilationUnit Ajava
from Type tpe, CompilationUnit aJava
where
Ajava.hasName("A") and
typeIsInCU(tpe, Ajava)
aJava.hasName("A") and
typeIsInCU(tpe, aJava)
select tpe
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
category: deprecated
---
* Some modules that started with a lowercase letter has been renamed to follow our style-guide.
The old name still exists as a deprecated alias.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private module Winston {
/**
* Provides classes for working with [log4js](https://github.com/log4js-node/log4js-node).
*/
private module log4js {
private module Log4js {
/**
* A call to the log4js logging mechanism.
*/
Expand Down
42 changes: 33 additions & 9 deletions javascript/ql/lib/semmle/javascript/frameworks/UriLibraries.qll
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ abstract deprecated class UriLibraryStep extends DataFlow::ValueNode {
predicate step(DataFlow::Node pred, DataFlow::Node succ) { none() }
}

/** DEPRECATED: Alias for `Urijs` */
deprecated module urijs = Urijs;

/**
* Provides classes for working with [urijs](http://medialize.github.io/URI.js/) code.
*/
module urijs {
module Urijs {
/**
* Gets a data flow source node for the urijs library.
*/
Expand Down Expand Up @@ -80,10 +83,13 @@ module urijs {
}
}

/** DEPRECATED: Alias for `Uridashjs` */
deprecated module uridashjs = Uridashjs;

/**
* Provides classes for working with [uri-js](https://github.com/garycourt/uri-js) code.
*/
module uridashjs {
module Uridashjs {
/**
* Gets a data flow source node for member `name` of the uridashjs library.
*/
Expand All @@ -105,10 +111,13 @@ module uridashjs {
}
}

/** DEPRECATED: Alias for `Punycode` */
deprecated module punycode = Punycode;

/**
* Provides classes for working with [punycode](https://github.com/bestiejs/punycode.js) code.
*/
module punycode {
module Punycode {
/**
* Gets a data flow source node for member `name` of the punycode library.
*/
Expand All @@ -130,10 +139,13 @@ module punycode {
}
}

/** DEPRECATED: Alias for `UrlParse` */
deprecated module urlParse = UrlParse;

/**
* Provides classes for working with [url-parse](https://github.com/unshiftio/url-parse) code.
*/
module urlParse {
module UrlParse {
/**
* Gets a data flow source node for the url-parse library.
*/
Expand Down Expand Up @@ -167,10 +179,13 @@ module urlParse {
}
}

/** DEPRECATED: Alias for `Querystringify` */
deprecated module querystringify = Querystringify;

/**
* Provides classes for working with [querystringify](https://github.com/unshiftio/querystringify) code.
*/
module querystringify {
module Querystringify {
/**
* Gets a data flow source node for member `name` of the querystringify library.
*/
Expand All @@ -197,10 +212,13 @@ module querystringify {
}
}

/** DEPRECATED: Alias for `Querydashstring` */
deprecated module querydashstring = Querydashstring;

/**
* Provides classes for working with [query-string](https://github.com/sindresorhus/query-string) code.
*/
module querydashstring {
module Querydashstring {
/**
* Gets a data flow source node for member `name` of the query-string library.
*/
Expand All @@ -222,10 +240,13 @@ module querydashstring {
}
}

/** DEPRECATED: Alias for `Url` */
deprecated module url = Url;

/**
* Provides classes for working with [url](https://nodejs.org/api/url.html) code.
*/
module url {
module Url {
/**
* Gets a data flow source node for member `name` of the url library.
*/
Expand All @@ -245,10 +266,13 @@ module url {
}
}

/** DEPRECATED: Alias for `Querystring` */
deprecated module querystring = Querystring;

/**
* Provides classes for working with [querystring](https://nodejs.org/api/querystring.html) code.
*/
module querystring {
module Querystring {
/**
* Gets a data flow source node for member `name` of the querystring library.
*/
Expand Down Expand Up @@ -408,7 +432,7 @@ private module ClosureLibraryUri {
/**
* Provides classes for working with [path](https://nodejs.org/api/path.html) code.
*/
module path {
module Path {
/**
* A taint step in the path module.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import javascript

query predicate punycode(DataFlow::Node n) { n = punycode::punycodeMember(_) }
query predicate punycode(DataFlow::Node n) { n = Punycode::punycodeMember(_) }

query predicate querydashstring(DataFlow::Node n) { n = querydashstring::querydashstringMember(_) }
query predicate querydashstring(DataFlow::Node n) { n = Querydashstring::querydashstringMember(_) }

query predicate querystring(DataFlow::Node n) { n = querystring::querystringMember(_) }
query predicate querystring(DataFlow::Node n) { n = Querystring::querystringMember(_) }

query predicate querystringify(DataFlow::Node n) { n = querystringify::querystringifyMember(_) }
query predicate querystringify(DataFlow::Node n) { n = Querystringify::querystringifyMember(_) }

query predicate uridashjs(DataFlow::Node n) { n = uridashjs::uridashjsMember(_) }
query predicate uridashjs(DataFlow::Node n) { n = Uridashjs::uridashjsMember(_) }

query predicate urijs(DataFlow::Node n) { n = urijs::urijs() }
query predicate urijs(DataFlow::Node n) { n = Urijs::urijs() }

query predicate uriLibraryStep(DataFlow::Node pred, DataFlow::Node succ) {
TaintTracking::uriStep(pred, succ)
}

query predicate url(DataFlow::Node n) { n = url::urlMember(_) }
query predicate url(DataFlow::Node n) { n = Url::urlMember(_) }

query predicate urlParse(DataFlow::Node n) { n = urlParse::urlParse() }
query predicate urlParse(DataFlow::Node n) { n = UrlParse::urlParse() }
5 changes: 5 additions & 0 deletions python/ql/lib/change-notes/2022-02-07-deprecated-modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
category: deprecated
---
* Some modules that started with a lowercase letter has been renamed to follow our style-guide.
The old name still exists as a deprecated alias.
8 changes: 4 additions & 4 deletions python/ql/lib/semmle/python/Metrics.qll
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class FunctionMetrics extends Function {
* P = the number of connected components, which for a single function is 1.
*/
int getCyclomaticComplexity() {
exists(int E, int N |
N = count(BasicBlock b | b = this.getABasicBlock() and b.likelyReachable()) and
E =
exists(int e, int n |
n = count(BasicBlock b | b = this.getABasicBlock() and b.likelyReachable()) and
e =
count(BasicBlock b1, BasicBlock b2 |
b1 = this.getABasicBlock() and
b1.likelyReachable() and
Expand All @@ -39,7 +39,7 @@ class FunctionMetrics extends Function {
not b1.unlikelySuccessor(b2)
)
|
result = E - N + 2
result = e - n + 2
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ predicate isArgumentNode(ArgumentNode arg, DataFlowCall c, ArgumentPosition pos)
//--------
predicate isExpressionNode(ControlFlowNode node) { node.getNode() instanceof Expr }

/** DEPRECATED: Alias for `SyntheticPreUpdateNode` */
deprecated module syntheticPreUpdateNode = SyntheticPreUpdateNode;

/** A module collecting the different reasons for synthesising a pre-update node. */
module syntheticPreUpdateNode {
module SyntheticPreUpdateNode {
class SyntheticPreUpdateNode extends Node, TSyntheticPreUpdateNode {
NeedsSyntheticPreUpdateNode post;

Expand Down Expand Up @@ -78,10 +81,13 @@ module syntheticPreUpdateNode {
CfgNode objectCreationNode() { result.getNode().(CallNode) = any(ClassCall c).getNode() }
}

import syntheticPreUpdateNode
import SyntheticPreUpdateNode

/** DEPRECATED: Alias for `SyntheticPostUpdateNode` */
deprecated module syntheticPostUpdateNode = SyntheticPostUpdateNode;

/** A module collecting the different reasons for synthesising a post-update node. */
module syntheticPostUpdateNode {
module SyntheticPostUpdateNode {
/** A post-update node is synthesized for all nodes which satisfy `NeedsSyntheticPostUpdateNode`. */
class SyntheticPostUpdateNode extends PostUpdateNode, TSyntheticPostUpdateNode {
NeedsSyntheticPostUpdateNode pre;
Expand Down Expand Up @@ -177,7 +183,7 @@ module syntheticPostUpdateNode {
}
}

import syntheticPostUpdateNode
import SyntheticPostUpdateNode

class DataFlowExpr = Expr;

Expand Down
Loading