Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Issue 63: StaticView.add_nearest_neighbours() should not duplicate relationships #64

Merged
merged 11 commits into from
Feb 3, 2021

Conversation

yt-ms
Copy link
Collaborator

@yt-ms yt-ms commented Dec 25, 2020

add_nearest_neighbours() was calling _add_element() with add_relationships=True which was resulting in the duplication. As the relationships are added explicitly based on the type filter, then simply setting this to False solves the problem. Also added a check to View to protect against other cases where someone may be unknowingly adding the same relationship twice.

Got caught out by flake8 yet again, so added this to make qa and updated the examples to be compliant.

Also fixed issue 40 whilst in the area, so diagrams with blank descriptions in the Structurizr UI can now be loaded through the Python API. Not discovered any other similar incompatibilities yet.


THIS SOFTWARE IS CONTRIBUTED SUBJECT TO THE TERMS OF THE Apache License v.2.0. YOU MAY OBTAIN A COPY OF THE LICENSE AT https://www.apache.org/licenses/LICENSE-2.0.

THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED LICENSE TERMS.

@codecov-io
Copy link

codecov-io commented Dec 25, 2020

Codecov Report

Merging #64 (b5d7f05) into devel (61888cb) will increase coverage by 0.57%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            devel      #64      +/-   ##
==========================================
+ Coverage   90.60%   91.18%   +0.57%     
==========================================
  Files          69       69              
  Lines        2108     2109       +1     
  Branches      208      210       +2     
==========================================
+ Hits         1910     1923      +13     
+ Misses        177      167      -10     
+ Partials       21       19       -2     
Impacted Files Coverage Δ
src/structurizr/view/static_view.py 100.00% <100.00%> (+20.58%) ⬆️
src/structurizr/view/view.py 73.46% <100.00%> (+5.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61888cb...b5d7f05. Read the comment docs.

@yt-ms yt-ms marked this pull request as ready for review December 25, 2020 17:52
Copy link
Owner

@Midnighter Midnighter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some style changes. Otherwise this is a great addition.

Makefile Outdated
@@ -8,6 +8,7 @@
qa:
isort src/structurizr/ tests/ examples/ setup.py
black src/structurizr/ tests/ examples/ setup.py
flake8 src/structurizr/ tests/ examples/ setup.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this line before merging. make qa is intended for applying style fixes and not for checking for problems. You can either use tox -e flake8 for that or create a separate command make qc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, sure.

examples/big_bank.py Outdated Show resolved Hide resolved
examples/big_bank.py Outdated Show resolved Hide resolved
examples/big_bank.py Outdated Show resolved Hide resolved
examples/big_bank.py Outdated Show resolved Hide resolved
examples/big_bank.py Outdated Show resolved Hide resolved
examples/big_bank.py Outdated Show resolved Hide resolved
yt-ms and others added 4 commits February 3, 2021 13:07
Co-authored-by: Moritz E. Beber <midnighter@posteo.net>
Co-authored-by: Moritz E. Beber <midnighter@posteo.net>
Co-authored-by: Moritz E. Beber <midnighter@posteo.net>
Copy link
Owner

@Midnighter Midnighter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@Midnighter Midnighter merged commit da9dafd into Midnighter:devel Feb 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants