Permalink
Browse files

Fix type specs in estatd_shp and add dialyzer target to Makefile

  • Loading branch information...
1 parent df979af commit 0f3535d454caad8a9bb438e75ec87e25cda2cb62 @seth seth committed Mar 9, 2013
Showing with 9 additions and 8 deletions.
  1. +4 −1 Makefile
  2. +5 −7 src/estatsd_shp.erl
View
@@ -9,11 +9,14 @@ else
endif
REBAR = rebar -C $(rebar_config)
-all: compile
+all: compile test dialyzer
compile: $(DEPS)
@$(REBAR) compile
+dialyzer:
+ dialyzer -Wunderspecs -r ebin
+
compile_skip:
@$(REBAR) compile skip_deps=true
View
@@ -10,14 +10,13 @@
-include("estatsd.hrl").
--spec parse_packet(binary()) ->
- {bad_version, binary()}
- | {bad_length, {integer(), binary()}}
- | {?SHP_VERSION, non_neg_integer(),
- [#shp_metric{}|{bad_metric, term()}]}.
% @doc Parse a binary in Stats Hero Protocol Version 1
%
+-spec parse_packet(binary()) ->
+ {bad_version, binary()}
+ | {bad_length, {[any()] | integer(), binary()}}
+ | [#shp_metric{}].
parse_packet(<<"1|", Rest/binary>>) ->
parse_packet(Rest, []);
parse_packet(Packet) when is_binary(Packet) ->
@@ -76,8 +75,7 @@ parse_metric(Bin) ->
{bad_metric, {parse_error, Bin}}
end.
--spec parse_type(binary()) -> atom().
-
+-spec parse_type(<<_:8, _:_*8>>) -> 'g' | 'h' | 'm' | 'mr'.
parse_type(<<"m">>) ->
m;
parse_type(<<"h">>) ->

0 comments on commit 0f3535d

Please sign in to comment.