You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Req](https://github.com/wojtekmach/req) is a popular HTTP Client. If you aren't using it, you can just ignore this whole section!
126
+
127
+
Styler ensures a minimal number of functions are being called when using any Req 1-arity execution functions (`delete get head patch post put request run` and their bangified versions).
**This changes the program's behaviour**, since `Keyword.merge` would overwrite existing values in all cases, whereas `Req` 2-arity functions intelligently deep-merge values for some keys, like `:headers`.
142
+
143
+
## Adding & Removing Pipes
144
+
145
+
### Unpiping Single Pipes
124
146
125
147
Styler rewrites pipechains with a single pipe to be function calls. Notably, this rule combined with the optimizations rewrites above means some chains with more than one pipe will also become function calls.
If the first argument to a function call is a pipe, Styler makes the function call the final pipe of the chain.
140
162
@@ -161,23 +183,3 @@ d(c(a |> b))
161
183
# At which point Styler will pipe-ify the entire chain
162
184
a |>b() |>c() |>d()
163
185
```
164
-
165
-
## Req
166
-
167
-
[Req](https://github.com/wojtekmach/req) is a popular HTTP Client. If you aren't using it, you can just ignore this whole section!
168
-
169
-
Styler ensures a minimal number of functions are being called when using any Req 1-arity execution functions (`delete get head patch post put request run` and their bangified versions).
**This changes the program's behaviour**, since `Keyword.merge` would overwrite existing values in all cases, whereas `Req` 2-arity functions intelligently deep-merge values for some keys, like `:headers`.
Copy file name to clipboardExpand all lines: docs/styles.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,6 @@ Styler performs myriad rewrites, logically broken apart into the following group
8
8
-[General Styles](./general_styles.md): general simple 1-1 rewrites that require a minimum amount of awareness of the AST
9
9
-[Mix Configs](./mix_configs.md): Styler applies order to chaos by organizing mix `config ...` stanzas
10
10
-[Module Directives](./module_directives.md): Styles for `alias`, `use`, `import`, `require`, as well as alias lifting and alias application.
11
-
-[Pipes](./pipes.md) styles for the famous Elixir pipe `|>`, including optimizations for piping standard library functions
11
+
-[Pipes](./pipes.md): Styles for the famous Elixir pipe `|>`, including optimizations for piping standard library functions
12
12
13
13
Finally, if you're using Credo [see our documentation](./credo.md) about rules that can be disabled in Credo because Styler automatically enforces them for you, saving a modicum of CI time.
0 commit comments