Midnighter / structurizr-python

A Python 3 port of Simon Brown's Structurizr diagrams-as-code architecture description tool.
https://structurizr.com/
Apache License 2.0
65 stars 16 forks source link

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

Closed yt-ms closed 3 years ago

yt-ms commented 3 years ago

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 commented 3 years ago

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%) :arrow_up:
src/structurizr/view/view.py 73.46% <100.00%> (+5.76%) :arrow_up:

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.