Skip to content

Commit 0e2c19b

Browse files
SONARJS-805 Add 3 more methods for Ember.js (#392)
1 parent 44e9cf2 commit 0e2c19b

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3759.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ <h2>Exceptions</h2>
1313
<li> <code>classify</code> </li>
1414
<li> <code>dasherize</code> </li>
1515
<li> <code>decamelize</code> </li>
16+
<li> <code>fmt</code> </li>
17+
<li> <code>loc</code> </li>
1618
<li> <code>underscore</code> </li>
19+
<li> <code>w</code> </li>
1720
</ul>
1821

javascript-checks/src/test/resources/checks/NonExistentPropertyAccess.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,8 @@ function ember_api() {
6464
"foo".classify();
6565
"foo".dasherize();
6666
"foo".decamelize();
67+
"foo".fmt();
68+
"foo".loc();
6769
"foo".underscore();
70+
"foo".w();
6871
}

javascript-frontend/src/main/java/org/sonar/javascript/se/builtins/StringBuiltInProperties.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ Map<String, SymbolicValue> getMethods() {
8585
.put("classify", method(Constraint.STRING_PRIMITIVE))
8686
.put("dasherize", method(Constraint.STRING_PRIMITIVE))
8787
.put("decamelize", method(Constraint.STRING_PRIMITIVE))
88+
.put("fmt", method(Constraint.STRING_PRIMITIVE))
89+
.put("loc", method(Constraint.STRING_PRIMITIVE))
8890
.put("underscore", method(Constraint.STRING_PRIMITIVE))
91+
.put("w", method(Constraint.ARRAY))
8992
.build();
9093
}
9194

javascript-frontend/src/test/java/org/sonar/javascript/se/builtins/BuiltInPropertiesTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public void test_string() throws Exception {
4747
public void test_ember_string_extension() throws Exception {
4848
type = Type.STRING_PRIMITIVE;
4949
assertMethod(value("camelize"), method(Constraint.STRING_PRIMITIVE));
50+
assertMethod(value("w"), method(Constraint.ARRAY));
5051
}
5152

5253
@Test

0 commit comments

Comments
 (0)