Skip to content

Commit b73c37f

Browse files
committed
Update config and add example and diagram
- Update elvis.config - Add dialyzer config - Fix up .dir-locals.el (mostly wrt flycheck paths)
1 parent 2349344 commit b73c37f

File tree

7 files changed

+103
-26
lines changed

7 files changed

+103
-26
lines changed

.dir-locals.el

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
((nil . ((indent-tabs-mode . nil)
2-
(fill-column . 80)
3-
(eval . (turn-on-fci-mode))))
4-
(erlang-mode . ((flycheck-erlang-include-path . ("../include"
5-
"../../include"
6-
"../../../include"))
7-
(flycheck-erlang-library-path . ("../../../_build/default/lib/elli_cache"
8-
"../../../_build/default/lib/elli_cache/ebin"))
9-
(erlang-indent-level . 4))))
1+
((nil
2+
. ((indent-tabs-mode . nil)
3+
(fill-column . 80)
4+
(eval . (turn-on-fci-mode))))
5+
(erlang-mode
6+
. ((erlang-indent-level . 4)
7+
(flycheck-erlang-include-path
8+
. ("../include"
9+
"../_build/default/lib"
10+
"../_build/test/lib"))
11+
(flycheck-erlang-library-path
12+
. ("../_build/default/lib/elli_cache"
13+
"../_build/default/lib/elli_cache/ebin"
14+
"../_build/default/lib/erlando"
15+
"../_build/default/lib/erlando/ebin")))))

elvis.config

+3-17
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,16 @@
77
"src"
88
],
99
filter => "*.erl",
10-
rules => [
11-
{elvis_style, line_length,
12-
#{limit => 80, skip_comments => false}},
13-
{elvis_style, invalid_dynamic_call,
14-
#{ignore => [
15-
]}},
16-
{elvis_style, god_modules, #{limit => 25}}
17-
],
1810
ruleset => erl_files
1911
},
2012
#{dirs => [
21-
"test/eunit"
13+
"test"
2214
],
2315
filter => "*.erl",
2416
rules => [
25-
{elvis_style, line_length,
26-
#{limit => 90}},
27-
{elvis_style, invalid_dynamic_call,
28-
#{ignore => [
29-
]}},
30-
{elvis_style, god_modules, #{limit => 40}},
3117
%% looks like eunit generates underscored vars
32-
{elvis_style, variable_naming_convention, #{regex => "^([A-Z_][0-9a-zA-Z_]*)$"}},
33-
{elvis_style, dont_repeat_yourself, #{min_complexity => 200}}
18+
{elvis_style, variable_naming_convention,
19+
#{regex => "^([A-Z_][0-9a-zA-Z_]*)$"}}
3420
],
3521
ruleset => erl_files
3622
},

priv/example.escript

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env escript
2+
%% -*- erlang -*-
3+
4+
main(_) ->
5+
code:ensure_loaded(example_cache),
6+
Config = [
7+
{mods, [
8+
{elli_example_callback, []},
9+
{elli_middleware_cache, [{mod, example_cache}]}
10+
]}
11+
],
12+
{ok, _Pid} = elli:start_link([{callback, elli_middleware},
13+
{callback_args, Config},
14+
{port, 3000}]).

priv/rfc7232.dot

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
digraph RFC7232 {
2+
label="RFC 7232, Section 6. Precedence";
3+
// compound=true;
4+
5+
step1 [label="If-Match"];
6+
sect3_1 [label="Section 3.1"];
7+
8+
step2 [label="If-Unmodified-Since"];
9+
sect3_4 [label="Section 3.4"];
10+
11+
step3 [label="If-None-Match"];
12+
13+
step4 [label="If-Modified-Since"];
14+
15+
step5 [label="Range ∧ If-Range"];
16+
17+
206;
18+
304;
19+
412;
20+
Res;
21+
22+
subgraph cluster1 {
23+
label="Step 1";
24+
step1 -> step3 [color=green];
25+
step1 -> sect3_1 [color=red];
26+
step1 -> step2 [style=dashed];
27+
}
28+
29+
subgraph cluster2 {
30+
label="Step 2";
31+
step2 -> step3 [color=green, style=dashed];
32+
step2 -> sect3_4 [color=red];
33+
}
34+
35+
subgraph cluster3 {
36+
label="Step 3";
37+
step3 -> step5 [color=green];
38+
step3 -> 304 [color=red, label="GET ∨ HEAD"];
39+
step3 -> 412 [color=red, label="_Method"];
40+
step3 -> step4 [style=dashed];
41+
}
42+
43+
subgraph cluster4 {
44+
label="Step 4";
45+
step4 -> step5 [style=dashed, label="_Method"];
46+
step4 -> step5 [color=green, label="GET ∨ HEAD"];
47+
step4 -> 304 [color=red, label="GET ∨ HEAD"];
48+
}
49+
50+
subgraph cluster5 {
51+
label="Step 5";
52+
step5 -> 206 [color=green];
53+
step5 -> Res [color=red, label="GET"];
54+
step5 -> Res [style=dashed, label="_Method"];
55+
}
56+
}

priv/rfc7232.png

92.3 KB
Loading

rebar.config

+4
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@
3838

3939
{coveralls_coverdata, "_build/test/cover/eunit.coverdata"}.
4040
{coveralls_service_name, "travis-ci"}.
41+
42+
{dialyzer,
43+
%% TODO: underspecs, specdiffs
44+
[{warnings, [no_contracts, unmatched_returns, error_handling]}]}.

test/example_cache.erl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-module(example_cache).
2+
-behaviour(elli_cache).
3+
-export([get_modified/2, get_size/2]).
4+
5+
get_modified(_Req, _Args) ->
6+
%% calendar:universal_time().
7+
{{2016,11,15},{0,31,7}}.
8+
9+
get_size(_Req, _Args) ->
10+
%% rand:uniform(65536).
11+
42.

0 commit comments

Comments
 (0)