Changeset 8694 in osm for applications/editors/josm
- Timestamp:
- 2008-07-03T18:04:39+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SpellCheck.java
r6387 r8694 215 215 checkPrimitive(w); 216 216 } 217 217 218 218 /** 219 219 * Checks the spelling of the primitive properties … … 223 223 { 224 224 // Just a collection to know if a primitive has been already marked with error 225 226 227 225 Bag<OsmPrimitive, String> withErrors = new Bag<OsmPrimitive, String>(); 226 227 Map<String, String> props = (p.keys == null) ? Collections.<String, String>emptyMap() : p.keys; 228 228 for(Entry<String, String> prop: props.entrySet() ) 229 229 { … … 237 237 if( checkKeys && spellCheckKeyData.containsKey(key) && !withErrors.contains(p, "IPK")) 238 238 { 239 errors.add( new TestError(this, Severity.WARNING, tr("Invalid property key s"), p, INVALID_KEY) );239 errors.add( new TestError(this, Severity.WARNING, tr("Invalid property key ''{0}''", key), p, INVALID_KEY) ); 240 240 withErrors.add(p, "IPK"); 241 241 } 242 if( checkValues && value != null && value.length() > 0 && spellCheckValueData != null) 243 { 244 List<String> values = spellCheckValueData.get(key); 245 if( values != null && !values.contains(prop.getValue()) && !withErrors.contains(p, "UPV")) 246 { 247 errors.add( new TestError(this, Severity.OTHER, tr("Unknown property values"), p, INVALID_VALUE) ); 248 withErrors.add(p, "UPV"); 249 } 250 } 251 if( checkFixmes && value != null && value.length() > 0 ) 252 { 253 if( (value.contains("FIXME") || key.contains("todo") || key.contains("fixme")) 254 && !withErrors.contains(p, "FIXME")) 255 { 256 errors.add( new TestError(this, Severity.OTHER, tr("FIXMES"), p, FIXME) ); 257 withErrors.add(p, "FIXME"); 258 } 259 } 260 } 261 } 262 242 if( checkKeys && key.indexOf(" ") >= 0 && !withErrors.contains(p, "IPK")) 243 { 244 errors.add( new TestError(this, Severity.WARNING, tr("Invalid white space in property key ''{0}''", key), p, INVALID_KEY) ); 245 withErrors.add(p, "IPK"); 246 } 247 if( checkValues && value != null && (value.startsWith(" ") || value.endsWith(" ")) && !withErrors.contains(p, "SPACE")) 248 { 249 errors.add( new TestError(this, Severity.OTHER, tr("Property values start or end with white space"), p, INVALID_VALUE) ); 250 withErrors.add(p, "SPACE"); 251 } 252 if( checkValues && value != null && value.length() > 0 && spellCheckValueData != null) 253 { 254 List<String> values = spellCheckValueData.get(key); 255 if( values != null && !values.contains(prop.getValue()) && !withErrors.contains(p, "UPV")) 256 { 257 errors.add( new TestError(this, Severity.OTHER, tr("Unknown property values"), p, INVALID_VALUE) ); 258 withErrors.add(p, "UPV"); 259 } 260 } 261 if( checkFixmes && value != null && value.length() > 0 ) 262 { 263 if( (value.contains("FIXME") || value.contains("check and delete") || key.contains("todo") || key.contains("fixme")) 264 && !withErrors.contains(p, "FIXME")) 265 { 266 errors.add( new TestError(this, Severity.OTHER, tr("FIXMES"), p, FIXME) ); 267 withErrors.add(p, "FIXME"); 268 } 269 } 270 } 271 } 272 263 273 /** 264 274 * Parse an anotation preset from a stream
Note:
See TracChangeset
for help on using the changeset viewer.