Skip to content

Commit fb82d43

Browse files
committed
C++: Various renamings
1 parent 34ee947 commit fb82d43

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

cpp/ql/src/Telemetry/Diagnostics.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class SyntaxError extends CompilerError {
2020
* A cannot open file error.
2121
* Typically this is due to a missing include.
2222
*/
23-
class CannotOpenFile extends CompilerError {
24-
CannotOpenFile() { this.hasTag(["cannot_open_file", "cannot_open_file_reason"]) }
23+
class CannotOpenFileError extends CompilerError {
24+
CannotOpenFileError() { this.hasTag(["cannot_open_file", "cannot_open_file_reason"]) }
2525

2626
string getIncludedFile() {
2727
result = this.getMessage().regexpCapture("cannot open source file '([^']+)'", 1)

cpp/ql/src/Telemetry/Metrics.qll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ abstract class SuccessMetric extends ExtractionMetric {
4747
* A metric used to report database quality.
4848
*/
4949
class QualityMetric extends Metric {
50-
BaseMetric base_metric;
51-
SuccessMetric relative_metric;
50+
BaseMetric baseMetric;
51+
SuccessMetric relativeMetric;
5252

5353
QualityMetric() {
54-
base_metric = relative_metric.getBaseline() and this = "Percentage of " + relative_metric
54+
baseMetric = relativeMetric.getBaseline() and this = "Percentage of " + relativeMetric
5555
}
5656

5757
float getValue() {
58-
base_metric.getValue() > 0 and
59-
result = 100.0 * relative_metric.getValue() / base_metric.getValue()
58+
baseMetric.getValue() > 0 and
59+
result = 100.0 * relativeMetric.getValue() / baseMetric.getValue()
6060
}
6161
}
6262

@@ -70,8 +70,8 @@ module RankMetric<RankedMetric M> {
7070

7171
/** Various metrics we want to report. */
7272
module CppMetrics {
73-
class CompilationUnits extends BaseMetric {
74-
CompilationUnits() { this = "compilation units" }
73+
class Compilations extends BaseMetric {
74+
Compilations() { this = "compilations" }
7575

7676
override int getValue() { result = count(Compilation c) }
7777
}
@@ -92,14 +92,14 @@ module CppMetrics {
9292
override SourceFiles getBaseline() { any() }
9393
}
9494

95-
class CompilationUnitsWithoutErrors extends SuccessMetric {
96-
CompilationUnitsWithoutErrors() { this = "compilation units without errors" }
95+
class CompilationsWithoutErrors extends SuccessMetric {
96+
CompilationsWithoutErrors() { this = "compilations without errors" }
9797

9898
override int getValue() {
9999
result = count(Compilation c | not exists(Diagnostic d | d.getFile() = c.getAFileCompiled()))
100100
}
101101

102-
override CompilationUnits getBaseline() { any() }
102+
override Compilations getBaseline() { any() }
103103
}
104104

105105
class Expressions extends BaseMetric {
@@ -186,7 +186,7 @@ module CppMetrics {
186186
override int getValue() {
187187
result =
188188
sum(File f | | f.getMetrics().getNumberOfLinesOfCode()) -
189-
count(File file, int line | errorLine(file, line))
189+
count(File f, int line | errorLine(f, line))
190190
}
191191

192192
override LinesOfCode getBaseline() { any() }
@@ -209,7 +209,7 @@ module CppMetrics {
209209
class Includes extends BaseMetric {
210210
Includes() { this = "#include directives" }
211211

212-
override int getValue() { result = count(Include i) + count(CannotOpenFile e) }
212+
override int getValue() { result = count(Include i) + count(CannotOpenFileError e) }
213213
}
214214

215215
class SucceededIncludes extends SuccessMetric {
@@ -240,11 +240,11 @@ module CppMetrics {
240240
string include_text;
241241

242242
MissingIncludeCount() {
243-
exists(CannotOpenFile e | e.getIncludedFile() = include_text) and
243+
exists(CannotOpenFileError e | e.getIncludedFile() = include_text) and
244244
this = "Failed to include '" + include_text + "'"
245245
}
246246

247-
int getValue() { result = count(CannotOpenFile e | e.getIncludedFile() = include_text) }
247+
int getValue() { result = count(CannotOpenFileError e | e.getIncludedFile() = include_text) }
248248

249249
string getIncludeText() { result = include_text }
250250
}

cpp/ql/test/library-tests/extraction_errors/DatabaseQuality.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
| Percentage of calls with a target | 50.0 |
2-
| Percentage of compilation units without errors | 50.0 |
2+
| Percentage of compilations without errors | 50.0 |
33
| Percentage of expressions with a known type | 30.0 |
44
| Percentage of functions without errors | 75.0 |
55
| Percentage of lines of code without errors | 63.1578947368421 |

cpp/ql/test/library-tests/extraction_errors/ExtractionMetrics.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
| #include directives | 2 |
22
| calls | 2 |
33
| calls with a target | 1 |
4-
| compilation units | 2 |
5-
| compilation units without errors | 1 |
4+
| compilations | 2 |
5+
| compilations without errors | 1 |
66
| compiler errors | 10 |
77
| expressions | 10 |
88
| expressions with a known type | 3 |

0 commit comments

Comments
 (0)