stolen / autohelp Goto Github PK
View Code? Open in Web Editor NEWParse_transform for erlang which adds functions help/{0,1,2} showing edoc information about module and exported functions.
License: MIT License
Parse_transform for erlang which adds functions help/{0,1,2} showing edoc information about module and exported functions.
License: MIT License
After instructing edoc to do preprocessing any files that include headers now crash the autohelp build. I've showcased the bug in a small project here From my own system:
> yes | rm -rf deps && ./rebar clean && ./rebar get-deps && ./rebar compile
==> parse_fight (clean)
==> parse_fight (get-deps)
Pulling autohelp from {git,"git://github.com/stolen/autohelp.git",
{tag,"198a908d6fca517fd9da8c9a2335fd28baaaef4b"}}
Cloning into 'autohelp'...
Pulling bson from {git,"git://github.com/mongodb/bson-erlang.git",
{tag,"17373ef4"}}
Cloning into 'bson'...
Pulling mongodb from {git,"git://github.com/mongodb/mongodb-erlang.git",
{tag,"bc41adb0"}}
Cloning into 'mongodb'...
==> autohelp (get-deps)
==> bson (get-deps)
==> mongodb (get-deps)
==> autohelp (compile)
Compiled src/autohelp.erl
Compiled src/autohelp_lib.erl
Compiled src/autohelp_demo.erl
==> bson (compile)
src/bson_binary.erl: at line 6: can't find include file "bson_binary.hrl"
autohelp: edoc:get_doc crashed with exit:error on src/bson_binary.erl
autohelp WARNING: cannot retrieve documentation from src/bson_binary.erl. Run edoc:get_doc("src/bson_binary.erl") manually to investigate problem
Compiled src/bson_binary.erl
Compiled src/bson_tests.erl
Compiled src/bson.erl
==> mongodb (compile)
Compiled src/resource_pool.erl
Compiled src/mongodb_app.erl
Compiled src/mvar.erl
Compiled src/mongo_query.erl
Compiled src/mongo_replset.erl
Compiled src/mongodb_tests.erl
Compiled src/mongo_protocol.erl
Compiled src/mongo_cursor.erl
Compiled src/mongo_connect.erl
Compiled src/mongo.erl
==> parse_fight (compile)
Compiled src/behave.erl
src/db_wrapper.erl: at line 2: can't find include lib "include/fight.hrl"
autohelp: edoc:get_doc crashed with exit:error on src/db_wrapper.erl
autohelp WARNING: cannot retrieve documentation from src/db_wrapper.erl. Run edoc:get_doc("src/db_wrapper.erl") manually to investigate problem
Compiled src/parse_fight_sup.erl
Compiled src/parse_fight_app.erl
Compiled src/db_wrapper.erl
I note that the edoc manpage for edoc:read_source/2
does discuss setting paths for include files.
I'd like to make use of autohelp in a large project. Builds crash with {undef, [{autohelp,parse_transform,...
; I've isolated this problem in a smaller project here.
I've reproduced the problem in a small project here. On my system:
> yes | rm -rf deps && ./rebar clean && ./rebar get-deps && ./rebar compile
==> parse_fight (clean)
==> parse_fight (get-deps)
Pulling autohelp from {git,"git://github.com/stolen/autohelp.git",
{tag,"a6a688a11c3e6923cb4ff7be7b06b349e3ed2cf4"}}
Cloning into 'autohelp'...
Pulling bson from {git,"git://github.com/mongodb/bson-erlang.git",
{tag,"17373ef4"}}
Cloning into 'bson'...
Pulling mongodb from {git,"git://github.com/mongodb/mongodb-erlang.git",
{tag,"bc41adb0"}}
Cloning into 'mongodb'...
==> autohelp (get-deps)
==> bson (get-deps)
==> mongodb (get-deps)
==> autohelp (compile)
Compiled src/autohelp.erl
Compiled src/autohelp_lib.erl
Compiled src/autohelp_demo.erl
==> bson (compile)
Compiled src/bson_tests.erl
Compiled src/bson.erl
Compiled src/bson_binary.erl
==> mongodb (compile)
Compiled src/resource_pool.erl
Compiled src/mvar.erl
Compiled src/mongodb_app.erl
Compiled src/mongo_query.erl
Compiled src/mongo_replset.erl
Compiled src/mongo_protocol.erl
Compiled src/mongodb_tests.erl
Compiled src/mongo_cursor.erl
Compiled src/mongo_connect.erl
Compiled src/mongo.erl
==> parse_fight (compile)
src/behave.erl:0: attribute 'export' after function definitions
src/behave.erl:0: Warning: function '__autohelp_fun_desc'/0 is unused
src/behave.erl:0: Warning: function '__autohelp_pad_text_left'/2 is unused
src/behave.erl:0: Warning: function help/0 is unused
src/behave.erl:0: Warning: function help/1 is unused
src/behave.erl:0: Warning: function help/2 is unused
ERROR: compile failed while processing /Users/blt/projects/com/rackspace/parse_fight: rebar_abort
This one is somewhat difficult to reproduce. I've updated parse_fight to showcase the issue. If I compile a project, then change the documentation and recompile the first version of the documentation is returned by help
. On my own system, I've compiled apps/parse_fight/src/db_wrapper.erl
with no inline documentation. The current commit contains edocs.
> ./rebar clean && ./rebar compile
==> autohelp (clean)
==> bson (clean)
==> mongodb (clean)
==> parse_fight (clean)
==> parse_fight (clean)
==> autohelp (compile)
Compiled src/autohelp.erl
Compiled src/autohelp_lib.erl
Compiled src/autohelp_demo.erl
==> bson (compile)
Compiled src/bson_tests.erl
Compiled src/bson.erl
Compiled src/bson_binary.erl
==> mongodb (compile)
Compiled src/resource_pool.erl
Compiled src/mvar.erl
Compiled src/mongodb_app.erl
Compiled src/mongo_query.erl
Compiled src/mongo_replset.erl
Compiled src/mongodb_tests.erl
Compiled src/mongo_protocol.erl
Compiled src/mongo_cursor.erl
Compiled src/mongo_connect.erl
Compiled src/mongo.erl
==> parse_fight (compile)
Compiled src/behave.erl
Compiled src/parse_fight_sup.erl
Compiled src/parse_fight_app.erl
Compiled src/db_wrapper.erl
==> parse_fight (compile)
> erl -boot start_sasl -pa deps/*/ebin -pa apps/*/ebin -s parse_fight_app
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]
=PROGRESS REPORT==== 4-Feb-2013::12:10:36 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.34.0>},
{name,alarm_handler},
{mfargs,{alarm_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 4-Feb-2013::12:10:36 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.35.0>},
{name,overload},
{mfargs,{overload,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 4-Feb-2013::12:10:36 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.33.0>},
{name,sasl_safe_sup},
{mfargs,
{supervisor,start_link,
[{local,sasl_safe_sup},sasl,safe]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 4-Feb-2013::12:10:36 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.36.0>},
{name,release_handler},
{mfargs,{release_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 4-Feb-2013::12:10:36 ===
application: sasl
started_at: nonode@nohost
Eshell V5.9.2 (abort with ^G)
1> db_wrapper:help(find, 2).
find(Collection, Selector)
ok
The documentation should be that as seen here.
I've found that enabling build-wide autohelp causes a syntax error. I've reproduced the problem in parse_fight. To reproduce, from the root of parse_fight
:
> ./rebar get-deps
> ./rebar compile
On my system the result is:
==> autohelp (compile)
Compiled src/autohelp.erl
Compiled src/autohelp_lib.erl
Compiled src/autohelp_demo.erl
==> bson (compile)
Compiled src/bson_tests.erl
Compiled src/bson.erl
Compiled src/bson_binary.erl
==> mongodb (compile)
Compiled src/resource_pool.erl
Compiled src/mvar.erl
Compiled src/mongodb_app.erl
Compiled src/mongo_query.erl
Compiled src/mongo_replset.erl
Compiled src/mongodb_tests.erl
Compiled src/mongo_protocol.erl
Compiled src/mongo_cursor.erl
Compiled src/mongo_connect.erl
Compiled src/mongo.erl
==> parse_fight (compile)
Compiled src/parse_fight_sup.erl
Compiled src/parse_fight_app.erl
src/db_wrapper.erl: at line 19: syntax error before: ';'
src/db_wrapper.erl:none: error in parse transform 'autohelp': error
ERROR: compile failed while processing /Users/blt/projects/com/rackspace/parse_fight: rebar_abort
If {parse_transform, autohelp}
is removed from rebar.config
the build succeeds.
Typespecs are cool. It would be good to show types defined by module and types of function arguments.
Need to decide how types should be shown.
Module's types maybe will fit after module description printed by help/0
Function arg types shouldn't be in in function header because entries like
function(Arg1::(type1|type2|long_type_name3|undefined), Arg2::integer(), ...)
are unreadable
Maybe argument types should be listed after header like in man pages
Maybe types should be shown only in special help(...)
calls (increase arity, etc.) or even in other function like help_types(...)
? Not sure.
I'd like to make use of autohelp in a large project. Builds crash with {undef, [{autohelp,parse_transform,...
; I've isolated this problem in a smaller project here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.