Skip to content

Commit e8de686

Browse files
author
CI
committed
Sync to GitHub
1 parent 33a006d commit e8de686

101 files changed

Lines changed: 335 additions & 334 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.

.credo.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
{Credo.Check.Readability.ModuleNames, []},
9696
{Credo.Check.Readability.ParenthesesInCondition, []},
9797
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, parens: true},
98-
{Credo.Check.Readability.PredicateFunctionNames, false},
98+
{Credo.Check.Readability.PredicateFunctionNames, []},
9999
{Credo.Check.Readability.PreferImplicitTry, []},
100100
{Credo.Check.Readability.RedundantBlankLines, []},
101101
{Credo.Check.Readability.Semicolons, []},

lib/bacnet/protocol/apdu/abort.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ defmodule BACnet.Protocol.APDU.Abort do
5555
@doc """
5656
Whether the struct is a request.
5757
"""
58-
@spec is_request(@for.t()) :: boolean()
59-
def is_request(%@for{} = _apdu), do: false
58+
@spec request?(@for.t()) :: boolean()
59+
def request?(%@for{} = _apdu), do: false
6060

6161
@doc """
6262
Whether the struct is a response.
6363
"""
64-
@spec is_response(@for.t()) :: boolean()
65-
def is_response(%@for{} = _apdu), do: true
64+
@spec response?(@for.t()) :: boolean()
65+
def response?(%@for{} = _apdu), do: true
6666

6767
@spec encode(@for.t()) :: iodata()
6868
def encode(

lib/bacnet/protocol/apdu/complex_ack.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ defmodule BACnet.Protocol.APDU.ComplexACK do
6969
@doc """
7070
Whether the struct is a request.
7171
"""
72-
@spec is_request(@for.t()) :: boolean()
73-
def is_request(%@for{} = _apdu), do: false
72+
@spec request?(@for.t()) :: boolean()
73+
def request?(%@for{} = _apdu), do: false
7474

7575
@doc """
7676
Whether the struct is a response.
7777
"""
78-
@spec is_response(@for.t()) :: boolean()
79-
def is_response(%@for{} = _apdu), do: true
78+
@spec response?(@for.t()) :: boolean()
79+
def response?(%@for{} = _apdu), do: true
8080

8181
@spec encode(@for.t()) :: iodata()
8282
def encode(%@for{} = apdu) do

lib/bacnet/protocol/apdu/confirmed_service_request.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ defmodule BACnet.Protocol.APDU.ConfirmedServiceRequest do
192192
@doc """
193193
Whether the struct is a request.
194194
"""
195-
@spec is_request(@for.t()) :: boolean()
196-
def is_request(%@for{} = _apdu), do: true
195+
@spec request?(@for.t()) :: boolean()
196+
def request?(%@for{} = _apdu), do: true
197197

198198
@doc """
199199
Whether the struct is a response.
200200
"""
201-
@spec is_response(@for.t()) :: boolean()
202-
def is_response(%@for{} = _apdu), do: false
201+
@spec response?(@for.t()) :: boolean()
202+
def response?(%@for{} = _apdu), do: false
203203

204204
@spec encode(@for.t()) :: iodata()
205205
def encode(%@for{} = apdu) do

lib/bacnet/protocol/apdu/error.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ defmodule BACnet.Protocol.APDU.Error do
6666
@doc """
6767
Whether the struct is a request.
6868
"""
69-
@spec is_request(@for.t()) :: boolean()
70-
def is_request(%@for{} = _apdu), do: false
69+
@spec request?(@for.t()) :: boolean()
70+
def request?(%@for{} = _apdu), do: false
7171

7272
@doc """
7373
Whether the struct is a response.
7474
"""
75-
@spec is_response(@for.t()) :: boolean()
76-
def is_response(%@for{} = _apdu), do: true
75+
@spec response?(@for.t()) :: boolean()
76+
def response?(%@for{} = _apdu), do: true
7777

7878
@spec encode(@for.t()) :: iodata()
7979
def encode(

lib/bacnet/protocol/apdu/reject.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ defmodule BACnet.Protocol.APDU.Reject do
5757
@doc """
5858
Whether the struct is a request.
5959
"""
60-
@spec is_request(@for.t()) :: boolean()
61-
def is_request(%@for{} = _apdu), do: false
60+
@spec request?(@for.t()) :: boolean()
61+
def request?(%@for{} = _apdu), do: false
6262

6363
@doc """
6464
Whether the struct is a response.
6565
"""
66-
@spec is_response(@for.t()) :: boolean()
67-
def is_response(%@for{} = _apdu), do: true
66+
@spec response?(@for.t()) :: boolean()
67+
def response?(%@for{} = _apdu), do: true
6868

6969
@spec encode(@for.t()) :: iodata()
7070
def encode(

lib/bacnet/protocol/apdu/segment_ack.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ defmodule BACnet.Protocol.APDU.SegmentACK do
5959
@doc """
6060
Whether the struct is a request.
6161
"""
62-
@spec is_request(@for.t()) :: boolean()
63-
def is_request(%@for{} = _apdu), do: false
62+
@spec request?(@for.t()) :: boolean()
63+
def request?(%@for{} = _apdu), do: false
6464

6565
@doc """
6666
Whether the struct is a response.
6767
"""
68-
@spec is_response(@for.t()) :: boolean()
69-
def is_response(%@for{} = _apdu), do: true
68+
@spec response?(@for.t()) :: boolean()
69+
def response?(%@for{} = _apdu), do: true
7070

7171
@spec encode(@for.t()) :: iodata()
7272
def encode(

lib/bacnet/protocol/apdu/simple_ack.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ defmodule BACnet.Protocol.APDU.SimpleACK do
5757
@doc """
5858
Whether the struct is a request.
5959
"""
60-
@spec is_request(@for.t()) :: boolean()
61-
def is_request(%@for{} = _apdu), do: false
60+
@spec request?(@for.t()) :: boolean()
61+
def request?(%@for{} = _apdu), do: false
6262

6363
@doc """
6464
Whether the struct is a response.
6565
"""
66-
@spec is_response(@for.t()) :: boolean()
67-
def is_response(%@for{} = _apdu), do: true
66+
@spec response?(@for.t()) :: boolean()
67+
def response?(%@for{} = _apdu), do: true
6868

6969
@spec encode(@for.t()) :: iodata()
7070
def encode(

lib/bacnet/protocol/apdu/unconfirmed_service_request.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ defmodule BACnet.Protocol.APDU.UnconfirmedServiceRequest do
127127
@doc """
128128
Whether the struct is a request.
129129
"""
130-
@spec is_request(@for.t()) :: boolean()
131-
def is_request(%@for{} = _apdu), do: true
130+
@spec request?(@for.t()) :: boolean()
131+
def request?(%@for{} = _apdu), do: true
132132

133133
@doc """
134134
Whether the struct is a response.
135135
"""
136-
@spec is_response(@for.t()) :: boolean()
137-
def is_response(%@for{} = _apdu), do: false
136+
@spec response?(@for.t()) :: boolean()
137+
def response?(%@for{} = _apdu), do: false
138138

139139
@spec encode(@for.t()) :: iodata()
140140
def encode(%@for{} = apdu) do

lib/bacnet/protocol/date_range.ex

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ defmodule BACnet.Protocol.DateRange do
2525
"""
2626
@spec get_date_range(t()) :: {:ok, Date.Range.t()} | {:error, term()}
2727
def get_date_range(%__MODULE__{} = date_range) do
28-
if is_date_specific_enough_for_date_range(date_range.start_date) and
29-
is_date_specific_enough_for_date_range(date_range.end_date) do
28+
if date_specific_enough_for_date_range?(date_range.start_date) and
29+
date_specific_enough_for_date_range?(date_range.end_date) do
3030
with {:ok, start_date} <- BACnetDate.to_date(date_range.start_date),
3131
{:ok, end_date} <- BACnetDate.to_date(date_range.end_date) do
3232
{:ok, Date.range(start_date, end_date)}
@@ -88,15 +88,15 @@ defmodule BACnet.Protocol.DateRange do
8888
} = _t
8989
) do
9090
BACnetDate.valid?(start_date) and BACnetDate.valid?(end_date) and
91-
is_valid_date_range(start_date, end_date)
91+
valid_date_range?(start_date, end_date)
9292
end
9393

9494
def valid?(%__MODULE__{} = _t), do: false
9595

96-
@spec is_valid_date_range(BACnetDate.t(), BACnetDate.t()) :: boolean()
97-
defp is_valid_date_range(%BACnetDate{} = start_date, %BACnetDate{} = end_date) do
98-
{any1, all1} = is_date_any_unspecified(start_date)
99-
{any2, all2} = is_date_any_unspecified(end_date)
96+
@spec valid_date_range?(BACnetDate.t(), BACnetDate.t()) :: boolean()
97+
defp valid_date_range?(%BACnetDate{} = start_date, %BACnetDate{} = end_date) do
98+
{any1, all1} = date_any_unspecified?(start_date)
99+
{any2, all2} = date_any_unspecified?(end_date)
100100

101101
# ASHRAE 135-2012: A date may be unspecific or a specific date only
102102
(not any1 and not any2 and BACnetDate.compare(start_date, end_date) != :gt) or
@@ -107,22 +107,22 @@ defmodule BACnet.Protocol.DateRange do
107107

108108
@date_keys Map.keys(Map.from_struct(BACnetDate.__struct__()))
109109

110-
defp is_date_any_unspecified(%BACnetDate{
110+
defp date_any_unspecified?(%BACnetDate{
111111
unquote_splicing(Enum.map(@date_keys, &{&1, :unspecified}))
112112
}),
113113
do: {true, true}
114114

115115
for key <- @date_keys do
116-
defp is_date_any_unspecified(%BACnetDate{unquote(key) => :unspecified}), do: {true, false}
116+
defp date_any_unspecified?(%BACnetDate{unquote(key) => :unspecified}), do: {true, false}
117117
end
118118

119-
defp is_date_any_unspecified(%BACnetDate{month: :odd}), do: {true, false}
120-
defp is_date_any_unspecified(%BACnetDate{month: :even}), do: {true, false}
121-
defp is_date_any_unspecified(%BACnetDate{day: :odd}), do: {true, false}
122-
defp is_date_any_unspecified(%BACnetDate{day: :even}), do: {true, false}
123-
defp is_date_any_unspecified(%BACnetDate{} = _date), do: {false, false}
119+
defp date_any_unspecified?(%BACnetDate{month: :odd}), do: {true, false}
120+
defp date_any_unspecified?(%BACnetDate{month: :even}), do: {true, false}
121+
defp date_any_unspecified?(%BACnetDate{day: :odd}), do: {true, false}
122+
defp date_any_unspecified?(%BACnetDate{day: :even}), do: {true, false}
123+
defp date_any_unspecified?(%BACnetDate{} = _date), do: {false, false}
124124

125-
defp is_date_specific_enough_for_date_range(%BACnetDate{
125+
defp date_specific_enough_for_date_range?(%BACnetDate{
126126
year: year,
127127
month: mon,
128128
day: day,
@@ -131,5 +131,5 @@ defmodule BACnet.Protocol.DateRange do
131131
when is_integer(year) and is_integer(mon) and (is_integer(day) or day == :last),
132132
do: true
133133

134-
defp is_date_specific_enough_for_date_range(%BACnetDate{} = _date), do: false
134+
defp date_specific_enough_for_date_range?(%BACnetDate{} = _date), do: false
135135
end

0 commit comments

Comments
 (0)