From 32119726e1fe6e97b3f3d13617f54387a6ff7fdc Mon Sep 17 00:00:00 2001 From: Gordon Fraser Date: Thu, 4 Aug 2022 07:21:21 +0200 Subject: [PATCH 1/9] Bump version numbers --- README.md | 25 +++++++++++++------------ pom.xml | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d0cd9c703..c9d0959a9 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ produce an executable jar-file, run the following command: mvn package ``` -This will produce `target/Litterbox-1.7.jar` +This will produce `target/Litterbox-1.8.jar` ## Using LitterBox @@ -37,7 +37,7 @@ This will produce `target/Litterbox-1.7.jar` To see an overview of the command line options available in LitterBox type: ``` -java -jar Litterbox-1.7.jar --help +java -jar Litterbox-1.8.jar --help ``` ### Basic usage @@ -46,7 +46,7 @@ LitterBox parses the JSON file of a Scratch project, which contains its source code. Given such a JSON file, LitterBox is invoked as follows: ``` -java -jar Litterbox-1.7.jar --check --path +java -jar Litterbox-1.8.jar --check --path ``` As a result, LitterBox will report any occurrences of bug patterns or @@ -59,7 +59,7 @@ If you want to check a specific project given its ID (which you can find in the URL of the project), you can use the following command: ``` -java -jar Litterbox-1.7.jar --check --projectid --path +java -jar Litterbox-1.8.jar --check --projectid --path ``` When invoked this way, LitterBox will retrieve the JSON file @@ -75,7 +75,7 @@ project IDs to check in a text file (one project ID per line) and invoke LitterBox as follows: ``` -java -jar Litterbox-1.7.jar --check --projectlist --path +java -jar Litterbox-1.8.jar --check --projectlist --path ``` LitterBox will check the given path for the projects. @@ -91,7 +91,7 @@ filename specified in order to decide whether to produce CSV or JSON output: ``` -java -jar Litterbox-1.7.jar --check --path --output +java -jar Litterbox-1.8.jar --check --path --output ``` The CSV file will contain a high-level summary of the number of @@ -103,7 +103,7 @@ analyzed Scratch-project, where all occurrences of bug patterns are highlighted with comments. ``` -java -jar Litterbox-1.7.jar --check --path --annotate +java -jar Litterbox-1.8.jar --check --path --annotate ``` @@ -119,14 +119,14 @@ comma-separated list of bug patterns, e.g.: ``` -java -jar Litterbox-1.7.jar --check --path --detectors endless_recursion,call_without_definition +java -jar Litterbox-1.8.jar --check --path --detectors endless_recursion,call_without_definition ``` A full list of available bug checkers can be retrieved using: ``` -java -jar Litterbox-1.7.jar --help +java -jar Litterbox-1.8.jar --help ``` To select all bug patterns, you can also use the term `bugs` in the @@ -140,7 +140,7 @@ LitterBox can produce statistics on code metrics of a project (e.g., number of blocks, number of sprites, weighted method count): ``` -java -jar Litterbox-1.7.jar --stats --path --output +java -jar Litterbox-1.8.jar --stats --path --output ``` ### Automatically refactoring projects @@ -148,7 +148,7 @@ java -jar Litterbox-1.7.jar --stats --path --output \ --refactored-projects @@ -166,7 +166,7 @@ Litterbox produces a file with exactly these rules. It's like a Scratch extracto multiple projects and produces the output to the declared output folder. ``` -java -jar target/Litterbox-1.7-SNAPSHOT.jar -c2v -output -path +java -jar target/Litterbox-1.8-SNAPSHOT.jar -c2v -output -path ``` There are some differences between Scratch and "normal" programming languages like Java, but the most important is, @@ -232,6 +232,7 @@ Jonas Lerchenberger\ Stephan Lukasczyk\ Miriam Münch\ Florian Obermüller\ +Robert Pernerstorfer\ Gregorio Robles\ Lisa-Marina Salvesen\ Sebastian Schweikl\ diff --git a/pom.xml b/pom.xml index 11ee443b2..63fe2357b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.uni_passau.fim.se2 Litterbox - 1.8-SNAPSHOT + 1.8 From dcd4b9f2d499565cf6bd2042f45ff0e5ec96d8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Oberm=C3=BCller?= Date: Tue, 9 Aug 2022 17:00:08 +0200 Subject: [PATCH 2/9] mention robots in README.md --- README.md | 8 +++++++- src/main/resources/litterbox.properties | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c9d0959a9..856383bf2 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,6 @@ java -jar Litterbox-1.8.jar --check --path --detectors en A full list of available bug checkers can be retrieved using: - ``` java -jar Litterbox-1.8.jar --help ``` @@ -132,7 +131,14 @@ java -jar Litterbox-1.8.jar --help To select all bug patterns, you can also use the term `bugs` in the list; to select all code smell checks use `smells`. +### Activating robot finders + +To activate finders for the mBlock and Codey Rocky robots set the flag +in the litterbox.properties file to true. +``` +issues.load_mblock=true +``` ### Collecting statistics diff --git a/src/main/resources/litterbox.properties b/src/main/resources/litterbox.properties index c0702fdc5..cdd1b72c3 100644 --- a/src/main/resources/litterbox.properties +++ b/src/main/resources/litterbox.properties @@ -14,6 +14,6 @@ json.subsumption=True json.duplicates=True json.coupling=True issues.load_general=true -issues.load_mblock=true +issues.load_mblock=false parser.log_file_name=true parser.log_unknown_opcode=false From 219a9f5a4f3b7061c64754c0c5e7e84dbf1ee24e Mon Sep 17 00:00:00 2001 From: obermuel Date: Thu, 11 Aug 2022 08:03:23 +0200 Subject: [PATCH 3/9] fix pipeline --- src/main/resources/litterbox.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/litterbox.properties b/src/main/resources/litterbox.properties index cdd1b72c3..c0702fdc5 100644 --- a/src/main/resources/litterbox.properties +++ b/src/main/resources/litterbox.properties @@ -14,6 +14,6 @@ json.subsumption=True json.duplicates=True json.coupling=True issues.load_general=true -issues.load_mblock=false +issues.load_mblock=true parser.log_file_name=true parser.log_unknown_opcode=false From 8541ae230c5fc62d9a04455111a40b5ee1476552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Oberm=C3=BCller?= Date: Tue, 23 Aug 2022 17:21:42 +0200 Subject: [PATCH 4/9] adapt readme --- README.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 856383bf2..58cc559d9 100644 --- a/README.md +++ b/README.md @@ -131,13 +131,13 @@ java -jar Litterbox-1.8.jar --help To select all bug patterns, you can also use the term `bugs` in the list; to select all code smell checks use `smells`. -### Activating robot finders +### Deactivating robot finders -To activate finders for the mBlock and Codey Rocky robots set the flag -in the litterbox.properties file to true. +To deactivate finders for the mBlock and Codey Rocky robots set the flag +in the litterbox.properties file to false. ``` -issues.load_mblock=true +issues.load_mblock=false ``` ### Collecting statistics @@ -207,12 +207,21 @@ in Proceedings of the IEEE/ACM 43rd International Conference on Software Enginee To learn more about bug patterns, see the following paper: C. Frädrich, F. Obermüller, N. Körber, U. Heuer, and G. Fraser, “Common bugs in scratch programs,” in Proceedings of - the 25th Annual Conference on Innovation and Technology in Computer - Science Education (ITiCSE), pages 89-95, ACM, 2020. [https://doi.org/10.1145/3341525.3387389](https://doi.org/10.1145/3341525.3387389) +the 25th Annual Conference on Innovation and Technology in Computer +Science Education (ITiCSE), pages 89-95, ACM, +2020. [https://doi.org/10.1145/3341525.3387389](https://doi.org/10.1145/3341525.3387389) To learn more about code perfumes, see the following paper: -F. Obermüller, L. Bloch, L. Greifenstein, U. Heuer, and G. Fraser, "Code Perfumes: Reporting Good Code to Encourage Learners", in Proceedings of the 16th Workshop in Primary and Secondary Computing Education (WiPSCE ’21). ACM, 2021. [https://arxiv.org/abs/2108.06289](https://arxiv.org/abs/2108.06289) +F. Obermüller, L. Bloch, L. Greifenstein, U. Heuer, and G. Fraser, "Code Perfumes: Reporting Good Code to Encourage +Learners", in Proceedings of the 16th Workshop in Primary and Secondary Computing Education (WiPSCE ’21). ACM, +2021. [https://arxiv.org/abs/2108.06289](https://arxiv.org/abs/2108.06289) + +To learn more about code patterns in mBlock robot programs, see the following paper: + +F. Obermüller, R. Pernerstorfer, L. Bailey, U. Heuer, and G. Fraser, "Common Patterns in Block-Based Robot Programs", +in Proceedings of the 17th Workshop in Primary and Secondary Computing Education (WiPSCE ’22). ACM, +2022. [https://doi.org/10.1145/3556787.3556859](https://doi.org/10.1145/3556787.3556859) ## Contributors From 48852404470e450654bd38c4ab10bfefc4efc6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Oberm=C3=BCller?= Date: Thu, 25 Aug 2022 11:32:50 +0200 Subject: [PATCH 5/9] add advantages of not using mblock finders --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 58cc559d9..d33fac68c 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,8 @@ list; to select all code smell checks use `smells`. ### Deactivating robot finders To deactivate finders for the mBlock and Codey Rocky robots set the flag -in the litterbox.properties file to false. +in the litterbox.properties file to false. This can reduce the run time of +the analysis and the size of a resulting CSV file. ``` issues.load_mblock=false From 3d5fbdaede71fc021590b7341f599b17cdf469cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Oberm=C3=BCller?= Date: Thu, 25 Aug 2022 12:34:38 +0200 Subject: [PATCH 6/9] checkPosition as first thing in until block --- .../bugpattern/ForeverInsideLoop.java | 2 +- .../foreverInsideLoopBlockBeforeUntil.json | 268 ++++++++++++++++++ .../bugpattern/ForeverInsideLoopTest.java | 5 + 3 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json diff --git a/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java b/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java index e6881fe7a..14a553618 100644 --- a/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java +++ b/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java @@ -56,8 +56,8 @@ public void visit(ActorDefinition actor) { @Override public void visit(UntilStmt node) { - loopStack.push(node); checkPosition(node); + loopStack.push(node); visitChildren(node); loopStack.pop(); } diff --git a/src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json b/src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json new file mode 100644 index 000000000..dd5676dd3 --- /dev/null +++ b/src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json @@ -0,0 +1,268 @@ +{ + "targets": [ + { + "isStage": true, + "name": "Stage", + "variables": { + "`jEk@4|i[#Fk?(8x)AV.-my variable": [ + "my variable", + 0 + ] + }, + "lists": {}, + "broadcasts": {}, + "blocks": {}, + "comments": {}, + "currentCostume": 0, + "costumes": [ + { + "name": "backdrop1", + "dataFormat": "svg", + "assetId": "cd21514d0531fdffb22204e0ec5ed84a", + "md5ext": "cd21514d0531fdffb22204e0ec5ed84a.svg", + "rotationCenterX": 240, + "rotationCenterY": 180 + } + ], + "sounds": [ + { + "name": "pop", + "assetId": "83a9787d4cb6f3b7632b4ddfebf74367", + "dataFormat": "wav", + "format": "", + "rate": 48000, + "sampleCount": 1124, + "md5ext": "83a9787d4cb6f3b7632b4ddfebf74367.wav" + } + ], + "volume": 100, + "layerOrder": 0, + "tempo": 60, + "videoTransparency": 50, + "videoState": "on", + "textToSpeechLanguage": null + }, + { + "isStage": false, + "name": "Sprite1", + "variables": {}, + "lists": {}, + "broadcasts": {}, + "blocks": { + ";os!m|z0$,|aYto~BN/}": { + "opcode": "event_whenflagclicked", + "next": "g]x*xJwy{TiqJ$^LQjGx", + "parent": null, + "inputs": {}, + "fields": {}, + "shadow": false, + "topLevel": true, + "x": 579, + "y": 221 + }, + "g]x*xJwy{TiqJ$^LQjGx": { + "opcode": "looks_say", + "next": "bJ@L`[ct2wE%JFc$:Qew", + "parent": ";os!m|z0$,|aYto~BN/}", + "inputs": { + "MESSAGE": [ + 1, + [ + 10, + "Hello!" + ] + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + }, + "bJ@L`[ct2wE%JFc$:Qew": { + "opcode": "control_repeat_until", + "next": null, + "parent": "g]x*xJwy{TiqJ$^LQjGx", + "inputs": { + "CONDITION": [ + 2, + ")VsoB6aDHc2pMn*QFaR5" + ], + "SUBSTACK": [ + 2, + "6An!-Zok/I-6^D!mp9NB" + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + }, + ")VsoB6aDHc2pMn*QFaR5": { + "opcode": "sensing_touchingobject", + "next": null, + "parent": "bJ@L`[ct2wE%JFc$:Qew", + "inputs": { + "TOUCHINGOBJECTMENU": [ + 1, + "PN#/YT#Wxkhf-[t8/568" + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + }, + "PN#/YT#Wxkhf-[t8/568": { + "opcode": "sensing_touchingobjectmenu", + "next": null, + "parent": ")VsoB6aDHc2pMn*QFaR5", + "inputs": {}, + "fields": { + "TOUCHINGOBJECTMENU": [ + "_mouse_", + null + ] + }, + "shadow": true, + "topLevel": false + }, + "6An!-Zok/I-6^D!mp9NB": { + "opcode": "sensing_askandwait", + "next": "JIrm^eyI=f9b*CIsmAOM", + "parent": "bJ@L`[ct2wE%JFc$:Qew", + "inputs": { + "QUESTION": [ + 1, + [ + 10, + "What's your name?" + ] + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + }, + "JIrm^eyI=f9b*CIsmAOM": { + "opcode": "control_repeat_until", + "next": null, + "parent": "6An!-Zok/I-6^D!mp9NB", + "inputs": { + "CONDITION": [ + 2, + "bc9/~lCf1):7akf,ou)/" + ], + "SUBSTACK": [ + 2, + "9z}l}j5}0S.BjQA~5bH6" + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + }, + "bc9/~lCf1):7akf,ou)/": { + "opcode": "operator_contains", + "next": null, + "parent": "JIrm^eyI=f9b*CIsmAOM", + "inputs": { + "STRING1": [ + 1, + [ + 10, + "apple" + ] + ], + "STRING2": [ + 1, + [ + 10, + "a" + ] + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + }, + "9z}l}j5}0S.BjQA~5bH6": { + "opcode": "control_forever", + "next": null, + "parent": "JIrm^eyI=f9b*CIsmAOM", + "inputs": { + "SUBSTACK": [ + 2, + "1%XXl]n?J6sL]L~f6|qR" + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + }, + "1%XXl]n?J6sL]L~f6|qR": { + "opcode": "motion_movesteps", + "next": null, + "parent": "9z}l}j5}0S.BjQA~5bH6", + "inputs": { + "STEPS": [ + 1, + [ + 4, + "10" + ] + ] + }, + "fields": {}, + "shadow": false, + "topLevel": false + } + }, + "comments": {}, + "currentCostume": 0, + "costumes": [ + { + "name": "costume1", + "bitmapResolution": 1, + "dataFormat": "svg", + "assetId": "bcf454acf82e4504149f7ffe07081dbc", + "md5ext": "bcf454acf82e4504149f7ffe07081dbc.svg", + "rotationCenterX": 48, + "rotationCenterY": 50 + }, + { + "name": "costume2", + "bitmapResolution": 1, + "dataFormat": "svg", + "assetId": "0fb9be3e8397c983338cb71dc84d0b25", + "md5ext": "0fb9be3e8397c983338cb71dc84d0b25.svg", + "rotationCenterX": 46, + "rotationCenterY": 53 + } + ], + "sounds": [ + { + "name": "Meow", + "assetId": "83c36d806dc92327b9e7049a565c6bff", + "dataFormat": "wav", + "format": "", + "rate": 48000, + "sampleCount": 40682, + "md5ext": "83c36d806dc92327b9e7049a565c6bff.wav" + } + ], + "volume": 100, + "layerOrder": 1, + "visible": true, + "x": 0, + "y": 0, + "size": 100, + "direction": 90, + "draggable": false, + "rotationStyle": "all around" + } + ], + "monitors": [], + "extensions": [], + "meta": { + "semver": "3.0.0", + "vm": "1.1.2", + "agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0" + } +} diff --git a/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java b/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java index 47db49035..f3e40f564 100644 --- a/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java +++ b/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java @@ -84,4 +84,9 @@ public void testForeverInsideLoopInIfElse() throws IOException, ParsingException Set refactoredIssues = finder.check(refactoredProgram); assertThat(refactoredIssues).isEmpty(); } + + @Test + public void testForeverInLoopBlockBeforeUntil() throws IOException, ParsingException { + assertThatFinderReports(1, new ForeverInsideLoop(), "./src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json"); + } } From 57df4ac5ed80f0fdb279fdd05592a8fa32d5fd3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Oberm=C3=BCller?= Date: Thu, 25 Aug 2022 12:37:29 +0200 Subject: [PATCH 7/9] Revert "checkPosition as first thing in until block" This reverts commit 3d5fbdaede71fc021590b7341f599b17cdf469cb. --- .../bugpattern/ForeverInsideLoop.java | 2 +- .../foreverInsideLoopBlockBeforeUntil.json | 268 ------------------ .../bugpattern/ForeverInsideLoopTest.java | 5 - 3 files changed, 1 insertion(+), 274 deletions(-) delete mode 100644 src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json diff --git a/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java b/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java index 14a553618..e6881fe7a 100644 --- a/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java +++ b/src/main/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoop.java @@ -56,8 +56,8 @@ public void visit(ActorDefinition actor) { @Override public void visit(UntilStmt node) { - checkPosition(node); loopStack.push(node); + checkPosition(node); visitChildren(node); loopStack.pop(); } diff --git a/src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json b/src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json deleted file mode 100644 index dd5676dd3..000000000 --- a/src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json +++ /dev/null @@ -1,268 +0,0 @@ -{ - "targets": [ - { - "isStage": true, - "name": "Stage", - "variables": { - "`jEk@4|i[#Fk?(8x)AV.-my variable": [ - "my variable", - 0 - ] - }, - "lists": {}, - "broadcasts": {}, - "blocks": {}, - "comments": {}, - "currentCostume": 0, - "costumes": [ - { - "name": "backdrop1", - "dataFormat": "svg", - "assetId": "cd21514d0531fdffb22204e0ec5ed84a", - "md5ext": "cd21514d0531fdffb22204e0ec5ed84a.svg", - "rotationCenterX": 240, - "rotationCenterY": 180 - } - ], - "sounds": [ - { - "name": "pop", - "assetId": "83a9787d4cb6f3b7632b4ddfebf74367", - "dataFormat": "wav", - "format": "", - "rate": 48000, - "sampleCount": 1124, - "md5ext": "83a9787d4cb6f3b7632b4ddfebf74367.wav" - } - ], - "volume": 100, - "layerOrder": 0, - "tempo": 60, - "videoTransparency": 50, - "videoState": "on", - "textToSpeechLanguage": null - }, - { - "isStage": false, - "name": "Sprite1", - "variables": {}, - "lists": {}, - "broadcasts": {}, - "blocks": { - ";os!m|z0$,|aYto~BN/}": { - "opcode": "event_whenflagclicked", - "next": "g]x*xJwy{TiqJ$^LQjGx", - "parent": null, - "inputs": {}, - "fields": {}, - "shadow": false, - "topLevel": true, - "x": 579, - "y": 221 - }, - "g]x*xJwy{TiqJ$^LQjGx": { - "opcode": "looks_say", - "next": "bJ@L`[ct2wE%JFc$:Qew", - "parent": ";os!m|z0$,|aYto~BN/}", - "inputs": { - "MESSAGE": [ - 1, - [ - 10, - "Hello!" - ] - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - }, - "bJ@L`[ct2wE%JFc$:Qew": { - "opcode": "control_repeat_until", - "next": null, - "parent": "g]x*xJwy{TiqJ$^LQjGx", - "inputs": { - "CONDITION": [ - 2, - ")VsoB6aDHc2pMn*QFaR5" - ], - "SUBSTACK": [ - 2, - "6An!-Zok/I-6^D!mp9NB" - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - }, - ")VsoB6aDHc2pMn*QFaR5": { - "opcode": "sensing_touchingobject", - "next": null, - "parent": "bJ@L`[ct2wE%JFc$:Qew", - "inputs": { - "TOUCHINGOBJECTMENU": [ - 1, - "PN#/YT#Wxkhf-[t8/568" - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - }, - "PN#/YT#Wxkhf-[t8/568": { - "opcode": "sensing_touchingobjectmenu", - "next": null, - "parent": ")VsoB6aDHc2pMn*QFaR5", - "inputs": {}, - "fields": { - "TOUCHINGOBJECTMENU": [ - "_mouse_", - null - ] - }, - "shadow": true, - "topLevel": false - }, - "6An!-Zok/I-6^D!mp9NB": { - "opcode": "sensing_askandwait", - "next": "JIrm^eyI=f9b*CIsmAOM", - "parent": "bJ@L`[ct2wE%JFc$:Qew", - "inputs": { - "QUESTION": [ - 1, - [ - 10, - "What's your name?" - ] - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - }, - "JIrm^eyI=f9b*CIsmAOM": { - "opcode": "control_repeat_until", - "next": null, - "parent": "6An!-Zok/I-6^D!mp9NB", - "inputs": { - "CONDITION": [ - 2, - "bc9/~lCf1):7akf,ou)/" - ], - "SUBSTACK": [ - 2, - "9z}l}j5}0S.BjQA~5bH6" - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - }, - "bc9/~lCf1):7akf,ou)/": { - "opcode": "operator_contains", - "next": null, - "parent": "JIrm^eyI=f9b*CIsmAOM", - "inputs": { - "STRING1": [ - 1, - [ - 10, - "apple" - ] - ], - "STRING2": [ - 1, - [ - 10, - "a" - ] - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - }, - "9z}l}j5}0S.BjQA~5bH6": { - "opcode": "control_forever", - "next": null, - "parent": "JIrm^eyI=f9b*CIsmAOM", - "inputs": { - "SUBSTACK": [ - 2, - "1%XXl]n?J6sL]L~f6|qR" - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - }, - "1%XXl]n?J6sL]L~f6|qR": { - "opcode": "motion_movesteps", - "next": null, - "parent": "9z}l}j5}0S.BjQA~5bH6", - "inputs": { - "STEPS": [ - 1, - [ - 4, - "10" - ] - ] - }, - "fields": {}, - "shadow": false, - "topLevel": false - } - }, - "comments": {}, - "currentCostume": 0, - "costumes": [ - { - "name": "costume1", - "bitmapResolution": 1, - "dataFormat": "svg", - "assetId": "bcf454acf82e4504149f7ffe07081dbc", - "md5ext": "bcf454acf82e4504149f7ffe07081dbc.svg", - "rotationCenterX": 48, - "rotationCenterY": 50 - }, - { - "name": "costume2", - "bitmapResolution": 1, - "dataFormat": "svg", - "assetId": "0fb9be3e8397c983338cb71dc84d0b25", - "md5ext": "0fb9be3e8397c983338cb71dc84d0b25.svg", - "rotationCenterX": 46, - "rotationCenterY": 53 - } - ], - "sounds": [ - { - "name": "Meow", - "assetId": "83c36d806dc92327b9e7049a565c6bff", - "dataFormat": "wav", - "format": "", - "rate": 48000, - "sampleCount": 40682, - "md5ext": "83c36d806dc92327b9e7049a565c6bff.wav" - } - ], - "volume": 100, - "layerOrder": 1, - "visible": true, - "x": 0, - "y": 0, - "size": 100, - "direction": 90, - "draggable": false, - "rotationStyle": "all around" - } - ], - "monitors": [], - "extensions": [], - "meta": { - "semver": "3.0.0", - "vm": "1.1.2", - "agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0" - } -} diff --git a/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java b/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java index f3e40f564..47db49035 100644 --- a/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java +++ b/src/test/java/de/uni_passau/fim/se2/litterbox/analytics/bugpattern/ForeverInsideLoopTest.java @@ -84,9 +84,4 @@ public void testForeverInsideLoopInIfElse() throws IOException, ParsingException Set refactoredIssues = finder.check(refactoredProgram); assertThat(refactoredIssues).isEmpty(); } - - @Test - public void testForeverInLoopBlockBeforeUntil() throws IOException, ParsingException { - assertThatFinderReports(1, new ForeverInsideLoop(), "./src/test/fixtures/bugpattern/foreverInsideLoopBlockBeforeUntil.json"); - } } From 6482a4eb893dfdf61396fa357592e04bafdd9351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Oberm=C3=BCller?= Date: Thu, 25 Aug 2022 15:23:08 +0200 Subject: [PATCH 8/9] adapt LED Off script missing hint --- src/main/resources/IssueHints_en.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/IssueHints_en.properties b/src/main/resources/IssueHints_en.properties index 271c19d31..d8b0ffa13 100644 --- a/src/main/resources/IssueHints_en.properties +++ b/src/main/resources/IssueHints_en.properties @@ -168,7 +168,7 @@ gear_potentiometer_in_bounds=Very nice! You are measuring the potentiometer valu gear_potentiometer_out_of_bounds=You are trying to measure the potentiometer value of the gear of the robot in a range that is not possible. Use a whole number between 0 and 100. interrupted_loop_sensing_robot=The [bc]%BLOCKNAME[/bc] block interrupts the checking of the condition in the [bc]%THENELSE[/bc] block while being executed. It can happen that the condition occurs but your script doesn't react accordingly because it is busy doing the [bc]%BLOCKNAME[/bc] block. Consider doing the condition checking in a separate (parallel) script. led_off_script=Great! You have a script for turning off all LEDs. -led_off_script_missing=LEDs can be switched on, but there is no script to switch them off again. +led_off_script_missing=The LEDs on your robot are turned on after the program has stopped. Add an LED Off block at the end of your program. line_following_in_bounds=Very nice! You are comparing the value of the line following sensor in the possible range. line_following_out_of_bounds=You are trying to measure a value that can not be detected with the line following sensor. Use a whole number between 0 und 3. loop_sensing_robot=Very good! To ensure that you don\uFFFDt miss an event you continuously check for it in a forever loop. From 7ed0e9b3e5b6b42c8694b7b4c79e9f84e21e24b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Oberm=C3=BCller?= Date: Thu, 25 Aug 2022 16:39:15 +0200 Subject: [PATCH 9/9] little change to hint --- src/main/resources/IssueHints_en.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/IssueHints_en.properties b/src/main/resources/IssueHints_en.properties index d8b0ffa13..f3b31b0bb 100644 --- a/src/main/resources/IssueHints_en.properties +++ b/src/main/resources/IssueHints_en.properties @@ -168,7 +168,7 @@ gear_potentiometer_in_bounds=Very nice! You are measuring the potentiometer valu gear_potentiometer_out_of_bounds=You are trying to measure the potentiometer value of the gear of the robot in a range that is not possible. Use a whole number between 0 and 100. interrupted_loop_sensing_robot=The [bc]%BLOCKNAME[/bc] block interrupts the checking of the condition in the [bc]%THENELSE[/bc] block while being executed. It can happen that the condition occurs but your script doesn't react accordingly because it is busy doing the [bc]%BLOCKNAME[/bc] block. Consider doing the condition checking in a separate (parallel) script. led_off_script=Great! You have a script for turning off all LEDs. -led_off_script_missing=The LEDs on your robot are turned on after the program has stopped. Add an LED Off block at the end of your program. +led_off_script_missing=The LEDs on your robot are still turned on after the program has stopped. Add an LED Off block at the end of your program. line_following_in_bounds=Very nice! You are comparing the value of the line following sensor in the possible range. line_following_out_of_bounds=You are trying to measure a value that can not be detected with the line following sensor. Use a whole number between 0 und 3. loop_sensing_robot=Very good! To ensure that you don\uFFFDt miss an event you continuously check for it in a forever loop.