Skip to content

Commit

Permalink
Add validation warning for "fixme" tags (close #6214)
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Apr 24, 2019
1 parent 05a6fd9 commit 42de00e
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
12 changes: 8 additions & 4 deletions css/80_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -3366,10 +3366,6 @@ button.autofix.action.active {
padding-left: 10px;
}

.entity-issues .issue-container.active .issue-label {
border-bottom: 1px solid;
border-color: inherit;
}
.entity-issues .issue-container.active .issue-label .issue-text {
font-weight: bold;
}
Expand All @@ -3387,6 +3383,14 @@ button.autofix.action.active {
}

/* fixes */
.entity-issues .issue-fix-list {
border-top: 1px solid;
border-color: inherit;
}
.entity-issues .issue-container.active .issue-fix-list:empty {
display: none;
}

li.issue-fix-item {
padding: 2px 10px 2px 20px;
}
Expand Down
5 changes: 5 additions & 0 deletions data/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,11 @@ en:
highway:
message: "{highway} is disconnected from other roads and paths"
reference: "Highways should connect to other highways or building entrances."
fixme_tag:
title: '"Fix Me" Requests'
message: '{feature} has a "Fix Me" request'
tip: 'Find features with "fixme" tags'
reference: 'A "fixme" tag indicates that a mapper has requested help with a feature.'
generic_name:
title: Suspicious Names
message: '{feature} has the suspicious name "{name}"'
Expand Down
6 changes: 6 additions & 0 deletions dist/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,12 @@
"reference": "Highways should connect to other highways or building entrances."
}
},
"fixme_tag": {
"title": "\"Fix Me\" Requests",
"message": "{feature} has a \"Fix Me\" request",
"tip": "Find features with \"fixme\" tags",
"reference": "A \"fixme\" tag indicates that a mapper has requested help with a feature."
},
"generic_name": {
"title": "Suspicious Names",
"message": "{feature} has the suspicious name \"{name}\"",
Expand Down
44 changes: 44 additions & 0 deletions modules/validations/fixme_tag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { t } from '../util/locale';
import { utilDisplayLabel } from '../util';
import { validationIssue } from '../core/validation';


export function validationFixmeTag() {
var type = 'fixme_tag';


var validation = function checkFixmeTag(entity, context) {

if (!entity.tags.fixme) return [];

// don't flag fixmes on features added by the user
if (entity.version === undefined) return [];

if (entity.v !== undefined) {
var baseEntity = context.history().base().hasEntity(entity.id);
// don't flag fixmes added by the user on existing features
if (!baseEntity || !baseEntity.tags.fixme) return [];
}

return [new validationIssue({
type: type,
severity: 'warning',
message: t('issues.fixme_tag.message', { feature: utilDisplayLabel(entity, context) }),
reference: showReference,
entities: [entity]
})];

function showReference(selection) {
selection.selectAll('.issue-reference')
.data([0])
.enter()
.append('div')
.attr('class', 'issue-reference')
.text(t('issues.fixme_tag.reference'));
}
};

validation.type = type;

return validation;
}
1 change: 1 addition & 0 deletions modules/validations/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { validationAlmostJunction } from './almost_junction';
export { validationCrossingWays } from './crossing_ways';
export { validationDisconnectedWay } from './disconnected_way';
export { validationFixmeTag } from './fixme_tag';
export { validationGenericName } from './generic_name';
export { validationIncompatibleSource } from './incompatible_source';
export { validationMaprules } from './maprules';
Expand Down

0 comments on commit 42de00e

Please sign in to comment.