Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if OTP compiled without doc chunks #751

Closed
ajayvigneshk opened this issue Apr 5, 2022 · 4 comments
Closed

Warn if OTP compiled without doc chunks #751

ajayvigneshk opened this issue Apr 5, 2022 · 4 comments

Comments

@ajayvigneshk
Copy link
Contributor

ajayvigneshk commented Apr 5, 2022

I currently use a Mac M1 machine with

erlang: 24.2
elixir: 1.13.3-otp-24

When I run mix test I get failures on sections(mostly) like

if ExUnitConfig.erlang_eep48_supported() do
  # Some doc assertion here
end
Full failure log
==> jason
Compiling 10 files (.ex)
Generated jason app
==> excoveralls
Compiling 28 files (.ex)
Generated excoveralls app
==> elixir_sense
Compiling 82 files (.ex)
Generated elixir_sense app
Excluding tags: [requires_source: true, edoc_fallback: true]

........................................................................

  1) test erlang module (ElixirSense.Core.Normalized.CodeTest)
     test/elixir_sense/core/normalized/code_test.exs:93
     Expected truthy, got false
     code: assert is_list(Code.get_docs(:lists, :docs))
     arguments:

         # 1
         nil

     stacktrace:
       test/elixir_sense/core/normalized/code_test.exs:95: (test)

....................

  2) test get_callbacks_with_docs for erlang behaviours (ElixirSense.Core.IntrospectionTest)
     test/elixir_sense/core/introspection_test.exs:70
     match (=) failed
     code:  assert "- CallbackMode = " <> _ = summary
     left:  "- CallbackMode = " <> _
     right: nil
     stacktrace:
       test/elixir_sense/core/introspection_test.exs:84: (test)

...........................................................................................................................................................................................................................................

  3) test docs retrieve erlang type documentation (ElixirSense.DocsTest)
     test/elixir_sense/docs_test.exs:805
     Assertion with =~ failed
     code:  assert docs =~ "Supported time unit representations:\n"
     left:  "> :erlang.time_unit()\n\n### Specs\n\n```\n@type time_unit() ::\n  pos_integer()\n  | :second\n  | :millisecond\n  | :microsecond\n  | :nanosecond\n  | :native\n  | :perf_counter\n  | deprecated_time_unit()\n```\n\n\n"
     right: "Supported time unit representations:\n"
     stacktrace:
       test/elixir_sense/docs_test.exs:842: (test)

........................................

  4) test docs retrieve documentation from erlang modules (ElixirSense.DocsTest)
     test/elixir_sense/docs_test.exs:468
     Assertion with =~ failed
     code:  assert docs =~ "By convention,"
     left:  "> :erlang\n\nNo documentation available\n"
     right: "By convention,"
     stacktrace:
       test/elixir_sense/docs_test.exs:489: (test)

..................................../Users/ajayvigneshk/.asdf/installs/erlang/24.2/lib/stdlib-3.17/src/gen_statem.erl: at line 22: can't find include file "logger.hrl"
docsh error: error
[{edoc,'-check_forms/3-fun-0-',3,[{file,"edoc.erl"},{line,771}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1342}]},
 {edoc,read_source,2,[{file,"edoc.erl"},{line,640}]},
 {edoc_extract,source,3,[{file,"edoc_extract.erl"},{line,60}]},
 {docsh_edoc,to_internal,2,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_edoc.erl"},
      {line,43}]},
 {docsh_lib,convert_one,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,42}]},
 {lists,flatmap,2,[{file,"lists.erl"},{line,1254}]},
 {docsh_lib,convert,3,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,37}]},
 {docsh_lib,make_docs,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,273}]},
 {docsh_lib,dispatch_docs_extraction_,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,253}]},
 {'Elixir.ElixirSense.Core.EdocReader',lookup,2,
     [{file,"lib/elixir_sense/core/edoc_reader.ex"},{line,39}]},
 {'Elixir.ElixirSense.Core.Introspection',get_docs_md,1,
     [{file,"lib/elixir_sense/core/introspection.ex"},{line,364}]},
 {'Elixir.ElixirSense.Core.Introspection',get_all_docs,2,
     [{file,"lib/elixir_sense/core/introspection.ex"},{line,119}]},
 {'Elixir.ElixirSense.Providers.Docs',all,4,
     [{file,"lib/elixir_sense/providers/docs.ex"},{line,37}]},
 {'Elixir.ElixirSense',docs,3,[{file,"lib/elixir_sense.ex"},{line,63}]},
 {'Elixir.ElixirSense.DocsTest',
     'test docs retrieve fallback callback information from erlang modules',1,
     [{file,"test/elixir_sense/docs_test.exs"},{line,626}]},
 {'Elixir.ExUnit.Runner',exec_test,1,
     [{file,"lib/ex_unit/runner.ex"},{line,500}]},
 {timer,tc,1,[{file,"timer.erl"},{line,166}]},
 {'Elixir.ExUnit.Runner','-spawn_test_monitor/4-fun-1-',4,
     [{file,"lib/ex_unit/runner.ex"},{line,451}]}]

.........................../Users/ajayvigneshk/.asdf/installs/erlang/24.2/lib/stdlib-3.17/src/gen_statem.erl: at line 22: can't find include file "logger.hrl"
docsh error: error
[{edoc,'-check_forms/3-fun-0-',3,[{file,"edoc.erl"},{line,771}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1342}]},
 {edoc,read_source,2,[{file,"edoc.erl"},{line,640}]},
 {edoc_extract,source,3,[{file,"edoc_extract.erl"},{line,60}]},
 {docsh_edoc,to_internal,2,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_edoc.erl"},
      {line,43}]},
 {docsh_lib,convert_one,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,42}]},
 {lists,flatmap,2,[{file,"lists.erl"},{line,1254}]},
 {docsh_lib,convert,3,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,37}]},
 {docsh_lib,make_docs,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,273}]},
 {docsh_lib,dispatch_docs_extraction_,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,253}]},
 {'Elixir.ElixirSense.Core.EdocReader',lookup,2,
     [{file,"lib/elixir_sense/core/edoc_reader.ex"},{line,39}]},
 {'Elixir.ElixirSense.Core.Introspection',get_types_with_docs,1,
     [{file,"lib/elixir_sense/core/introspection.ex"},{line,603}]},
 {'Elixir.ElixirSense.Core.Introspection',get_types_md,1,
     [{file,"lib/elixir_sense/core/introspection.ex"},{line,518}]},
 {'Elixir.ElixirSense.Core.Introspection',get_all_docs,2,
     [{file,"lib/elixir_sense/core/introspection.ex"},{line,119}]},
 {'Elixir.ElixirSense.Providers.Docs',all,4,
     [{file,"lib/elixir_sense/providers/docs.ex"},{line,37}]},
 {'Elixir.ElixirSense',docs,3,[{file,"lib/elixir_sense.ex"},{line,63}]},
 {'Elixir.ElixirSense.DocsTest',
     'test docs retrieve fallback callback information from erlang modules',1,
     [{file,"test/elixir_sense/docs_test.exs"},{line,626}]},
 {'Elixir.ExUnit.Runner',exec_test,1,
     [{file,"lib/ex_unit/runner.ex"},{line,500}]},
 {timer,tc,1,[{file,"timer.erl"},{line,166}]},
 {'Elixir.ExUnit.Runner','-spawn_test_monitor/4-fun-1-',4,
     [{file,"lib/ex_unit/runner.ex"},{line,451}]}]

...............

  5) test function signature find :erlang module functions with different forms of typespecs (ElixirSense.SignatureTest)
     test/elixir_sense/signature_test.exs:1009
     match (=) failed
     code:  assert "Returns the current date as" <> _ = summary
     left:  "Returns the current date as" <> _
     right: ""
     stacktrace:
       test/elixir_sense/signature_test.exs:1033: (test)

..................................

  6) test function signature find signatures from erlang module (ElixirSense.SignatureTest)
     test/elixir_sense/signature_test.exs:287
     match (=) failed
     code:  assert "Returns a flattened version of `DeepList`\\." <> _ = summary1
     left:  "Returns a flattened version of `DeepList`\\" <> _
     right: ""
     stacktrace:
       test/elixir_sense/signature_test.exs:316: (test)

................................

  7) test function signature finds signatures from metadata erlang behaviour call (ElixirSense.SignatureTest)
     test/elixir_sense/signature_test.exs:788
     match (=) failed
     code:  assert "- Args = term\\(\\)\n- Result" <> _ = summary
     left:  "- Args = term\\(\\)\n- Res" <> _
     right: ""
     stacktrace:
       test/elixir_sense/signature_test.exs:819: (test)

....................................................

  8) test type signature find type signatures from erlang module (ElixirSense.SignatureTest)
     test/elixir_sense/signature_test.exs:170
     match (=) failed
     code:  assert "Supported time unit representations:" <> _ = summary
     left:  "Supported time unit representations:" <> _
     right: ""
     stacktrace:
       test/elixir_sense/signature_test.exs:191: (test)

...............................................

  9) test docs retrieve erlang function documentation (ElixirSense.DocsTest)
     test/elixir_sense/docs_test.exs:180
     Assertion with =~ failed
     code:  assert docs =~ "Returns a flattened version of `DeepList`\\.\n"
     left:  "> :lists.flatten(deepList)\n\n### Specs\n\n```\n@spec flatten(deepList) :: list when deepList: [term | deepList], list: [term]\n```\n\nNo documentation available\n\n\n---\n\n> :lists.flatten(deepList, tail)\n\n### Specs\n\n```\n@spec flatten(deepList, tail) :: list when deepList: [term | deepList], tail: [term], list: [term]\n```\n\nNo documentation available\n\n"
     right: "Returns a flattened version of `DeepList`\\.\n"
     stacktrace:
       test/elixir_sense/docs_test.exs:209: (test)



 10) test do not crash for erlang behaviour callbacks (ElixirSense.DocsTest)
     test/elixir_sense/docs_test.exs:1144
     Assertion with =~ failed
     code:  assert docs =~
              "> ElixirSenseExample.ExampleBehaviourWithDocCallbackErlang.init(term)\n\n**Since**\nOTP 19.0\n"
     left:  "> ElixirSenseExample.ExampleBehaviourWithDocCallbackErlang.init(_)\n\n\n"
     right: "> ElixirSenseExample.ExampleBehaviourWithDocCallbackErlang.init(term)\n\n**Since**\nOTP 19.0\n"
     stacktrace:
       test/elixir_sense/docs_test.exs:1162: (test)

.....................................................................................warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
  nofile:1:6

warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
  nofile:1:6

.warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
  nofile:1:6

warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
  nofile:1:6

.........................

 11) test lists erlang callbacks (ElixirSense.SuggestionsTest)
     test/elixir_sense/suggestions_test.exs:472
     match (=) failed
     code:  assert "- OldVsn = Vsn" <> _ = summary
     left:  "- OldVsn = Vsn" <> _
     right: ""
     stacktrace:
       test/elixir_sense/suggestions_test.exs:498: (test)

.........../Users/ajayvigneshk/.asdf/installs/erlang/24.2/lib/stdlib-3.17/src/gen_server.erl: at line 121: can't find include file "logger.hrl"
docsh error: error
[{edoc,'-check_forms/3-fun-0-',3,[{file,"edoc.erl"},{line,771}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1342}]},
 {edoc,read_source,2,[{file,"edoc.erl"},{line,640}]},
 {edoc_extract,source,3,[{file,"edoc_extract.erl"},{line,60}]},
 {docsh_edoc,to_internal,2,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_edoc.erl"},
      {line,43}]},
 {docsh_lib,convert_one,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,42}]},
 {lists,flatmap,2,[{file,"lists.erl"},{line,1254}]},
 {docsh_lib,convert,3,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,37}]},
 {docsh_lib,make_docs,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,273}]},
 {docsh_lib,dispatch_docs_extraction_,1,
     [{file,
          "/Users/ajayvigneshk/personal/projects/elixir_sense/deps/docsh/src/docsh_lib.erl"},
      {line,253}]},
 {'Elixir.ElixirSense.Core.EdocReader',lookup,2,
     [{file,"lib/elixir_sense/core/edoc_reader.ex"},{line,39}]},
 {'Elixir.ElixirSense.Providers.Suggestion.Complete',get_edocs,1,
     [{file,"lib/elixir_sense/providers/suggestion/complete.ex"},{line,719}]},
 {'Elixir.ElixirSense.Providers.Suggestion.Complete',get_module_funs,2,
     [{file,"lib/elixir_sense/providers/suggestion/complete.ex"},{line,669}]},
 {'Elixir.ElixirSense.Providers.Suggestion.Complete',match_module_funs,5,
     [{file,"lib/elixir_sense/providers/suggestion/complete.ex"},{line,536}]},
 {'Elixir.ElixirSense.Providers.Suggestion.Complete',expand_require,4,
     [{file,"lib/elixir_sense/providers/suggestion/complete.ex"},{line,277}]},
 {'Elixir.ElixirSense.Providers.Suggestion.CompleteTest',
     'test complete build in behaviour functions',1,
     [{file,"test/elixir_sense/providers/suggestion/complete_test.exs"},
      {line,1347}]},
 {'Elixir.ExUnit.Runner',exec_test,1,
     [{file,"lib/ex_unit/runner.ex"},{line,500}]},
 {timer,tc,1,[{file,"timer.erl"},{line,166}]},
 {'Elixir.ExUnit.Runner','-spawn_test_monitor/4-fun-1-',4,
     [{file,"lib/ex_unit/runner.ex"},{line,451}]}]

..

 12) test erlang module completion (ElixirSense.Providers.Suggestion.CompleteTest)
     test/elixir_sense/providers/suggestion/complete_test.exs:31
     match (=) failed
     code:  assert "This module provides an API for the zlib library" <> _ = summary
     left:  "This module provides an API for the zlib library" <> _
     right: ""
     stacktrace:
       test/elixir_sense/providers/suggestion/complete_test.exs:43: (test)

.......

 13) test provide doc and specs for erlang functions (ElixirSense.Providers.Suggestion.CompleteTest)
     test/elixir_sense/providers/suggestion/complete_test.exs:1497
     match (=) failed
     code:  assert "Cancels a timer\\." <> _ = summary1
     left:  "Cancels a timer\\" <> _
     right: ""
     stacktrace:
       test/elixir_sense/providers/suggestion/complete_test.exs:1530: (test)

.......................

 14) test suggestions for typespecs erlang types (ElixirSense.SuggestionsTest)
     test/elixir_sense/suggestions_test.exs:3117
     match (=) failed
     code:  assert "Supported time unit representations:" <> _ = summary
     left:  "Supported time unit representations:" <> _
     right: ""
     stacktrace:
       test/elixir_sense/suggestions_test.exs:3136: (test)

................................

 15) test lists callbacks in function suggestion - erlang behaviour (ElixirSense.SuggestionsTest)
     test/elixir_sense/suggestions_test.exs:847
     match (=) failed
     code:  assert "- Args = term" <> _ = summary
     left:  "- Args = term" <> _
     right: ""
     stacktrace:
       test/elixir_sense/suggestions_test.exs:875: (test)

........................................

 16) test suggestion for param options remote erlang type with doc (ElixirSense.SuggestionsTest)
     test/elixir_sense/suggestions_test.exs:2812
     Assertion with =~ failed
     code:  assert suggestion.doc =~ "Supported time unit representations"
     left:  ""
     right: "Supported time unit representations"
     stacktrace:
       test/elixir_sense/suggestions_test.exs:2825: (test)

...................................................................................

Finished in 16.4 seconds (15.7s async, 0.7s sync)
28 doctests, 922 tests, 16 failures, 15 excluded

Randomized with seed 863139

Is there something I'm missing in setup / configuration? If this is expected is there a easy way to run tests locally?

@lukaszsamson
Copy link
Collaborator

@ajayvigneshk can you include error log?

@ajayvigneshk
Copy link
Contributor Author

@lukaszsamson I've it posted on the original post in an expandable section ("full failure log")

@lexun
Copy link

lexun commented May 11, 2022

As another data point, I'm getting the exact same failures on an intel mac with elixir 1.13.4-otp-24 and erlang 24.3.4.

@lukaszsamson
Copy link
Collaborator

@lukaszsamson I've it posted on the original post in an expandable section ("full failure log")

Sorry, I didn't notice it.

It looks like the OTP installation is missing EIP 48 documentation chunks. I don't know about other means but if you are building OTP from the source (e.g. with asdf/kerl) you need to set environment variable KERL_BUILD_DOCS=yes (see https://github.com/kerl/kerl#usage).

On the elixir_sense side it may be worth to raise warning in that case.

@lukaszsamson lukaszsamson changed the title Running tests locally fails Warn if OTP compiled without doc chunks Aug 16, 2022
@lukaszsamson lukaszsamson transferred this issue from elixir-lsp/elixir_sense Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants