laike9m / Cyberbrain

Python debugging, redefined.
http://bit.ly/cyberbrain-features
MIT License
2.51k stars 159 forks source link

Add function line number #118

Closed victorjzsun closed 3 years ago

victorjzsun commented 3 years ago

Addresses one element of #17

Sends the line number where the traced function is defined as a part of the metadata sent to the rpc server. The extension displays the traced functions's name on one line, and then the filename and line number on the line below it, all in the header.

image

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.31%.

Quality metrics Before After Change
Complexity 4.16 ⭐ 4.14 ⭐ -0.02 👍
Method Length 55.85 ⭐ 56.31 ⭐ 0.46 👎
Working memory 8.93 🙂 9.05 🙂 0.12 👎
Quality 71.49% 🙂 71.18% 🙂 -0.31% 👎
Other metrics Before After Change
Lines 534 539 5
Changed files Quality Before Quality After Quality Change
cyberbrain/frame.py 68.21% 🙂 67.70% 🙂 -0.51% 👎
cyberbrain/tracer.py 74.21% 🙂 74.09% 🙂 -0.12% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
cyberbrain/frame.py Frame.log_events 12 🙂 255 ⛔ 16 ⛔ 34.53% 😞 Try splitting into smaller methods. Extract out complex expressions
cyberbrain/frame.py Frame.log_initial_value_events 4 ⭐ 86 🙂 16 ⛔ 58.00% 🙂 Extract out complex expressions
cyberbrain/tracer.py Tracer._initialize_frame_and_logger 2 ⭐ 106 🙂 15 😞 58.32% 🙂 Extract out complex expressions
cyberbrain/frame.py Frame.log_return_event 1 ⭐ 71 🙂 16 ⛔ 63.21% 🙂 Extract out complex expressions
cyberbrain/tracer.py Tracer.global_tracer 2 ⭐ 38 ⭐ 12 😞 72.80% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

laike9m commented 3 years ago

Thanks again for the PR!