Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: martin complexity printer #1889

Merged
merged 30 commits into from
Sep 15, 2023
Merged

feat: martin complexity printer #1889

merged 30 commits into from
Sep 15, 2023

Conversation

devtooligan
Copy link
Contributor

This pr adds a printer that computes metrics developed by Robert Martin.

INFO:Printers:Martin agile software metrics
Efferent Coupling (Ce) - Number of contracts that a contract depends on
Afferent Coupling (Ca) - Number of contracts that depend on the contract
Instability (I) - Ratio of efferent coupling to total coupling (Ce / (Ce + Ca))
Abstractness (A) - Number of abstract contracts / total number of contracts
Distance from the Main Sequence (D) - abs(A + I - 1)

Abstractness (overall): 0.19
+-------------------------------+------------+--------------+-------------+-----------------------------+
|            Contract           | Dependents | Dependencies | Instability | Distance from main sequence |
+-------------------------------+------------+--------------+-------------+-----------------------------+
|         NoDelegateCall        |     4      |      0       |     0.00    |             0.19            |
|        UniswapV3Factory       |     0      |      4       |     1.00    |             0.81            |
|         UniswapV3Pool         |     1      |      8       |     0.89    |             0.70            |
|     UniswapV3PoolDeployer     |     1      |      1       |     0.50    |             0.31            |
|         IERC20Minimal         |     1      |      0       |     0.00    |             0.19            |

+-------------------------------+------------+--------------+-------------+-----------------------------+
INFO:Slither:/Users/devtooligan/dev/other/v3-core analyzed (62 contracts)

The logic to determine this will also be used in several other complexity measurement printers as well as a future complexity dashboard printer.

@devtooligan devtooligan marked this pull request as draft May 5, 2023 04:59
@devtooligan devtooligan changed the title feat: martin printer feat: martin complexity printer May 5, 2023
@devtooligan devtooligan force-pushed the martin-printer branch 2 times, most recently from 2f14dbb to 6ad0873 Compare May 6, 2023 00:42
@devtooligan devtooligan marked this pull request as ready for review June 15, 2023 22:35
@devtooligan devtooligan force-pushed the martin-printer branch 4 times, most recently from e5c56a5 to 8d483ed Compare July 7, 2023 20:32
@montyly montyly merged commit 8a34cd4 into dev Sep 15, 2023
@montyly montyly deleted the martin-printer branch September 15, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants