Skip to content

Commit a5e253c

Browse files
authored
Merge pull request #122 from zhongwencool/ci
Refactor and update configs, types, and code structure
2 parents 0848c51 + f9706e7 commit a5e253c

14 files changed

+125
-354
lines changed

.github/workflows/erlang.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,12 @@ jobs:
1616
rebar3: '3.22'
1717
- otp: '26'
1818
rebar3: '3.22'
19-
- otp: '25'
20-
rebar3: '3.22'
21-
- otp: '24'
22-
rebar3: '3.22'
2319
steps:
2420
- uses: actions/checkout@v4
2521
- uses: erlef/setup-beam@v1
2622
with:
2723
otp-version: ${{matrix.otp}}
2824
rebar3-version: ${{matrix.rebar3}}
29-
- name: compile
30-
run: rebar3 compile
31-
- name: xref
32-
run: rebar3 xref
33-
- name: dialyzer
34-
run: rebar3 dialyzer
25+
- name: quality checks
26+
run: rebar3 check
3527

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Top N list sort by memory size, all items defined in [`mnesia:table_info/2`](htt
240240

241241
### Application
242242

243-
![Application](https://github.com/zhongwencool/observer_cli/raw/main/docs/images/application.jpg)
243+
![Application](https://github.com/zhongwencool/observer_cli/raw/main/docs/images/application.png)
244244

245245
The Application panel aggregates supervision data from [`application_controller:info()`](https://github.com/erlang/otp/blob/master/lib/kernel/src/application_controller.erl#L280), groups processes by their application master, and shows their live resource usage. Each row includes:
246246

doc/overview.edoc

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/overview.edoc

Lines changed: 0 additions & 198 deletions
This file was deleted.

elvis.config

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,37 @@
1-
[
2-
{
3-
elvis,
4-
[
5-
{config,
6-
[#{dirs => ["src", "test"],
7-
filter => "*.erl",
8-
rules => [{elvis_style, line_length, #{limit => 140}},
9-
{elvis_style, no_tabs},
10-
{elvis_style, macro_names},
11-
{elvis_style, macro_module_names},
12-
{elvis_style, operator_spaces, #{rules => [{right, ","},
13-
{right, "++"},
14-
{left, "++"}]}},
15-
{elvis_style, nesting_level, #{level => 4}},
16-
{elvis_style, god_modules, #{limit => 25}},
17-
{elvis_style, no_if_expression},
18-
{elvis_style, invalid_dynamic_call, #{ignore => [elvis]}},
19-
{elvis_style, used_ignored_variable},
20-
{elvis_style, no_behavior_info},
21-
{
22-
elvis_style,
23-
module_naming_convention,
24-
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
25-
ignore => []}
26-
},
27-
{elvis_style, state_record_and_type},
28-
{elvis_style, no_spec_with_records}
29-
]
30-
},
31-
#{dirs => ["."],
32-
filter => "Makefile",
33-
rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => [sync]}}]
34-
},
35-
#{dirs => ["."],
36-
filter => "rebar.config",
37-
rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}}]
38-
},
39-
#{dirs => ["."],
40-
filter => "elvis.config",
41-
rules => [{elvis_project, old_configuration_format}]
42-
}
43-
]
44-
}
45-
]
46-
}
47-
].
1+
[{elvis, [
2+
{config, [
3+
#{ dirs => ["src"]
4+
, filter => "*.erl"
5+
, ruleset => erl_files
6+
, rules => [
7+
{elvis_text_style, line_length, #{limit => 140}},
8+
{elvis_style, atom_naming_convention, #{ignore => [observer_cli_mnesia]}},
9+
{elvis_style, param_pattern_matching, disable},
10+
{elvis_style, no_receive_without_timeout, disable},
11+
{elvis_style, no_block_expressions, disable},
12+
{elvis_style, dont_repeat_yourself, disable},
13+
{elvis_style, no_debug_call, #{ignore => [observer_cli_escriptize]}},
14+
{elvis_style, no_if_expression, disable},
15+
{elvis_style, no_catch_expressions, disable},
16+
{elvis_style, export_used_types, disable}
17+
]
18+
}
19+
, #{ dirs => ["include"]
20+
, filter => "*.hrl"
21+
, ruleset => hrl_files
22+
, rules => [
23+
{elvis_text_style, line_length, #{limit => 140}},
24+
{elvis_style, no_types, disable},
25+
{elvis_style, macro_names, disable}
26+
]
27+
}
28+
, #{ dirs => ["."]
29+
, filter => "rebar.config"
30+
, ruleset => rebar_config
31+
}
32+
]}
33+
, {output_format, colors}
34+
, {verbose, true}
35+
, {no_output, false}
36+
, {parallel, 1}
37+
]}].

include/observer_cli.hrl

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,31 @@
5151
-record(plug, {cur_index = 1 :: pos_integer(), plugs = [] :: map() | []}).
5252

5353
-record(view_opts, {
54-
home = #home{} :: home(),
55-
ets = #ets{} :: ets(),
56-
sys = #system{} :: system(),
57-
app = #app{} :: app(),
58-
db = #db{} :: db(),
59-
help = #help{} :: help(),
60-
inet = #inet{} :: inet(),
61-
process = #process{} :: process(),
54+
home = #home{} :: #home{},
55+
ets = #ets{} :: #ets{},
56+
sys = #system{} :: #system{},
57+
app = #app{} :: #app{},
58+
db = #db{} :: #db{},
59+
help = #help{} :: #help{},
60+
inet = #inet{} :: #inet{},
61+
process = #process{} :: #process{},
6262
port = ?DEFAULT_INTERVAL :: pos_integer(),
63-
plug = #plug{} :: plug(),
63+
plug = #plug{} :: #plug{},
6464
auto_row = true :: boolean()
6565
}).
6666

67-
-export_type([view_opts/0]).
67+
-export_type([
68+
view_opts/0,
69+
home/0,
70+
app/0,
71+
system/0,
72+
ets/0,
73+
db/0,
74+
help/0,
75+
inet/0,
76+
process/0,
77+
plug/0
78+
]).
6879

6980
-type view_opts() :: #view_opts{}.
7081
-type home() :: #home{}.
@@ -103,6 +114,6 @@
103114
-define(SELECT(Text), observer_cli_lib:select(Text)).
104115
-define(UNSELECT(Text), observer_cli_lib:unselect(Text)).
105116

106-
-define(render(_FA_), observer_cli_lib:render(_FA_)).
107-
-define(output(_F_, _A_), io:format(iolist_to_binary(_F_), _A_)).
108-
-define(output(_L_), ?output(_L_, [])).
117+
-define('render'(_FA_), observer_cli_lib:render(_FA_)).
118+
-define('output'(_F_, _A_), io:format(iolist_to_binary(_F_), _A_)).
119+
-define('output'(_L_), ?output(_L_, [])).

0 commit comments

Comments
 (0)