Skip to content

Commit 4df2cbc

Browse files
add section on how to dive in.
1 parent 98136ed commit 4df2cbc

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@ This project follows the contributing recommendations outlined by [saamwerk](htt
44
In particular, issues labelled with `Status: Postponed` are closed even if they
55
are not resolved.
66

7+
## How to dive in and understanding the source code
8+
9+
Read the vignettes. If you are done, come back here.
10+
11+
`devtools::load_all()`
12+
13+
`debug(style_text)`
14+
15+
`style_text("call(1, 2 + 1)")`
16+
17+
Go broad before you go deep. Before going into the very deep layers of function
18+
calls of `style_text()`, try to understand that `style_text()` consists of only
19+
three function calls.
20+
Go into each of them and try to understand one layer deep. That is, try to
21+
understand what `make_transformer()` does by reading the names of the functions
22+
that get called, the name of the objects that are created by assigning the output of
23+
these function calls. Before looking into a functions source code, look at the
24+
documentation for that function. All internal important functions
25+
are documented and documentation is available also for unexported objects via
26+
`?` (if you did `devtools::load_all()`.
27+
Then, go into `parse_transform_serialize()` and so on.
28+
29+
To understand the most fundamental operation in styler, the manipulation of the
30+
columns related to spacing and line break information, pick a rule from
31+
`R/rules-*.R`, e.g. `R/rules-spacing`, add a breakpoint to a rule and style a
32+
string where you think this rule will be active. Then, see what happens and how
33+
this rule is applied on each level of nesting.
34+
35+
736
## File Structure
837

938
The source code is organized as follows:

0 commit comments

Comments
 (0)