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

WIP: Implement new Fan-In/Out/General #401

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

w31t1
Copy link

@w31t1 w31t1 commented Nov 19, 2024

This PR replace the old Fan-In/Out/General-Out metric by a new approach used in my projects.

The current code is partially not working (see #250, #358) still Work in Progress as I discovered in #102. I already state that the current calculation depends on the ordering of the input files.

The new calculation is as described in lizard_ext/lizardio.py:

        Runs the Lizard Extension for calculation of fan-in and fan-out
        metric in the source code.

        Currently supported languages:
            - CLike:
                - Fan-In:          The count of functions this function is called.
                - Fan-Out:         The count of function called in this function.
                - General Fan-Out: The count of functions called in this function.
            - Python
                - Fan-In:          The count of functions this function is called.
                - Fan-Out:         The count of functions called in this function.
                - General Fan-Out: The count of different functions called in this function.

        Metric definition:
            Fan-In:          The grade of units/entities dependent on this code part inside the unit.
            Fan-Out:         The grade of units/entities this code part depends on.
            General Fan-Out: A more general grade of units/entities this code part depends on.

        Limitation:
            - Metric definition depends on language: Functional languages this metric is different
              calculated than object-oriented languages (because of language design).
            - Metric calculation depends on reader extension: Only CodeReader with implemented
              function `external_dependencies` are used to calculate the fan-out metric.
            - Exact metric calculation depends on not-existent knowledge: Programming languages can
              own a lot of features which are not known at calculation time, e.g.:
                - defines/templates (C/C++)
                - compiler/interpreter introduced hidden function calls (SPARC, x86, PowerPC)
                - different language versions (python {2.7/3.11/...}, **C{99/11/..}**

The following tasks are not fulfilled:

  1. Fix unit tests, add additional validation tests

This PR is a RFC (Request for Comments). The development is still ongoing, tests will be added for C and Python.

@terryyin : Are you interested in this change?
@mehrdad89 : Do you still want to implement your approach?

It is also a question, if it is better to create a new extension file than canibalize this one.

Christoph Weiss added 4 commits October 10, 2024 14:56
@w31t1 w31t1 force-pushed the implement-new-fanout branch from e60bd0f to 7f31b54 Compare November 19, 2024 13:23
@terryyin
Copy link
Owner

If you like it you should have put some tests on it.

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.

2 participants