Consensys / vscode-solidity-auditor

Solidity language support and visual security auditor for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor
GNU General Public License v3.0
578 stars 60 forks source link

Wrong arrow direction for inheritance property in plantuml script generation #34

Closed silkPK closed 4 years ago

silkPK commented 4 years ago

Describe the bug Uml function generate a wrong uml class diagram. For example, following Solidity contract:

pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./Stoppable.sol";

contract StoppableElement is Stoppable {
    using SafeMath for uint256;
    constructor () Stoppable(false) public {
    }
}

where StoppableElement derive from Stoppable class, generate following plantuml script and diagram:

@startuml
' -- for auto-render install: https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml
' -- options --

' -- classes --

class StoppableElement {
    ' -- inheritance --
    {abstract}Stoppable

    ' -- usingFor --
    {abstract}📚SafeMath for [[uint256]]

    ' -- vars --

    ' -- methods --
    +**__constructor__**()

}
' -- inheritance / usingFor --
StoppableElement <|--[#DarkGoldenRod] Stoppable
StoppableElement <|..[#DarkOliveGreen] SafeMath : //for uint256//

@enduml

where inheritance arrow is in wrong direction.

Expected behavior Inheritance tags should be:

' -- inheritance / usingFor --
Stoppable <|--[#DarkGoldenRod] StoppableElement
SafeMath <|..[#DarkOliveGreen] StoppableElement : //for uint256//

Screenshots StoppableElement should be: StoppableElement

tintinweb commented 4 years ago

Good catch, thanks @DeepitPK!

I've opted to change the arrow direction and avoid that plantuml re-arranges the graph. should be merged and released with #37 soon.