Is there any way of writing my own custom rules for the JOSM validator, or to change some of the existing rules?

Sometimes, the default rules flag as "warning" lots of "defects" that really aren't problems, because the underlying rule is not specific enough, or is too strict, and sometimes I want new rules so that I can check my own work more strictly.

For example, the default rules flag the ways used for house number interpolation that end near a street corner as "Way end near other way", and while this is strictly true, these ways do not have real physical representation, and are just a helpful construct to aid in address geolocation. Therefore, I do not want them flagged as such, requiring one extra rule in the validation to exclude them. See this question for more information. If I disable the "unconnected ways" option in the preferences page, or change the "validator.UnconnectedWays.node_way_distance" configuration value, the validator will miss the real unconnected ways...

Another example is for the recent change that flags as "warning" the missing voltage of power lines. See here. I do want to disable this rule (annoying!) in my local working copy, but if I disable the "power lines" option in the JOSM validator's preferences page, I would also disable all of the other errors/warnings related to power lines.

asked 18 Nov '13, 20:08

MCPicoli's gravatar image

MCPicoli
2.1k123046
accept rate: 24%


As far as I know there isn't an "easy syntax" to create/modify validator tests (like there is for presets for example). You'll have to patch this code to modify an existing test or add a new one. Your example improvement of ignoring certain ways for the unconnected_ways test shouldn't be hard to do.

Once you've improved a validator test, upstream will certainly be happy to review and merge your patch, so that all users can benefit. Create a josm bug report explaining why the change is needed and attaching your patch. Thanks in advance :)

permanent link

answered 19 Nov '13, 10:03

Vincent%20de%20Phily's gravatar image

Vincent de P... ♦
17.0k15147243
accept rate: 19%

If you aren't comfortable with software development workflows (downloading, compiling, comitting...) head over to #osm-dev or #josm to guide you. Have fun :)

(19 Nov '13, 10:07) Vincent de P... ♦

Seems easy enough. I'll give it a try next weekend, work hours allowing.

(19 Nov '13, 11:39) MCPicoli
3

WOW! Was just checking the code Vincent linked (hoping to understand it), and, to my surprise, there already was a patch (by Don-vip) for this case (for the bug report I opened yesterday)! Probably it'll be merged into the next "tested" version. Thanks anyway!

(19 Nov '13, 11:44) MCPicoli
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×507
×34
×20
×12

question asked: 18 Nov '13, 20:08

question was seen: 2,387 times

last updated: 19 Nov '13, 11:44

powered by OSQA