Skip to content

Instantly share code, notes, and snippets.

@aaronjensen
Last active June 2, 2016 16:16
Show Gist options
  • Select an option

  • Save aaronjensen/6a9dbf6a7ff0cc5a6895ab75a4ad7e9e to your computer and use it in GitHub Desktop.

Select an option

Save aaronjensen/6a9dbf6a7ff0cc5a6895ab75a4ad7e9e to your computer and use it in GitHub Desktop.
-*- mode: compilation; default-directory: "~/Source/myapp/booking/web/booking/search/" -*-
Compilation started at Thu Jun 2 09:14:06
elixir -e IEx.Helpers.cd\(\"\~/Source/myapp/booking/\"\) -S mix dialyzer
/Users/aaronjensen/Source/myapp/booking
web/booking/search/location_searcher.ex:85: warning: clauses for the same def should be grouped together, def handle_info/2 was previously defined (web/booking/search/location_searcher.ex:72)
web/booking/search/location_searcher.ex:96: warning: clauses for the same def should be grouped together, def handle_info/2 was previously defined (web/booking/search/location_searcher.ex:72)
web/booking/search/location_searcher.ex:63: warning: variable location is unused
web/booking/search/location_searcher.ex:63: warning: variable radius is unused
web/booking/search/location_searcher.ex:67: warning: variable location is unused
web/booking/search/location_searcher.ex:67: warning: variable radius is unused
web/booking/search/location_searcher.ex:3: warning: unused alias Cache
Compiled web/booking/search/location_searcher.ex
Starting Dialyzer
dialyzer --no_check_plt --plt .local.plt -Wno_opaque -Wno_return -Wunderspecs -Wunknown -Wrace_conditions --fullpath /Users/aaronjensen/Source/myapp/booking/_build/dev/lib/booking/ebin
Compiling some key modules to native code... done in 0m0.22s
Proceeding with analysis...
web/booking/confirmation_email.ex:15: The call 'Elixir.Timex':format(check_in_date@1::#{},<<_:112>>) will never return since the success typing is ('Elixir.Timex.Convertable',binary()) -> {'error',_} | {'ok',binary()} and the contract is ('Elixir.Timex.Convertable',format::'Elixir.String':t()) -> {'ok','Elixir.String':t()} | {'error',term()}
web/booking/email.ex:13: Type specification 'Elixir.Booking.Email':cancellation_failed(#{}) -> any() is a supertype of the success typing: 'Elixir.Booking.Email':cancellation_failed(#{}) -> #{}
web/booking/search/location_searcher.ex:8: The call 'Elixir.DrivingDistanceCalculator':foo(3) will never return since it differs in the 1st argument from the success typing arguments: ('bar')
web/booking/search/location_searcher.ex:9: The call 'Elixir.DrivingDistanceCalculator':foo(3) will never return since it differs in the 1st argument from the success typing arguments: ('bar')
web/booking/search/location_searcher.ex:10: The call 'Elixir.DrivingDistanceCalculator':foo(6) will never return since it differs in the 1st argument from the success typing arguments: ('bar')
web/commands/cancel_booking.ex:90: Function process_refund/2 will never be called
web/jobs/send_booking_cancellation_email_job.ex:135: Function refund_amount/1 will never be called
web/jobs/send_booking_cancellation_email_job.ex:139: Function has_refund_amount/1 will never be called
web/jobs/send_booking_cancellation_email_job.ex:143: Function has_cancellation_fee/1 will never be called
web/juniper/parsing/price_parser/cost_breakdown.ex:109: Function calculate_discount_info/2 will never be called
web/juniper/parsing/price_parser/cost_breakdown.ex:118: Function calculate_discount_ratio/2 will never be called
web/juniper/parsing/price_parser/cost_breakdown.ex:133: Function do_calculate_discount_ratio/2 will never be called
web/juniper/parsing/price_parser/cost_breakdown.ex:137: Function discount_description/1 will never be called
web/juniper/parsing/price_parser/cost_breakdown.ex:138: Function show_discount/1 will never be called
web/juniper/parsing/price_parser/cost_breakdown_parser.ex:109: Function calculate_discount_info/2 will never be called
web/juniper/parsing/price_parser/cost_breakdown_parser.ex:118: Function calculate_discount_ratio/2 will never be called
web/juniper/parsing/price_parser/cost_breakdown_parser.ex:133: Function do_calculate_discount_ratio/2 will never be called
web/juniper/parsing/price_parser/cost_breakdown_parser.ex:137: Function discount_description/1 will never be called
web/juniper/parsing/price_parser/cost_breakdown_parser.ex:138: Function show_discount/1 will never be called
done in 0m3.31s
done (warnings were emitted)
Compilation finished at Thu Jun 2 09:14:12
(defun elixir-flycheck-project-root ()
(locate-dominating-file buffer-file-name "mix.exs"))
(defun elixir-flycheck-cd-option ()
(format "IEx.Helpers.cd(\"%s\")"
(elixir-flycheck-project-root)))
;; Does not work
(flycheck-define-checker elixir-dialyzer
"Erlang syntax checker based on dialyzer."
:command ("elixir" "-e" (eval (elixir-flycheck-cd-option)) "-S"
"mix" "dialyzer")
:predicate
(lambda ()
(let ((root (elixir-flycheck-project-root)))
(and
root
(buffer-file-name)
(file-exists-p (concat root "mix.exs"))
(file-exists-p (concat root ".local.plt"))
(file-exists-p (concat root "deps/dialyxir")))))
:error-patterns
((error line-start
(file-name)
":"
line
":"
(message)
line-end))
:error-filter
(lambda (errors)
(dolist (err (flycheck-sanitize-errors errors))
(setf (flycheck-error-filename err)
(concat (elixir-flycheck-project-root)
(flycheck-error-filename err))))
errors)
:modes elixir-mode)
;; Does work
(flycheck-define-checker elixir-dogma
"Defines a checker for elixir with dogma"
:command ("elixir" "-e" (eval (elixir-flycheck-cd-option)) "-S"
"mix" "dogma" "--format" "flycheck" "--stdin" source-original)
:predicate
(lambda ()
(let ((root (elixir-flycheck-project-root)))
(and
root
(buffer-file-name)
(file-exists-p (concat root "mix.exs"))
(file-exists-p (concat root "deps/dogma")))))
:standard-input t
:error-patterns
(
(info line-start (file-name) ":" line ":" column ": " (or "C" "R" "D") ": " (optional (id (one-or-more (not (any ":")))) ": ") (message) line-end)
(warning line-start (file-name) ":" line ":" column ": " (or "W" "E" "F") ": " (optional (id (one-or-more (not (any ":")))) ": ") (message) line-end))
:error-filter
(lambda (errors)
(dolist (err (flycheck-sanitize-errors errors))
(setf (flycheck-error-filename err)
(concat (elixir-flycheck-project-root)
(flycheck-error-filename err))))
errors)
:modes (elixir-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment