Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Roxane MARECHAL
Source Code Analyzer
Commits
0934211a
Commit
0934211a
authored
Dec 22, 2019
by
Roxane Kang Maréchal
Browse files
Added case where there is continue statement in input file and also handling in analysis.atl
parent
1193718f
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
input/missing-break-in-switch.xmi
View file @
0934211a
This diff is collapsed.
Click to expand it.
src/main/atl/analysis.atl
View file @
0934211a
...
...
@@ -175,8 +175,7 @@ rule MeasureMissingBreakInSwitch(ss: java!SwitchStatement) {
measurement: smm!DirectMeasurement (
error <- 'Missing breaks in Switch in Class : ' + ss.originalCompilationUnit.name + '',
-- Indicates the number of breaks missing in the switch statement
-- value <- (thisModule.nbBranchesOfASwitchStatement(ss) - thisModule.nbIntentionalFallThroughOfASwitchStatement(ss)) - thisModule.nbBreakStatementOfASwitchStatement(ss)
value <- thisModule.nbEmptySwitchCasesOfASwitchStatement(ss)
value <- (thisModule.nbBranchesOfASwitchStatement(ss) - thisModule.nbEmptySwitchCasesOfASwitchStatement(ss)) - thisModule.nbBreakStatementOfASwitchStatement(ss)
)
do {
missingBreakInSwitch;
...
...
@@ -2042,7 +2041,8 @@ helper def: nbBreakStatementOfASwitchStatement(ss:java!SwitchStatement) : Intege
ss.statements->select(each |
each.oclIsTypeOf(java!BreakStatement) or
each.oclIsTypeOf(java!ReturnStatement) or
each.oclIsTypeOf(java!ThrowStatement)
each.oclIsTypeOf(java!ThrowStatement) or
each.oclIsTypeOf(java!ContinueStatement)
).size()
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment