-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Remove comment-only and whitespace-only changes #11747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,18 +8,19 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| utilRebind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '../../util'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { uiLengthIndicator } from '..'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { svgIcon } from '../../svg/icon'; // ← ADDED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function uiFieldTextarea(field, context) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var dispatch = d3_dispatch('change'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var input = d3_select(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var wrap = d3_select(null); // ← ADDED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .silent(field.usage === 'changeset' && field.key === 'comment'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var _tags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function textarea(selection) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var wrap = selection.selectAll('.form-field-input-wrap') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wrap = selection.selectAll('.form-field-input-wrap') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .data([0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wrap = wrap.enter() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -36,15 +37,24 @@ export function uiFieldTextarea(field, context) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .attr('dir', 'auto') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .attr('id', field.domId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .call(utilNoAuto) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .on('input', change(true)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .on('blur', change()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .on('change', change()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .on('input', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| change(true)(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updatePatternValidation(); // ← ADDED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .on('blur', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| change()(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updatePatternValidation(); // ← ADDED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .on('change', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| change()(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updatePatternValidation(); // ← ADDED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .merge(input); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wrap.call(_lengthIndicator); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function change(onInput) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var val = utilGetSetValue(input); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!onInput) val = context.cleanTagValue(val); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -58,9 +68,47 @@ export function uiFieldTextarea(field, context) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function updatePatternValidation() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!field.pattern || !wrap || wrap.empty()) return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const value = utilGetSetValue(input).trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wrap.selectAll('.form-field-pattern-info').remove(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let isInvalid = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const regex = new RegExp(field.pattern); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isInvalid = !regex.test(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch { | |
| } catch (err) { | |
| // Log invalid regex patterns for debugging while preserving existing behavior | |
| /* eslint-disable no-console */ | |
| console.error('uiFieldTextarea: invalid regex pattern for field.pattern', field.pattern, err); | |
| /* eslint-enable no-console */ |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new function uses modern JavaScript variable declarations (const/let) while the rest of the file consistently uses var. For consistency with the existing codebase style, consider using var instead of const/let throughout this function, or update the entire file to use modern declarations in a separate refactoring PR.
| const value = utilGetSetValue(input).trim(); | |
| if (!value) { | |
| wrap.selectAll('.form-field-pattern-info').remove(); | |
| return; | |
| } | |
| let isInvalid = false; | |
| try { | |
| const regex = new RegExp(field.pattern); | |
| isInvalid = !regex.test(value); | |
| } catch { | |
| return; | |
| } | |
| const info = wrap.selectAll('.form-field-pattern-info') | |
| .data(isInvalid ? [0] : []); | |
| const enter = info.enter() | |
| var value = utilGetSetValue(input).trim(); | |
| if (!value) { | |
| wrap.selectAll('.form-field-pattern-info').remove(); | |
| return; | |
| } | |
| var isInvalid = false; | |
| try { | |
| var regex = new RegExp(field.pattern); | |
| isInvalid = !regex.test(value); | |
| } catch { | |
| return; | |
| } | |
| var info = wrap.selectAll('.form-field-pattern-info') | |
| .data(isInvalid ? [0] : []); | |
| var enter = info.enter() |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states "No functional or behavioral changes are intended", but this change introduces new pattern validation functionality for textarea fields. This is a significant feature addition that:
- Should be explicitly documented in the PR description
- Requires test coverage
- Should be reviewed as a feature addition, not as a refactoring
Consider splitting this into a separate PR with appropriate tests and documentation explaining when and how pattern validation works.
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment line appears to be a separator or section marker but doesn't provide meaningful information. Consider removing it or replacing it with a more descriptive comment explaining what follows (e.g., "// Public API methods").
| // ============================ | |
| // Public API methods |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line contains trailing whitespace. Remove the trailing spaces for code cleanliness.
| updatePatternValidation(); | |
| updatePatternValidation(); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -794,7 +794,7 @@ export function validationCrossingWays(context) { | |||||||||||||||
| return fix; | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| function makeChangeLayerFix(higherOrLower) { | ||||||||||||||||
| function makeChangeLayerFix(higherOrLower) { | ||||||||||||||||
| return new validationIssueFix({ | ||||||||||||||||
| icon: 'iD-icon-' + (higherOrLower === 'higher' ? 'up' : 'down'), | ||||||||||||||||
| title: t.append('issues.fix.tag_this_as_' + higherOrLower + '.title'), | ||||||||||||||||
|
|
@@ -807,29 +807,39 @@ export function validationCrossingWays(context) { | |||||||||||||||
| if (selectedIDs.length !== 1) return; | ||||||||||||||||
|
|
||||||||||||||||
| var selectedID = selectedIDs[0]; | ||||||||||||||||
| if (!this.issue.entityIds.some(function(entityId) { | ||||||||||||||||
| return entityId === selectedID; | ||||||||||||||||
| })) return; | ||||||||||||||||
| if (!this.issue.entityIds.includes(selectedID)) return; | ||||||||||||||||
|
|
||||||||||||||||
| var entity = context.hasEntity(selectedID); | ||||||||||||||||
| if (!entity) return; | ||||||||||||||||
|
|
||||||||||||||||
| var tags = Object.assign({}, entity.tags); // shallow copy | ||||||||||||||||
| var layer = tags.layer && Number(tags.layer); | ||||||||||||||||
| if (layer && !isNaN(layer)) { | ||||||||||||||||
| if (higherOrLower === 'higher') { | ||||||||||||||||
| layer += 1; | ||||||||||||||||
| } else { | ||||||||||||||||
| layer -= 1; | ||||||||||||||||
| } | ||||||||||||||||
| // Clone tags (never mutate original) | ||||||||||||||||
| var tags = Object.assign({}, entity.tags); | ||||||||||||||||
|
|
||||||||||||||||
| // Determine feature type | ||||||||||||||||
| var featureType = getFeatureType(entity, context.graph()); | ||||||||||||||||
|
|
||||||||||||||||
| // Compute new layer value | ||||||||||||||||
| var layer = Number(tags.layer); | ||||||||||||||||
| if (!isNaN(layer)) { | ||||||||||||||||
| layer += (higherOrLower === 'higher' ? 1 : -1); | ||||||||||||||||
|
Comment on lines
+822
to
+824
|
||||||||||||||||
| var layer = Number(tags.layer); | |
| if (!isNaN(layer)) { | |
| layer += (higherOrLower === 'higher' ? 1 : -1); | |
| var rawLayer = tags.layer; | |
| var layer; | |
| if (rawLayer && !isNaN(Number(rawLayer))) { | |
| layer = Number(rawLayer) + (higherOrLower === 'higher' ? 1 : -1); |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states "No functional or behavioral changes are intended", but this change introduces significant new functionality. The code now automatically adds or removes bridge/tunnel tags based on the layer direction and feature type, which is a behavioral change that should be:
- Explicitly documented in the PR description
- Covered by tests
- Reviewed as a feature addition, not as a refactoring
Consider splitting this into a separate PR with appropriate tests and documentation.
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new logic that automatically adds bridge='yes' or tunnel='yes' tags when changing layers lacks test coverage. Given that test/spec/validations/crossing_ways.js exists and tests layer-related behavior, this new functionality should be tested to ensure:
- Bridge tags are correctly added when moving to higher layers
- Tunnel tags are correctly added when moving to lower layers
- Tags are correctly removed for unsupported feature types
- Bridge and tunnel tags are mutually exclusive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line contains trailing whitespace. Remove the trailing spaces for code cleanliness.