slither icon indicating copy to clipboard operation
slither copied to clipboard

Inheritance printer adds unnecessary carriage return

Open montyly opened this issue 2 years ago • 3 comments

% cat test.sol

pragma solidity >= 0.8.19;

interface IFoo{}

contract Foo is IFoo {}

abstract contract Bar is Foo {}

interface IBaz{}

contract Baz is Bar, IBaz{}

% slither test.sol --print inheritance

+ Baz
 -> Bar, IBaz
, [Foo, IFoo]

It looks like we added unnecessary carriage return to the output at some point

montyly avatar Apr 12 '23 09:04 montyly

I'd like to contribute, can you please give me more information?

mehrdadmms avatar Apr 19 '23 14:04 mehrdadmms

Hi @mehrdadmms, awesome.

I think it's mostly about reviewing https://github.com/crytic/slither/blob/master/slither/printers/inheritance/inheritance.py, and removing some of the misplaced "\n"

montyly avatar May 05 '23 07:05 montyly

Hi @montyly

What should the correct output look like for slither test.sol --print inheritance

Should it look like this?

INFO:Printers:Inheritance
Child_Contract -> Immediate_Base_Contracts [Not_Immediate_Base_Contracts]

+ IFoo

+ Foo -> IFoo

+ Bar -> Foo, [IFoo]

+ IBaz

+ Baz -> Bar, IBaz, [Foo, IFoo]


Base_Contract -> Immediate_Child_Contracts [Not_Immediate_Child_Contracts]

+ IFoo -> Foo, [Bar, Baz]

+ Foo -> Bar, [Baz]

+ Bar -> Baz

+ IBaz -> Baz

+ Baz

dokzai avatar Oct 12 '23 20:10 dokzai