ignatov / intellij-erlang

Erlang IDE
https://www.jetbrains.com/help/idea/2018.2/getting-started-with-erlang.html
Other
735 stars 120 forks source link

dialyzer warnings are not being reported #406

Open Andy-Richards opened 10 years ago

Andy-Richards commented 10 years ago

Please see the sample project here https://github.com/Andy-Richards/inc_test

After checking File -> Settings -> Inspections -> Erlang -> Dialyzer based inspections and also setting the path to my plt path under File -> Settings -> Erlang External tools running Analyse -> Inspect Code does not show any dialyzer warnings. I have deliberately added a incorrect spec here https://github.com/Andy-Richards/inc_test/blob/master/apps/inc_test/src/inc_test.erl#L15 which should be reported by dialyzer?

Also is it possible to pass additional flags to dialyzer as you would on the command line i.e dialyzer apps/*/ebin -Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspecs

Many thanks,

Andy.

ignatov commented 10 years ago

Hi @Andy-Richards. Dialyzer annotator works only on files without errors (IntelliJ platform limitation, can be removed in the feature). Also please verify that the Erlang SDK specified correctly.

ignatov commented 10 years ago

Please try the https://github.com/ignatov/intellij-erlang/releases/tag/%23481 There are some enhancements for better understanding how the dialyzer integration works. First, not we catch messages starts with dialyzer: and show them in the Event log. Second, all output stream available in log file with severity debug. So, if you have some issues with this inspection, please change your log level to debug and attach the log file.

Andy-Richards commented 10 years ago

Hi, Ive tried this build but with no joy I'm afraid. I wonder if its because of the rebar project layout i use which I understand intellij doesn't really support (see #405). I can no longer see file-> settings->erlang -> external tools to configure my .plt file, has this moved? Anyhow nothing appears in my Event Log. I'm not sure what you mean by "catch messages starts with dialyzer:"? heres my Dialyzer output from the command line...

dialyzer apps/*/ebin -Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspecs
  Checking whether the PLT /home/andy/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
inc_test.erl:14: Invalid type specification for function inc_test:test3/0. The success typing is () -> 'ok'
inc_test.erl:15: Function test3/0 will never be called
 done in 0m8.30s
done (warnings were emitted)

Also which log would you like me to attach and where do I change the log level?

Thanks

deadok22 commented 10 years ago

@Andy-Richards, you can set a log level to debug in the end of log.xml located under bin/ in your IntelliJ install directory. Make sure the priority value is set to DEBUG

  <root>
    <priority value="INFO"/>
    <appender-ref ref="DIALOG"/>
    <appender-ref ref="CONSOLE-WARN"/>
    <appender-ref ref="FILE"/>
  </root>

Logger's output can be found under "Help" -> "Show Log in Files"

Andy-Richards commented 10 years ago

I can no longer import the Rebar project with 481 build, I see the same exception i've reported on issue #401

Thanks,

Andy.

Andy-Richards commented 10 years ago

Ok still no dialyzer warnings (i've removed all build errors, only invalid specs remain) using build 481 when used with the EAP of IDEA 13 (as per issue #401). Please see debug log...

https://gist.github.com/Andy-Richards/8439058

... when opening the inc_test project and running inspections.

dsabanin commented 10 years ago

I'm seeing similar thing - dialyzer warnings not shown. Event log shows "dialyzer: Analysis failed with error:" and that's it.

I enabled DEBUG mode and it showed:

2014-06-26 11:23:26,153 [ 695364]  DEBUG - figurations.GeneralCommandLine - Executing [/usr/local/Cellar/erlang/R17/bin/dialyzer --plt /Users/dsabanin/.dialyzer_plt /Users/dsabanin/bsci/src/bsci_ci.erl] 
2014-06-26 11:23:34,627 [ 703838]  DEBUG - rlangDialyzerExternalAnnotator -   Checking whether the PLT /Users/dsabanin/.dialyzer_plt is up-to-date... yes 
2014-06-26 11:23:34,627 [ 703838]  DEBUG - rlangDialyzerExternalAnnotator -  
2014-06-26 11:23:34,627 [ 703838]  DEBUG - rlangDialyzerExternalAnnotator -   Proceeding with analysis... 
2014-06-26 11:23:34,627 [ 703838]  DEBUG - rlangDialyzerExternalAnnotator -  
2014-06-26 11:23:34,627 [ 703838]  DEBUG - rlangDialyzerExternalAnnotator - dialyzer: Analysis failed with error: 

And that's it, after that – unrelated messages. I tried running the dialyzer command from log file manually and here's the output:

  Checking whether the PLT /Users/dsabanin/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
dialyzer: Analysis failed with error:
Could not scan the following file(s):
/Users/dsabanin/bsci/src/bsci_ci.erl:13: can't find include file "emysql.hrl"

Last messages in the log cache:
  Reading files and computing callgraph... 

Project was imported from rebar from scratch, the dependencies exist. Main module I'm editing (bsci), has include directories "deps/emysql/include" and "deps/amqp_client/include", but they are not included in the dialyzer call, maybe that's the problem here?

Thanks for your time and for the awesome plugin.