SoftwareUnderstanding / inspect4py

Static code analysis package for Python repositories
https://inspect4py.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
28 stars 10 forks source link

Repository with scripts and services detected with both "main" in has structure - face_classification #239

Closed rosafilgueira closed 3 years ago

rosafilgueira commented 3 years ago

The repository face classification has a collection of scripts and a web service, but looking into the repo. The code_inspector extract all this information. See bellow:

Screen Shot 2021-08-06 at 11 18 18

For our future heuristic, in which we will implement the type classification taking into "has_strucure" (for script and services), this will be an interesting case - if we have services and scripts, both with main ..... something to think about.

rosafilgueira commented 3 years ago

Although I like very much the idea of checking if the service is mentioned in the readme. The current implementation it is not working as it should. For example, continuing with the "face classification" example, now we have:

Screen Shot 2021-08-12 at 13 56 46

However, I couldnt find a mention of the ../src/web/faces.py in the README.

In the case of services, the current implementation to check if a service is mentioned in the readme is the following one:

mentioned_in_readme": elem["file"]["fileNameBase"] in readme

And if we print the value of elem["file"]["fileNameBase"] , for this particular case, we get the following:

soft_info {'type': 'service', 'run': 'python /Users/rosafilgueira/HW-Work/Research/CodeSearch/test_repos/face_classification/src/web/faces.py', 'has_structure': 'main', 'mentioned_in_readme': True} - elem["file"]["fileNameBase"]: faces 

And in this case, elem["file"]["fileNameBase"] has the value 'faces'. And 'faces' is found in the readme file. But that does not mean that the ../src/web/faces.py has been mentioned in the readme,

rosafilgueira commented 3 years ago

I have updated the code, so it also checks the mention of the file, not only taking into account the fileNameBase, as well, as the extension (e.g. faces.py).

mentioned_in_readme": elem["file"]["fileNameBase"]+"."+elem["file"]["extension"]  in readme
Screen Shot 2021-08-12 at 14 33 15

Note that for the scripts with main, it already the implementation had into account the complete name of the file (fileNameBase + Extension) - so I havent modified the code there.

But I did had to modify the code also for "script without main ... with body"

dgarijo commented 3 years ago

@rosafilgueira, sorry, but I do not understand if the issue is addressed or not.

dgarijo commented 3 years ago

This issue has been addressed.