Skip to content

Commit 5c89ae3

Browse files
Replace usages of and and or with andalso and orelse
Co-authored-by: Maria Scott <maria-12648430@hnc-agency.org>
1 parent 3e43d48 commit 5c89ae3

84 files changed

Lines changed: 247 additions & 245 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/common_test/src/ct_framework.erl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ add_defaults1(Mod,Func, GroupPath, SuiteInfo) ->
412412
SuiteReqs =
413413
[SDDef || SDDef <- SuiteInfo,
414414
((require == element(1,SDDef))
415-
or (default_config == element(1,SDDef)))],
415+
orelse (default_config == element(1,SDDef)))],
416416
case check_for_clashes(TestCaseInfo, GroupPathInfo,
417417
SuiteReqs) of
418418
[] ->
@@ -463,11 +463,11 @@ remove_info_in_prev(Terms, [[] | Rest]) ->
463463
[[] | remove_info_in_prev(Terms, Rest)];
464464
remove_info_in_prev(Terms, [Info | Rest]) ->
465465
UniqueInInfo = [U || U <- Info,
466-
((timetrap == element(1,U)) and
467-
(not lists:keymember(timetrap,1,Terms))) or
468-
((require == element(1,U)) and
469-
(not lists:member(U,Terms))) or
470-
((default_config == element(1,U)) and
466+
((timetrap == element(1,U)) andalso
467+
(not lists:keymember(timetrap,1,Terms))) orelse
468+
((require == element(1,U)) andalso
469+
(not lists:member(U,Terms))) orelse
470+
((default_config == element(1,U)) andalso
471471
(not keysmember([default_config,1,
472472
element(2,U),2], Terms)))],
473473
OtherTermsInInfo = [T || T <- Info,

lib/common_test/src/ct_groups.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ find_groups1(Mod, GrNames, TCs, GroupDefs) ->
6060
Path ->
6161
{Path,true}
6262
end,
63-
TCs1 = if (is_atom(TCs) and (TCs /= all)) or is_tuple(TCs) ->
63+
TCs1 = if (is_atom(TCs) andalso (TCs /= all)) orelse is_tuple(TCs) ->
6464
[TCs];
6565
true ->
6666
TCs

lib/common_test/src/ct_logs.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ logger_loop(State) ->
831831
end,
832832
if Importance >= (100-VLvl) ->
833833
CtLogFd = State#logger_state.ct_log_fd,
834-
DoEscChars = State#logger_state.tc_esc_chars and EscChars,
834+
DoEscChars = State#logger_state.tc_esc_chars andalso EscChars,
835835
case get_groupleader(Pid, GL, State) of
836836
{tc_log,TCGL,TCGLs} ->
837837
case erlang:is_process_alive(TCGL) of
@@ -1503,8 +1503,8 @@ make_one_index_entry1(SuiteName, Link, Label, Success, Fail, UserSkip, AutoSkip,
15031503
integer_to_list(NotBuilt),"</a></td>\n"]
15041504
end,
15051505
FailStr =
1506-
if (Fail > 0) or (NotBuilt > 0) or
1507-
((Success+Fail+UserSkip+AutoSkip) == 0) ->
1506+
if (Fail > 0) orelse (NotBuilt > 0) orelse
1507+
((Success+Fail+UserSkip+AutoSkip) == 0) ->
15081508
["<font color=\"red\">",
15091509
integer_to_list(Fail),"</font>"];
15101510
true ->
@@ -2288,7 +2288,7 @@ runentry(Dir, undefined, _) ->
22882288
runentry(Dir, Totals={Node,Label,Logs,
22892289
{TotSucc,TotFail,UserSkip,AutoSkip,NotBuilt}}, Index) ->
22902290
TotFailStr =
2291-
if (TotFail > 0) or (NotBuilt > 0) or
2291+
if (TotFail > 0) orelse (NotBuilt > 0) orelse
22922292
((TotSucc+TotFail+UserSkip+AutoSkip) == 0) ->
22932293
["<font color=\"red\">",
22942294
integer_to_list(TotFail),"</font>"];

lib/common_test/src/ct_run.erl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,23 +1274,23 @@ run_dir(Opts = #opts{logdir = LogDir,
12741274
true -> D end || D <- Dirs],
12751275
reformat_result(catch do_run(tests(Dirs1), [], Opts1, StartOpts));
12761276

1277-
{Dir=[Hd|_],undefined,[]} when is_list(Dir) and is_integer(Hd) ->
1277+
{Dir=[Hd|_],undefined,[]} when is_list(Dir) andalso is_integer(Hd) ->
12781278
reformat_result(catch do_run(tests(Dir), [], Opts1, StartOpts));
12791279

1280-
{Dir,undefined,[]} when is_atom(Dir) and (Dir /= undefined) ->
1280+
{Dir,undefined,[]} when is_atom(Dir) andalso (Dir /= undefined) ->
12811281
reformat_result(catch do_run(tests(atom_to_list(Dir)),
12821282
[], Opts1, StartOpts));
12831283

12841284
{undefined,Suites=[Hd|_],[]} when not is_integer(Hd) ->
12851285
Suites1 = [suite_to_test(S) || S <- Suites],
12861286
reformat_result(catch do_run(tests(Suites1), [], Opts1, StartOpts));
12871287

1288-
{undefined,Suite,[]} when is_atom(Suite) and
1288+
{undefined,Suite,[]} when is_atom(Suite) andalso
12891289
(Suite /= undefined) ->
12901290
{Dir,Mod} = suite_to_test(Suite),
12911291
reformat_result(catch do_run(tests(Dir, Mod), [], Opts1, StartOpts));
12921292

1293-
{undefined,Suite,GsAndCs} when is_atom(Suite) and
1293+
{undefined,Suite,GsAndCs} when is_atom(Suite) andalso
12941294
(Suite /= undefined) ->
12951295
{Dir,Mod} = suite_to_test(Suite),
12961296
reformat_result(catch do_run(tests(Dir, Mod, GsAndCs),
@@ -1300,8 +1300,8 @@ run_dir(Opts = #opts{logdir = LogDir,
13001300
exit({error,multiple_suites_and_cases});
13011301

13021302
{undefined,Suite=[Hd|Tl],GsAndCs} when is_integer(Hd) ;
1303-
(is_list(Hd) and (Tl == [])) ;
1304-
(is_atom(Hd) and (Tl == [])) ->
1303+
(is_list(Hd) andalso (Tl == [])) ;
1304+
(is_atom(Hd) andalso (Tl == [])) ->
13051305
{Dir,Mod} = suite_to_test(Suite),
13061306
reformat_result(catch do_run(tests(Dir, Mod, GsAndCs),
13071307
[], Opts1, StartOpts));
@@ -1313,18 +1313,18 @@ run_dir(Opts = #opts{logdir = LogDir,
13131313
exit({error,incorrect_start_options});
13141314

13151315
{Dir,Suite,GsAndCs} when is_integer(hd(Dir)) ;
1316-
(is_atom(Dir) and (Dir /= undefined)) ;
1317-
((length(Dir) == 1) and is_atom(hd(Dir))) ;
1318-
((length(Dir) == 1) and is_list(hd(Dir))) ->
1316+
(is_atom(Dir) andalso (Dir /= undefined)) ;
1317+
((length(Dir) == 1) andalso is_atom(hd(Dir))) ;
1318+
((length(Dir) == 1) andalso is_list(hd(Dir))) ->
13191319
Dir1 = if is_atom(Dir) -> atom_to_list(Dir);
13201320
true -> Dir end,
13211321
if Suite == undefined ->
13221322
exit({error,incorrect_start_options});
13231323

13241324
is_integer(hd(Suite)) ;
1325-
(is_atom(Suite) and (Suite /= undefined)) ;
1326-
((length(Suite) == 1) and is_atom(hd(Suite))) ;
1327-
((length(Suite) == 1) and is_list(hd(Suite))) ->
1325+
(is_atom(Suite) andalso (Suite /= undefined)) ;
1326+
((length(Suite) == 1) andalso is_atom(hd(Suite))) ;
1327+
((length(Suite) == 1) andalso is_list(hd(Suite))) ->
13281328
{Dir2,Mod} = suite_to_test(Dir1, Suite),
13291329
case GsAndCs of
13301330
[] ->
@@ -1610,20 +1610,20 @@ suite_to_test(Dir, Suite) when is_list(Suite) ->
16101610
{DirName,list_to_atom(filename:rootname(File))}
16111611
end.
16121612

1613-
groups_and_cases(Gs, Cs) when ((Gs == undefined) or (Gs == [])) and
1614-
((Cs == undefined) or (Cs == [])) ->
1613+
groups_and_cases(Gs, Cs) when ((Gs == undefined) orelse (Gs == [])) andalso
1614+
((Cs == undefined) orelse (Cs == [])) ->
16151615
[];
16161616
groups_and_cases(Gs, Cs) when Gs == undefined ; Gs == [] ->
1617-
if (Cs == all) or (Cs == [all]) or (Cs == ["all"]) -> all;
1617+
if (Cs == all) orelse (Cs == [all]) orelse (Cs == ["all"]) -> all;
16181618
true -> [ensure_atom(C) || C <- listify(Cs)]
16191619
end;
16201620
groups_and_cases(GOrGs, Cs) when (is_atom(GOrGs) orelse
16211621
(is_list(GOrGs) andalso
16221622
(is_atom(hd(GOrGs)) orelse
16231623
(is_list(hd(GOrGs)) andalso
16241624
is_atom(hd(hd(GOrGs))))))) ->
1625-
if (Cs == undefined) or (Cs == []) or
1626-
(Cs == all) or (Cs == [all]) or (Cs == ["all"]) ->
1625+
if (Cs == undefined) orelse (Cs == []) orelse
1626+
(Cs == all) orelse (Cs == [all]) orelse (Cs == ["all"]) ->
16271627
[{GOrGs,all}];
16281628
true ->
16291629
[{GOrGs,[ensure_atom(C) || C <- listify(Cs)]}]
@@ -1632,7 +1632,7 @@ groups_and_cases(Gs, Cs) when is_integer(hd(hd(Gs))) ->
16321632
%% if list of strings, this comes from 'ct_run -group G1 G2 ...' and
16331633
%% we need to parse the strings
16341634
Gs1 =
1635-
if (Gs == [all]) or (Gs == ["all"]) ->
1635+
if (Gs == [all]) orelse (Gs == ["all"]) ->
16361636
all;
16371637
true ->
16381638
lists:map(fun(G) ->
@@ -2360,7 +2360,7 @@ start_cover(Opts=#opts{coverspec=CovData,cover_stop=CovStop},LogDir) ->
23602360
[TsCoverInfo]),
23612361

23622362
%% start cover on specified nodes
2363-
if (CovNodes /= []) and (CovNodes /= undefined) ->
2363+
if (CovNodes /= []) andalso (CovNodes /= undefined) ->
23642364
ct_logs:log("COVER INFO",
23652365
"Nodes included in cover "
23662366
"session: ~tw",

lib/common_test/src/ct_slave.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ do_start(Host, Node, Options) ->
350350
{ok, ENode}->
351351
ok;
352352
{error, Timeout, ENode}
353-
when ((Timeout==init_timeout) or (Timeout==startup_timeout)) and
353+
when ((Timeout==init_timeout) orelse (Timeout==startup_timeout)) andalso
354354
Options#options.kill_if_fail->
355355
do_stop(ENode);
356356
_-> ok

lib/common_test/src/ct_telnet.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ teln_expect(Name,Pid,Data,Pattern0,Prx,Opts) ->
11901190
end.
11911191
11921192
convert_pattern(Pattern0,Seq)
1193-
when Pattern0==[] orelse (is_list(Pattern0) and not is_integer(hd(Pattern0))) ->
1193+
when Pattern0==[] orelse (is_list(Pattern0) andalso not is_integer(hd(Pattern0))) ->
11941194
Pattern =
11951195
case Seq of
11961196
true -> Pattern0;

lib/common_test/src/ct_testspec.erl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,10 @@ replace_names(Terms) ->
474474
throw({illegal_name_in_testspec,Name});
475475
true ->
476476
[First|_] = atom_to_list(Name),
477-
if ((First == $?) or (First == $$)
478-
or (First == $_)
479-
or ((First >= $A)
480-
and (First =< $Z))) ->
477+
if ((First == $?) orelse (First == $$)
478+
orelse (First == $_)
479+
orelse ((First >= $A)
480+
andalso (First =< $Z))) ->
481481
[Def];
482482
true ->
483483
throw({illegal_name_in_testspec,
@@ -1299,14 +1299,14 @@ insert_groups(Node,Dir,Suite,Group,Cases,Tests,MergeTests)
12991299
when is_atom(Group); is_tuple(Group) ->
13001300
insert_groups(Node,Dir,Suite,[Group],Cases,Tests,MergeTests);
13011301
insert_groups(Node,Dir,Suite,Groups,Cases,Tests,false) when
1302-
((Cases == all) or is_list(Cases)) and is_list(Groups) ->
1302+
((Cases == all) orelse is_list(Cases)) andalso is_list(Groups) ->
13031303
Groups1 = [if is_list(Gr) -> % preserve group path
13041304
{[Gr],Cases};
13051305
true ->
13061306
{Gr,Cases} end || Gr <- Groups],
13071307
append({{Node,Dir},[{Suite,Groups1}]},Tests);
13081308
insert_groups(Node,Dir,Suite,Groups,Cases,Tests,true) when
1309-
((Cases == all) or is_list(Cases)) and is_list(Groups) ->
1309+
((Cases == all) orelse is_list(Cases)) andalso is_list(Groups) ->
13101310
Groups1 = [if is_list(Gr) -> % preserve group path
13111311
{[Gr],Cases};
13121312
true ->
@@ -1418,11 +1418,11 @@ skip_groups(Node,Dir,Suite,Groups,Case,Cmt,Tests,MergeTests)
14181418
when is_atom(Case),Case =/= all ->
14191419
skip_groups(Node,Dir,Suite,Groups,[Case],Cmt,Tests,MergeTests);
14201420
skip_groups(Node,Dir,Suite,Groups,Cases,Cmt,Tests,false) when
1421-
((Cases == all) or is_list(Cases)) and is_list(Groups) ->
1421+
((Cases == all) orelse is_list(Cases)) andalso is_list(Groups) ->
14221422
Suites1 = skip_groups1(Suite,[{Gr,Cases} || Gr <- Groups],Cmt,[]),
14231423
append({{Node,Dir},Suites1},Tests);
14241424
skip_groups(Node,Dir,Suite,Groups,Cases,Cmt,Tests,true) when
1425-
((Cases == all) or is_list(Cases)) and is_list(Groups) ->
1425+
((Cases == all) orelse is_list(Cases)) andalso is_list(Groups) ->
14261426
{Tests1,Done} =
14271427
lists:foldr(fun({{N,D},Suites0},{Merged,_}) when N == Node,
14281428
D == Dir ->
@@ -1579,7 +1579,7 @@ is_node([master|_],_Nodes) ->
15791579
is_node(What={N,H},Nodes) when is_atom(N), is_atom(H) ->
15801580
is_node([What],Nodes);
15811581
is_node([What|_],Nodes) ->
1582-
case lists:keymember(What,1,Nodes) or
1582+
case lists:keymember(What,1,Nodes) orelse
15831583
lists:keymember(What,2,Nodes) of
15841584
true ->
15851585
true;

lib/common_test/src/test_server_ctrl.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,15 +2350,15 @@ run_test_cases(TestSpec, Config, TimetrapData) ->
23502350

23512351
run_test_cases_loop([{SkipTag,CaseData={Type,_Ref,_Case,_Comment}}|Cases],
23522352
Config, TimetrapData, Mode, Status) when
2353-
((SkipTag==auto_skip_case) or (SkipTag==skip_case)) and
2354-
((Type==conf) or (Type==make)) ->
2353+
((SkipTag==auto_skip_case) orelse (SkipTag==skip_case)) andalso
2354+
((Type==conf) orelse (Type==make)) ->
23552355
run_test_cases_loop([{SkipTag,CaseData,Mode}|Cases],
23562356
Config, TimetrapData, Mode, Status);
23572357

23582358
run_test_cases_loop([{SkipTag,{Type,Ref,Case,Comment},SkipMode}|Cases],
23592359
Config, TimetrapData, Mode, Status) when
2360-
((SkipTag==auto_skip_case) or (SkipTag==skip_case)) and
2361-
((Type==conf) or (Type==make)) ->
2360+
((SkipTag==auto_skip_case) orelse (SkipTag==skip_case)) andalso
2361+
((Type==conf) orelse (Type==make)) ->
23622362
ok = file:set_cwd(filename:dirname(get(test_server_dir))),
23632363
CurrIOHandler = get(test_server_common_io_handler),
23642364
ParentMode = tl(Mode),
@@ -2823,7 +2823,7 @@ run_test_cases_loop([{conf,Ref,Props,{Mod,Func}}|_Cases]=Cs0,
28232823
stop_minor_log_file(),
28242824
run_test_cases_loop(Cases2, Config1, TimetrapData, Mode, Status3);
28252825

2826-
{_,{Skip,Reason},_} when StartConf and ((Skip==skip) or (Skip==skipped)) ->
2826+
{_,{Skip,Reason},_} when StartConf andalso ((Skip==skip) orelse (Skip==skipped)) ->
28272827
ReportAbortRepeat(skipped),
28282828
print(minor, "~n*** ~tw skipped.~n"
28292829
" Skipping all cases.", [Func]),

lib/compiler/src/beam_dict.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ line([{location,Name,Line}|_], #asm{lines=Lines,num_lines=N,
222222
when is_atom(Instr) ->
223223
{FnameIndex,Dict1} = fname(Name, Dict0),
224224
Key = {FnameIndex,Line},
225-
ExecLine = ExecLine0 or (Instr =:= executable_line),
225+
ExecLine = ExecLine0 orelse (Instr =:= executable_line),
226226
case Lines of
227227
#{Key := Index} ->
228228
{Index,Dict1#asm{num_lines=N+1,exec_line=ExecLine}};

lib/compiler/src/beam_ssa_opt.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3303,7 +3303,7 @@ unfold_literals([], _, _, Blocks) ->
33033303
Blocks.
33043304

33053305
unfold_update_succ([S|Ss], Safe, SafeMap0) ->
3306-
F = fun(Prev) -> Prev and Safe end,
3306+
F = fun(Prev) -> Prev andalso Safe end,
33073307
SafeMap = maps:update_with(S, F, Safe, SafeMap0),
33083308
unfold_update_succ(Ss, Safe, SafeMap);
33093309
unfold_update_succ([], _, SafeMap) ->

0 commit comments

Comments
 (0)