Skip to content

Commit 8278237

Browse files
authored
Merge pull request #222 from EGAlberts/plugin_param
Give an exception to to capital letter in param names for plugin params
2 parents 4edb86b + b19e149 commit 8278237

File tree

1 file changed

+14
-13
lines changed
  • plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/validation

1 file changed

+14
-13
lines changed

plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/validation/RosValidator.xtend

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import ros.ServiceClient
1414
import ros.ServiceServer
1515
import ros.Subscriber
1616
import ros.Parameter
17-
import ros.ParameterValue
18-
import ros.ParameterBase64Type
19-
import ros.ParameterDate
2017

2118
/**
2219
* This class contains custom validation rules.
@@ -45,19 +42,23 @@ class RosValidator extends AbstractRosValidator {
4542
}}
4643
@Check
4744
def void checkNameConventionsPackage (Package rospackage) {
48-
for (char c : rospackage.name.toCharArray){
49-
if (Character.isUpperCase(c)){
50-
error("The name of a package has to follow the ROS naming conventions: Capital letters are not allowed", null, INVALID_NAME);
51-
}
52-
}
45+
for (char c : rospackage.name.toCharArray){
46+
if (Character.isUpperCase(c)){
47+
error("The name of a package has to follow the ROS naming conventions: Capital letters are not allowed", null, INVALID_NAME);
48+
}
49+
}
5350
}
5451
@Check
5552
def void checkNameConventionsParameters (Parameter parameter) {
56-
for (char c : parameter.name.toCharArray){
57-
if (Character.isUpperCase(c)){
58-
warning("The name of a parameter has to follow the ROS naming conventions: Capital letters are not recommended", null, INVALID_NAME);
59-
}
60-
}
53+
for (i : 0 ..< parameter.name.length) {
54+
val c = parameter.name.charAt(i)
55+
if (Character.isUpperCase(c)) {
56+
val remaining = parameter.name.substring(i)
57+
if (!remaining.contains(".")) {
58+
warning("The name of a parameter has to follow the ROS naming conventions: Capital letters are not recommended", null, INVALID_NAME);
59+
}
60+
}
61+
}
6162
}
6263

6364
/* Customize Syntax Error Messages */

0 commit comments

Comments
 (0)