Merge ~vultaire/juju-lint:space-mismatch-ordering into juju-lint:master

Proposed by Paul Goins
Status: Merged
Approved by: Alvaro Uria
Approved revision: cd8a9dca1293ae8b1100c460c9e019b228e9a201
Merged at revision: bd5c1aab5603089c7454b5c52771473a64aa1bef
Proposed branch: ~vultaire/juju-lint:space-mismatch-ordering
Merge into: juju-lint:master
Prerequisite: ~vultaire/juju-lint:check-spaces-error-handling
Diff against target: 15 lines (+4/-0)
1 file modified
jujulint/check_spaces.py (+4/-0)
Reviewer Review Type Date Requested Status
Alvaro Uria (community) Approve
Review via email: mp+423304@code.launchpad.net

Commit message

Lexicographically sort endpoints in space mismatches

Description of the change

When comparing juju-lint output across clouds, it helps if space mismatches are represented consistently. By sorting the related applications by name, we can provide more consistent output and reduce noise in diffs between juju-lint output from different clouds.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Alvaro Uria (aluria) wrote :

+1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision bd5c1aab5603089c7454b5c52771473a64aa1bef

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/jujulint/check_spaces.py b/jujulint/check_spaces.py
2index e9c850b..47c0c63 100644
3--- a/jujulint/check_spaces.py
4+++ b/jujulint/check_spaces.py
5@@ -33,6 +33,10 @@ class SpaceMismatch:
6
7 def __init__(self, endpoint1, space1, endpoint2, space2):
8 """Create the object."""
9+ if endpoint2 < endpoint1:
10+ # Let's keep things lexicographically ordered
11+ endpoint1, endpoint2 = endpoint2, endpoint1
12+ space1, space2 = space2, space1
13 self.endpoint1 = endpoint1
14 self.endpoint2 = endpoint2
15 self.space1 = space1

Subscribers

People subscribed via source and target branches