-
Notifications
You must be signed in to change notification settings - Fork 179
Description
Is your feature request related to a problem? Please describe.
I was looking for a software analysis package on a string given by function; then I found your great package. I realized that I can save the function into a .py file and run prospector on that directory, but it seems inefficient. I checked on the code and found out that getting reports for tools are delegated to a Manager object of that class that gets path to the file on system.
Describe the solution you'd like
I was looking for some API like the code below.
from prospector import Analysis
function_str = """def bubbleSort(arr):
n = len(arr)
swapped = False
for i in range(n-1):
for j in range(0, n-i-1):
if arr[j] > arr[j + 1]:
swapped = True
arr[j], arr[j + 1] = arr[j + 1], arr[j]
if not swapped:
return
"""
data = Analysis(function_str, output="json")
#{
# "summary": {
# "started": "2024-02-06 10:34:54.470164",
# "libraries": [],
# "strictness": "high",
# "profiles": "default, strictness_high, strictness_veryhigh, no_doc_warnings, no_test_warnings, no_member_warnings",
# "tools": [
# "bandit",
# "dodgy",
# "mccabe",
# "mypy",
# "profile-validator",
# "pycodestyle",
# "pyflakes",
# "pylint"
# ],
# "message_count": 7,Describe alternatives you've considered
I have tried saving Python file and running prospector and it. Not only it's not an optimal solution when you are dealing with thousands of code functions, but also there was an issue using subprocess.check_output returning nonzero code that I will open a separate issue thread for that when I am sure the issue if not from my side.
Additional context
I read the documentation once and skimed through the codebase. I believe there should be an easy solution for it. Even a simple hint would solve my problem.