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

Added new feature to rebar xref to allow execution of custom queries. #199

Closed
wants to merge 2 commits into from
Closed

Added new feature to rebar xref to allow execution of custom queries. #199

wants to merge 2 commits into from

Conversation

xcurry
Copy link
Contributor

@xcurry xcurry commented Mar 7, 2012

The custom queries can be enabled in addition to xref_checks.
The new queries can be added to rebar.config via the tuple
{xref_queries, [{query(), query_result()},...]}. It will
exit with error if the result of running a particular query()
does not give the query_result(). For example:

{xref_queries, [{"(XC - UC) || (XU - X - B - (\"ejabberd_logger\":\".*_msg\"/\"4\"))",[]}]}.

@etnt
Copy link

etnt commented Mar 8, 2012

Cool! However, I'm missing an update of the rebar.config.sample file, which documents available parameter. Would be nice with a proper documentation on the XC,UC, etc stuff so that people can understand what they do without having to look trough the source.

@xcurry
Copy link
Contributor Author

xcurry commented Mar 12, 2012

Hmmm...not sure why I did not receive a notification for the comment by etnt (will check). To respond, the XC, UC etc. are documented by xref manual so I am not sure it is good idea to document it here again. However I think you are right that I should also modify rebar.config.sample file at least explaining the new parameters and also providing where they can read further on custom queries. Would that be okay?

@xcurry
Copy link
Contributor Author

xcurry commented Mar 13, 2012

I have updated the branch tree (btw, I did a squash to make it a single commit...hope that is okay). I also used the patch to get rid of xref_warning in rebar itself.

@etnt
Copy link

etnt commented Mar 13, 2012

Great!

@ghost
Copy link

ghost commented Apr 1, 2012

Looks good to me. @dizzyd @joewilliams?

The custom queries are configured in rebar.config via the tuple
{xref_queries, [{query(), query_result()},...]}.  The implementation
passes the query() string to xref:q and compares the return value with
query_result(). It will result in an error if they do not match.

The following configuration, for example, is the same as running the
xref check undefined_function_calls. It additionally filters
ejabberd_logger:*_msg/4 from the result as these functions are generated
on execution by ejabberd and not available at compile time.

{xref_queries, [{"(XC - UC) || (XU - X - B -
                 (\"ejabberd_logger\":\".*_msg\"/\"4\"))",[]}]}.

This patch also modifies the build process of this package by running a
custom query instead of doing a diff against a static xref_warning file.
@dizzyd
Copy link
Contributor

dizzyd commented Apr 2, 2012

Seems reasonable.

@ghost
Copy link

ghost commented Apr 2, 2012

Thanks, merged.

@ghost ghost closed this Apr 2, 2012
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants