Skip to content

Commit 4a859c4

Browse files
committed
reports: Add Vaibhav's GSoC report
1 parent d675f56 commit 4a859c4

File tree

1 file changed

+195
-0
lines changed

1 file changed

+195
-0
lines changed

_reports/RaiVaibhav.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
---
2+
categories:
3+
- GSoC
4+
- 2018
5+
- StatusReport
6+
report_year: 2018
7+
date: 2018-08-12
8+
student: Vaibhav Kumar Rai
9+
organisation: coala
10+
organisation_link: https://coala.io
11+
project: Debug and Profile Bears
12+
project_link: https://summerofcode.withgoogle.com/projects/#6109762077327360
13+
tarball: https://rawgit.com/RaiVaibhav/GSoC-Report/master/project.tar.gz
14+
sha256sum: d61862f8f8be5ec168b07741c09781ef2dcc991e44d87edc05e6d237044052b0
15+
mentors: >
16+
[Mischa Krüger](https://github.com/Makman2),
17+
[Fabian Neuschmidt](https://github.com/fneu),
18+
[Arjun Singh Yadav](https://github.com/arjunsinghy96)
19+
phase:
20+
- Bonding: https://gitlab.com/coala/GSoC/GSoC-2018/milestones/18
21+
- Phase 1: https://gitlab.com/coala/GSoC/GSoC-2018/milestones/52
22+
- Phase 2: https://gitlab.com/coala/GSoC/GSoC-2018/milestones/53
23+
- Phase 3: https://gitlab.com/coala/GSoC/GSoC-2018/milestones/54
24+
bio: >
25+
I am third year student of B.Tech Computer Science Engineering at Shri Mata
26+
Vaishno Devi University, Katra, Jammu and Kashmir. I participated in GSoC and
27+
worked with [coala](https://coala.io) to create better quality Bears by
28+
creating a tool which has the ability to jump directly into Bear code and
29+
move through it using a debugger interface such as pdb and make debugging
30+
of Bears as easy as writing the Bear.
31+
A Debugger should also has a ability to investigate the settings passed to the
32+
Bear.
33+
I also implemented a Profiler Interface which provides abilities to profile
34+
Bear code to optimize its performance.
35+
social:
36+
- GitHub:
37+
- username: RaiVaibhav
38+
- link: https://github.com/RaiVaibhav
39+
- GitLab:
40+
- username: RaiVaibhav
41+
- link: https://gitlab.com/RaiVaibhav
42+
- Gitter:
43+
- username: RaiVaibhav
44+
- link: https://gitter.im/RaiVaibhav
45+
- Openhub:
46+
- username: RaiVaibhav
47+
- link: https://www.openhub.net/accounts/RaiVaibhav
48+
49+
blog: https://raivaibhav.github.io
50+
activity:
51+
- 1:
52+
- repo: cEPs
53+
- link: https://github.com/coala/cEPs/commit/d7de1896ed3e9370a431987a210a82751e211066
54+
- details: >
55+
cEP-0021.md: Proposed implementation of `Profiling Interface`.
56+
- 2:
57+
- repo: coala
58+
- link: https://github.com/coala/coala/commit/d6186cd1bc3f4e049acac21c657b5a21c55393de
59+
- details: >
60+
Removed the `filter_raising_callables` function and inline it, to decrease
61+
the complexity of code for future modification in Debugger<br>Interface pull
62+
request.
63+
- 3:
64+
- repo: coala
65+
- link: https://github.com/coala/coala/commit/c1184ca58a9cca30afc144e7ad7a1bf7c5fe5f55
66+
- details: >
67+
Added Debugger Interface with `--debug-bears` argument and debug bears
68+
process so that pdb work in single process environment and<br>bear developer
69+
can debug specified bear.
70+
- 4:
71+
- repo: coala
72+
- link: https://github.com/coala/coala/commit/4cb1a6c5bb85bc42a315d118a2f66123465ab4ed
73+
- details: >
74+
Debug_Bears.rst: Added Debugger Interface document with demo.
75+
- 5:
76+
- repo: coala
77+
- link: https://github.com/coala/coala/commit/89833995c1380b813f30bf2048e3f63d495dd71a
78+
- details: >
79+
Prevent bear test from failing, replaced httpstat with Google teapot
80+
because of SSL certification error.
81+
- 6:
82+
- repo: coala-bears
83+
- link: https://github.com/coala/coala-bears/commit/8faa08ef573105a75cf31c57298d6b6ba9201d8e
84+
- details: >
85+
Debugged PySafetyBear to get the cause of upstream problem and failure of
86+
appveyor CI, updated PySafetyBear to support lastest version<br>of safety.
87+
- 7:
88+
- repo: coala
89+
- link: https://github.com/coala/coala/commit/e9e7e3770791b6df41b414a01c5a956c2b8b356f
90+
- details: >
91+
Added Settings inspection toolset through which user can access the
92+
settings of a Bear in Debug environment.
93+
- 8:
94+
- repo: coala
95+
- link: https://github.com/coala/coala/commit/80f8bc955bf4db2892d52262396d824f3050fb71
96+
- details: >
97+
Debug_bears.rst: Added Settings inspection toolset document with demo.
98+
- 9:
99+
- repo: coala
100+
- link: https://github.com/coala/coala/commit/3cb58246351ecbabd9768151cb6b9fe28c3790fc
101+
- details: >
102+
Removed `debugger` flag from `init` of bear Base class because of the API
103+
breakage issue for the existing users.
104+
- 10:
105+
- repo: coala-utils
106+
- link: https://gitlab.com/coala/coala-utils/commit/ba2e0789d0f1c405af93e313e692087077b45954
107+
- details: >
108+
Enhance TRUE and FALSE STRINGS in coala-utils `constants` so that
109+
settings like debugger and profiler can be enable and disable with<br>the
110+
value like `ok`, `positive`, `none`, `negative` etc.
111+
- 11:
112+
- repo: coala
113+
- link: https://github.com/coala/coala/commit/fea6e01bd0b5300b0f46c3528981c1e6558e1867
114+
- details: >
115+
Added Profiler Interface on coala with `--profile` argument to profile
116+
execution of bear.
117+
- 12:
118+
- repo: mobans
119+
- link: https://gitlab.com/coala/mobans/commit/b2d62db0e7bd8879843879974f2168cc3600bfa2
120+
- details: >
121+
Add `prof/` to `coala.gitignore` template. Ignored profiled data directory
122+
created by `pytest-profiling`.
123+
- 13:
124+
- repo: coala
125+
- link: https://github.com/coala/coala/commit/0e075217ea1bc5732d9deac57355431db00ef4ee
126+
- details: >
127+
Profile_Bears.rst: Add Profiling Interface document with demo.
128+
- 14:
129+
- repo: pytest-plugins
130+
- link: https://github.com/manahl/pytest-plugins/pull/89/commits/6f8d598b210da0f76e09ff86811d4538a1bc6c43
131+
- details: >
132+
pytest_profiling.py: Add additional argument to configurable profile
133+
output directory. (Not merged; approved by GSoC admin)
134+
---
135+
136+
### Debug and Profile Bears
137+
138+
#### Work Done
139+
140+
1. Debugger Interface added in coala.
141+
1. Step into the `run()` method of a bear move through it using a debugger
142+
interface such as `pdb` and exits as soon as `run()` is left.
143+
2. Pdb's quit-command (`q`) remapped so coala continues its normal execution
144+
without aborting. So, `quit` or `q` will first clear all breakpoints and
145+
then continue execution.
146+
3. Users can specify the bear they want to debug using `--debug-bears`.
147+
4. Users can specify to debug bears using a `.coafile`.
148+
149+
2. A new command `settings` is included in coala's Debugging Interface to
150+
inspect Bear settings in the debugging environment. It displays all passed
151+
settings of a Bear and their values so bear developer can quickly inspect
152+
them.
153+
154+
3. Profiler Interface added in coala.
155+
1. The profiler will start by profiling the `run()` method of bears because
156+
this is the part where bear writers will spend time on, as rest of the
157+
part like loading the files, collecting the settings, etc. are done by
158+
coala itself.
159+
2. `--profile-bears` or `profile_bears` (using .coafile) is the main argument
160+
to enable profiling.
161+
3. Accept an additional parameter `directory_path` through which bear
162+
developers can specify where to store the profiled data files.
163+
164+
#### Challenges
165+
166+
I had difficulties with testing of Debugger interface. With the help of `Mock`,
167+
test for debugger interface was created, though code coverage was 100% but
168+
`mock` test was not the ideal test, so after hours of discussion with Mischa we
169+
decided to capture the `pdb stdout` and assert the the output with the real
170+
output but problem arised, the ideal tests passes but somehow it didn't showed
171+
the code coverage to 100% not only that it also removed the coverage of the
172+
previous tests, at first I thought created test have some problem but seems
173+
like `pytest-cov` had a problem, so to confirm that I created a
174+
[test repo](https://github.com/RaiVaibhav/test_repo) and enable the
175+
[CI](https://travis-ci.org/RaiVaibhav/test_repo) on that repo to check the
176+
coverage report, it also showed same failure. So, I created a issue on
177+
`pytest-cov` repo but actual problem was, both coverage and debugger use the
178+
same trace feature, so it was not possible to run coverage and debugger in
179+
parallel or say it is not possible to chain the trace functions, so Mischa gave
180+
a idea to restore the trace callbacks and then run test, it worked finally so I
181+
included both ideal and `Mock` test so that the coverage remain 100, but in all
182+
of these I lagged around 3 week from my schedule. So I couldn't implement one of
183+
the proposed feature.
184+
185+
#### Work to be done
186+
187+
A tool which will provide the ability to inspect result instances like
188+
`origin`, `diffs`, `file`, `severity`, `message`, `aspects` and several other
189+
attributes in debugging environment or in a seperate python console where all
190+
where user can easily access there values. Information about result will help
191+
bear developer in creating a better performant Bears.
192+
193+
Result inspection tool will not only help in debugging the bear results but
194+
also help in testing the bear by asserting the various attributes of expected
195+
result with actual result.

0 commit comments

Comments
 (0)