Skip to content

Commit 6b70354

Browse files
committed
reports: Add Vaibhav's GSoC report
1 parent d675f56 commit 6b70354

File tree

1 file changed

+196
-0
lines changed

1 file changed

+196
-0
lines changed

_reports/RaiVaibhav.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
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 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
61+
decrease the complexity of code for future modification in
62+
Debugger<br>Interface pull 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
69+
developer 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
86+
of appveyor CI, updated PySafetyBear to support lastest version<br>of
87+
safety.
88+
- 7:
89+
- repo: coala
90+
- link: https://github.com/coala/coala/commit/e9e7e3770791b6df41b414a01c5a956c2b8b356f
91+
- details: >
92+
Added Settings inspection toolset through which user can access the
93+
settings of a Bear in Debug environment.
94+
- 8:
95+
- repo: coala
96+
- link: https://github.com/coala/coala/commit/80f8bc955bf4db2892d52262396d824f3050fb71
97+
- details: >
98+
Debug_bears.rst: Added Settings inspection toolset document with demo.
99+
- 9:
100+
- repo: coala
101+
- link: https://github.com/coala/coala/commit/3cb58246351ecbabd9768151cb6b9fe28c3790fc
102+
- details: >
103+
Removed `debugger` flag from `init` of bear Base class because of the
104+
API breakage issue for the existing users.
105+
- 10:
106+
- repo: coala-utils
107+
- link: https://gitlab.com/coala/coala-utils/commit/ba2e0789d0f1c405af93e313e692087077b45954
108+
- details: >
109+
Enhance TRUE and FALSE STRINGS in coala-utils `constants` so that
110+
settings like debugger and profiler can be enable and disable
111+
with<br>the value like `ok`, `positive`, `none`, `negative` etc.
112+
- 11:
113+
- repo: coala
114+
- link: https://github.com/coala/coala/commit/fea6e01bd0b5300b0f46c3528981c1e6558e1867
115+
- details: >
116+
Added Profiler Interface on coala with `--profile` argument to profile
117+
execution of bear.
118+
- 12:
119+
- repo: mobans
120+
- link: https://gitlab.com/coala/mobans/commit/b2d62db0e7bd8879843879974f2168cc3600bfa2
121+
- details: >
122+
Add `prof/` to `coala.gitignore` template. Ignored profiled data
123+
directory created by `pytest-profiling`.
124+
- 13:
125+
- repo: coala
126+
- link: https://github.com/coala/coala/commit/0e075217ea1bc5732d9deac57355431db00ef4ee
127+
- details: >
128+
Profile_Bears.rst: Add Profiling Interface document with demo.
129+
- 14:
130+
- repo: pytest-plugins
131+
- link: https://github.com/manahl/pytest-plugins/pull/89/commits/6f8d598b210da0f76e09ff86811d4538a1bc6c43
132+
- details: >
133+
pytest_profiling.py: Add additional argument to configurable profile
134+
output directory. (Not merged; approved by GSoC admin)
135+
---
136+
137+
### Debug and Profile Bears
138+
139+
#### Work Done
140+
141+
1. Debugger Interface added in coala.
142+
1. Step into the `run()` method of a bear move through it using a debugger
143+
interface such as `pdb` and exits as soon as `run()` is left.
144+
2. Pdb's quit-command (`q`) remapped so coala continues its normal execution
145+
without aborting. So, `quit` or `q` will first clear all breakpoints and
146+
then continue execution.
147+
3. Users can specify the bear they want to debug using `--debug-bears`.
148+
4. Users can specify to debug bears using a `.coafile`.
149+
150+
2. A new command `settings` is included in coala's Debugging Interface to
151+
inspect Bear settings in the debugging environment. It displays all passed
152+
settings of a Bear and their values so bear developer can quickly inspect
153+
them.
154+
155+
3. Profiler Interface added in coala.
156+
1. The profiler will start by profiling the `run()` method of bears because
157+
this is the part where bear writers will spend time on, as rest of the
158+
part like loading the files, collecting the settings, etc. are done by
159+
coala itself.
160+
2. `--profile-bears` or `profile_bears` (using .coafile) is the main argument
161+
to enable profiling.
162+
3. Accept an additional parameter `directory_path` through which bear
163+
developers can specify where to store the profiled data files.
164+
165+
#### Challenges
166+
167+
I had difficulties with testing of Debugger interface. With the help of `Mock`,
168+
test for debugger interface was created, though code coverage was 100% but
169+
`mock` test was not the ideal test, so after hours of discussion with Mischa we
170+
decided to capture the `pdb stdout` and assert the the output with the real
171+
output but problem arised, the ideal tests passes but somehow it didn't showed
172+
the code coverage to 100% not only that it also removed the coverage of the
173+
previous tests, at first I thought created test have some problem but seems
174+
like `pytest-cov` had a problem, so to confirm that I created a
175+
[test repo](https://github.com/RaiVaibhav/test_repo) and enable the
176+
[CI](https://travis-ci.org/RaiVaibhav/test_repo) on that repo to check the
177+
coverage report, it also showed same failure. So, I created a issue on
178+
`pytest-cov` repo but actual problem was, both coverage and debugger use the
179+
same trace feature, so it was not possible to run coverage and debugger in
180+
parallel or say it is not possible to chain the trace functions, so Mischa gave
181+
a idea to restore the trace callbacks and then run test, it worked finally so I
182+
included both ideal and `Mock` test so that the coverage remain 100, but in all
183+
of these I lagged around 3 week from my schedule. So I couldn't implement one of
184+
the proposed feature.
185+
186+
#### Work to be done
187+
188+
A tool which will provide the ability to inspect result instances like
189+
`origin`, `diffs`, `file`, `severity`, `message`, `aspects` and several other
190+
attributes in debugging environment or in a seperate python console where all
191+
where user can easily access there values. Information about result will help
192+
bear developer in creating a better performant Bears.
193+
194+
Result inspection tool will not only help in debugging the bear results but
195+
also help in testing the bear by asserting the various attributes of expected
196+
result with actual result.

0 commit comments

Comments
 (0)