aibolit icon indicating copy to clipboard operation
aibolit copied to clipboard

external_methods_called.py:27-31: Implement external...

Open 0pdd opened this issue 4 years ago • 13 comments

The puzzle 183-9b03d7d9 from #183 has to be resolved:

https://github.com/yegor256/aibolit/blob/76b6e4ebc5fa3260b3c44acd53e640d098107f64/aibolit/metrics/external_methods_called/external_methods_called.py#L27-L31

The puzzle was created by paulodamaso on 25-Apr-20.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

0pdd avatar May 13 '20 06:05 0pdd

@acheshkov/z please, pay attention to this issue

0crat avatar May 13 '20 06:05 0crat

@0crat in

acheshkov avatar May 13 '20 09:05 acheshkov

The job #286 assigned to @paulodamaso/z, here is why; the budget is 30 minutes, see §4; please, read §8 and §9; if the task is not clear, read this and this; there will be a monetary reward for this job

0crat avatar May 14 '20 14:05 0crat

@paulodamaso/z this job was assigned to you 5days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please.

0crat avatar May 19 '20 15:05 0crat

@0crat wait I wasn't notified

paulodamaso avatar May 28 '20 04:05 paulodamaso

@acheshkov Looks like this can't be achieved with current c2nes/javalang library. I couldn't discover from which class some MethodInvocation belongs. That's what MethodInvocation gets me:

MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)

I've filed an issue at javalang repo: https://github.com/c2nes/javalang/issues/79

paulodamaso avatar May 31 '20 19:05 paulodamaso

@acheshkov Any advice on this one?

paulodamaso avatar Jun 12 '20 16:06 paulodamaso

@acheshkov ping

paulodamaso avatar Jul 10 '20 14:07 paulodamaso

@paulodamaso, to figure it out you have to work with AST directly.

@aravij could you get piece of advice, ho to implement that using a new AST API?

acheshkov avatar Jul 10 '20 17:07 acheshkov

There is an unrecoverable failure on my side. Please, submit it here:

PID: 4@349556e6-fa72-4cfa-be64-c068e2ccb4e1, thread: pool-49-thread-1
com.zerocracy.radars.github.GhProject[69] com.zerocracy.radars.github.GhProjectNotFoundException: Github project for 'cqfn/aibolit' repo was not found

0.54.5: Issue: cqfn/aibolit#286, Comment: 627867797

0crat avatar Jul 13 '20 07:07 0crat

There is an unrecoverable failure on my side. Please, submit it here:

PID: 4@349556e6-fa72-4cfa-be64-c068e2ccb4e1, thread: pool-44-thread-1
com.zerocracy.radars.github.GhProject[69] com.zerocracy.radars.github.GhProjectNotFoundException: Github project for 'cqfn/aibolit' repo was not found

0.54.5: Issue: cqfn/aibolit#286, Comment: 635085794

0crat avatar Jul 13 '20 07:07 0crat

There is an unrecoverable failure on my side. Please, submit it here:

PID: 4@349556e6-fa72-4cfa-be64-c068e2ccb4e1, thread: pool-64-thread-1
org.hamcrest.MatcherAssert[20] java.lang.AssertionError: HTTP response status is not equal to 205:
202 Accepted [https://api.github.com/notifications]
Server: GitHub.com
Date: Mon, 13 Jul 2020 07:26:19 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 132
Status: 202 Accepted
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4445
X-RateLimit-Reset: 1594626188
X-GitHub-Media-Type: github.v3
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
Vary: Accept-Encoding, Accept, X-Requested-With
X-GitHub-Request-Id: A334:1D74:15771:332D2:5F0C0C9B

{"message":"Unread notifications couldn't be marked in a single request. Notifications are being marked as read in the background."}
Expected: HTTP response with status 205
     but: was <202 Accepted [https://api.github.com/notifications]
Server: GitHub.com
Date: Mon, 13 Jul 2020 07:26:19 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 132
Status: 202 Accepted
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4445
X-RateLimit-Reset: 1594626188
X-GitHub-Media-Type: github.v3
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
Vary: Accept-Encoding, Accept, X-Requested-With
X-GitHub-Request-Id: A334:1D74:15771:332D2:5F0C0C9B

{"message":"Unread notifications couldn't be marked in a single request. Notifications are being marked as read in the background."}>

0.54.5: Issue: cqfn/aibolit#286, Action: created

0crat avatar Jul 13 '20 07:07 0crat

@acheshkov Looks like this can't be achieved with current c2nes/javalang library. I couldn't discover from which class some MethodInvocation belongs. That's what MethodInvocation gets me:

MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)

I've filed an issue at javalang repo: c2nes/javalang#79

@paulodamaso According to your issue in javalang repo, I think our previous implemented metric "FanOut" can help you.

 for invoked_method_child in tree.children_with_type(i, ASTNodeType.METHOD_INVOCATION):
                name_of_invoked_class = tree.get_method_invocation_params(invoked_method_child)

Also, my advice is not to use javalang anymore. We currently use new interface AST

Vitaly-Protasov avatar Jul 13 '20 10:07 Vitaly-Protasov