Emacs + Flycheck + rebar3 + proper

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Emacs + Flycheck + rebar3 + proper

Frans Schneider-2
Hi all,

In emacs while editing PropEr tests, flycheck complains about not being
able to find "proper/include/proper.hrl" which is obvious since that lib
is somewhere sitting in the _build directory and not defined in ERL_LIBS.
How do you guys configure emacs in a situation like this?
PropEr is part of the test profile in rebar3.

Thanks.

Frans
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Kostis Sagonas-2
On 11/26/2018 10:18 AM, Frans Schneider wrote:
> Hi all,
>
> In emacs while editing PropEr tests, flycheck complains about not being
> able to find "proper/include/proper.hrl" which is obvious since that lib
> is somewhere sitting in the _build directory and not defined in ERL_LIBS.
> How do you guys configure emacs in a situation like this?
> PropEr is part of the test profile in rebar3.

I have never used flycheck in emacs, and consequently I have no idea of
what is involved in its use, but why isn't ERL_LIBS set in your environment?

One of the first things that PropEr's user guide specifies is to either
set ERL_LIBS or add PropEr’s base directory to your Erlang library path
by adding an appropriate code:load_abs/1 call to your ~/.erlang file
(see https://proper-testing.github.io/userguide.html).

Can it be that this will solve your problem?

Should this be something that rebar3 does automatically when it runs or
detects PropEr tests?

Hope this helps.
Kostis
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Frans Schneider-2


On 11/26/18 7:29 PM, Kostis Sagonas wrote:

> On 11/26/2018 10:18 AM, Frans Schneider wrote:
>> Hi all,
>>
>> In emacs while editing PropEr tests, flycheck complains about not
>> being able to find "proper/include/proper.hrl" which is obvious since
>> that lib is somewhere sitting in the _build directory and not defined
>> in ERL_LIBS.
>> How do you guys configure emacs in a situation like this?
>> PropEr is part of the test profile in rebar3.
>
> I have never used flycheck in emacs, and consequently I have no idea of
> what is involved in its use, but why isn't ERL_LIBS set in your
> environment?
>
> One of the first things that PropEr's user guide specifies is to either
> set ERL_LIBS or add PropEr’s base directory to your Erlang library path
> by adding an appropriate code:load_abs/1 call to your ~/.erlang file
> (see https://proper-testing.github.io/userguide.html).
>
> Can it be that this will solve your problem?
>

Rebar3 will fetch and install PropEr per project. I used to have PropEr
installed and had ERL_LIBS point to that as you suggest, but ran into
trouble as rebar3 would install a newer version under _build.


> Should this be something that rebar3 does automatically when it runs or
> detects PropEr tests?
>

Rebar3's as test path command already knows about PropEr and that might
be useful somehow, but I have no idea how to do that.

> Hope this helps.
> Kostis
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Tristan Sloughter-4
In reply to this post by Kostis Sagonas-2
> Should this be something that rebar3 does automatically when it runs or
> detects PropEr tests?

Better to have it as a test or plugin dependency. Not much is gained by having it installed globally (technically you only compile it once for all projects but I wouldn't expect that to really matter).

Tristan
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Tristan Sloughter-4
In reply to this post by Frans Schneider-2
Is it building with rebar3? I use https://github.com/joedevivo/flycheck-rebar3

If it isn't building with rebar3 and you don't want it to then you'd need to be setting ERL_LIBS to include the libs in the _build directory.

On Mon, Nov 26, 2018, at 02:18, Frans Schneider wrote:

> Hi all,
>
> In emacs while editing PropEr tests, flycheck complains about not being
> able to find "proper/include/proper.hrl" which is obvious since that lib
> is somewhere sitting in the _build directory and not defined in ERL_LIBS.
> How do you guys configure emacs in a situation like this?
> PropEr is part of the test profile in rebar3.
>
> Thanks.
>
> Frans
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Frans Schneider-2
Yes, I use `rebar3 as test proper`, or just `rebar3 proper`, to tun the
tests. It's just while editing that it gives the error `can't find
include lib "proper/include/proper.hrl`

The flycheck-rebar3 checker doesn't help: to bad.

I am switching between projects on a regular basis, so it would be nice
if setting the ERL_LIBS path would be done auto-magically.




On 11/26/18 8:58 PM, Tristan Sloughter wrote:

> Is it building with rebar3? I use https://github.com/joedevivo/flycheck-rebar3
>
> If it isn't building with rebar3 and you don't want it to then you'd need to be setting ERL_LIBS to include the libs in the _build directory.
>
> On Mon, Nov 26, 2018, at 02:18, Frans Schneider wrote:
>> Hi all,
>>
>> In emacs while editing PropEr tests, flycheck complains about not being
>> able to find "proper/include/proper.hrl" which is obvious since that lib
>> is somewhere sitting in the _build directory and not defined in ERL_LIBS.
>> How do you guys configure emacs in a situation like this?
>> PropEr is part of the test profile in rebar3.
>>
>> Thanks.
>>
>> Frans
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Tristan Sloughter-4
Hm, I'm surprised flycheck-rebar3 doesn't fix it.

It should be compiling with rebar3 and parsing the errors from it, meaning if it builds with rebar3 in the terminal there should be no errors. Can you check the messages buffer for output? And ensure it is indeed running rebar3 when doing the check.

On Tue, Nov 27, 2018, at 02:36, Frans Schneider wrote:

> Yes, I use `rebar3 as test proper`, or just `rebar3 proper`, to tun the
> tests. It's just while editing that it gives the error `can't find
> include lib "proper/include/proper.hrl`
>
> The flycheck-rebar3 checker doesn't help: to bad.
>
> I am switching between projects on a regular basis, so it would be nice
> if setting the ERL_LIBS path would be done auto-magically.
>
>
>
>
> On 11/26/18 8:58 PM, Tristan Sloughter wrote:
> > Is it building with rebar3? I use https://github.com/joedevivo/flycheck-rebar3
> >
> > If it isn't building with rebar3 and you don't want it to then you'd need to be setting ERL_LIBS to include the libs in the _build directory.
> >
> > On Mon, Nov 26, 2018, at 02:18, Frans Schneider wrote:
> >> Hi all,
> >>
> >> In emacs while editing PropEr tests, flycheck complains about not being
> >> able to find "proper/include/proper.hrl" which is obvious since that lib
> >> is somewhere sitting in the _build directory and not defined in ERL_LIBS.
> >> How do you guys configure emacs in a situation like this?
> >> PropEr is part of the test profile in rebar3.
> >>
> >> Thanks.
> >>
> >> Frans
> >> _______________________________________________
> >> erlang-questions mailing list
> >> [hidden email]
> >> http://erlang.org/mailman/listinfo/erlang-questions
> > _______________________________________________
> > erlang-questions mailing list
> > [hidden email]
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Frans Schneider-2
Sorry for the late reply.

Still having trouble. After cleaning out the mess in my Emacs setup, I
did the following:

- installed flycheck (version 31) from melpa
- installed flycheck-rebar3 (version 1.1.0) also from melpa
- check flycheck compile (C-c ! C-c) gives no errors with the output:

   rebar3 compile
   ===> Verifying dependencies...
   ===> Compiling myapp

   Compilation finished at Thu Nov 29 10:23:32

- introducing an error in the rebar.conf file and editing an Erlang
file, tells me flycheck does use the erlang-rebar3 checker with the
following error:

   Suspicious state from syntax checker erlang-rebar3...

So I guess the setup is correct.
Any more suggestions?

Frans


On 11/27/18 3:29 PM, Tristan Sloughter wrote:

> Hm, I'm surprised flycheck-rebar3 doesn't fix it.
>
> It should be compiling with rebar3 and parsing the errors from it, meaning if it builds with rebar3 in the terminal there should be no errors. Can you check the messages buffer for output? And ensure it is indeed running rebar3 when doing the check.
>
> On Tue, Nov 27, 2018, at 02:36, Frans Schneider wrote:
>> Yes, I use `rebar3 as test proper`, or just `rebar3 proper`, to tun the
>> tests. It's just while editing that it gives the error `can't find
>> include lib "proper/include/proper.hrl`
>>
>> The flycheck-rebar3 checker doesn't help: to bad.
>>
>> I am switching between projects on a regular basis, so it would be nice
>> if setting the ERL_LIBS path would be done auto-magically.
>>
>>
>>
>>
>> On 11/26/18 8:58 PM, Tristan Sloughter wrote:
>>> Is it building with rebar3? I use https://github.com/joedevivo/flycheck-rebar3
>>>
>>> If it isn't building with rebar3 and you don't want it to then you'd need to be setting ERL_LIBS to include the libs in the _build directory.
>>>
>>> On Mon, Nov 26, 2018, at 02:18, Frans Schneider wrote:
>>>> Hi all,
>>>>
>>>> In emacs while editing PropEr tests, flycheck complains about not being
>>>> able to find "proper/include/proper.hrl" which is obvious since that lib
>>>> is somewhere sitting in the _build directory and not defined in ERL_LIBS.
>>>> How do you guys configure emacs in a situation like this?
>>>> PropEr is part of the test profile in rebar3.
>>>>
>>>> Thanks.
>>>>
>>>> Frans
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> [hidden email]
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>> _______________________________________________
>>> erlang-questions mailing list
>>> [hidden email]
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Tristan Sloughter-4
Damn, weird, it has to be getting that error from somewhere and if it isn't from the flycheck compile there must be another checker running that returns it.

Not sure where to go from here though :(

On Thu, Nov 29, 2018, at 02:43, Frans Schneider wrote:

> Sorry for the late reply.
>
> Still having trouble. After cleaning out the mess in my Emacs setup, I
> did the following:
>
> - installed flycheck (version 31) from melpa
> - installed flycheck-rebar3 (version 1.1.0) also from melpa
> - check flycheck compile (C-c ! C-c) gives no errors with the output:
>
>    rebar3 compile
>    ===> Verifying dependencies...
>    ===> Compiling myapp
>
>    Compilation finished at Thu Nov 29 10:23:32
>
> - introducing an error in the rebar.conf file and editing an Erlang
> file, tells me flycheck does use the erlang-rebar3 checker with the
> following error:
>
>    Suspicious state from syntax checker erlang-rebar3...
>
> So I guess the setup is correct.
> Any more suggestions?
>
> Frans
>
>
> On 11/27/18 3:29 PM, Tristan Sloughter wrote:
> > Hm, I'm surprised flycheck-rebar3 doesn't fix it.
> >
> > It should be compiling with rebar3 and parsing the errors from it, meaning if it builds with rebar3 in the terminal there should be no errors. Can you check the messages buffer for output? And ensure it is indeed running rebar3 when doing the check.
> >
> > On Tue, Nov 27, 2018, at 02:36, Frans Schneider wrote:
> >> Yes, I use `rebar3 as test proper`, or just `rebar3 proper`, to tun the
> >> tests. It's just while editing that it gives the error `can't find
> >> include lib "proper/include/proper.hrl`
> >>
> >> The flycheck-rebar3 checker doesn't help: to bad.
> >>
> >> I am switching between projects on a regular basis, so it would be nice
> >> if setting the ERL_LIBS path would be done auto-magically.
> >>
> >>
> >>
> >>
> >> On 11/26/18 8:58 PM, Tristan Sloughter wrote:
> >>> Is it building with rebar3? I use https://github.com/joedevivo/flycheck-rebar3
> >>>
> >>> If it isn't building with rebar3 and you don't want it to then you'd need to be setting ERL_LIBS to include the libs in the _build directory.
> >>>
> >>> On Mon, Nov 26, 2018, at 02:18, Frans Schneider wrote:
> >>>> Hi all,
> >>>>
> >>>> In emacs while editing PropEr tests, flycheck complains about not being
> >>>> able to find "proper/include/proper.hrl" which is obvious since that lib
> >>>> is somewhere sitting in the _build directory and not defined in ERL_LIBS.
> >>>> How do you guys configure emacs in a situation like this?
> >>>> PropEr is part of the test profile in rebar3.
> >>>>
> >>>> Thanks.
> >>>>
> >>>> Frans
> >>>> _______________________________________________
> >>>> erlang-questions mailing list
> >>>> [hidden email]
> >>>> http://erlang.org/mailman/listinfo/erlang-questions
> >>> _______________________________________________
> >>> erlang-questions mailing list
> >>> [hidden email]
> >>> http://erlang.org/mailman/listinfo/erlang-questions
> >>>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Emacs + Flycheck + rebar3 + proper

Frans Schneider-2
I think you are right about another checker running. Using the flycheck
verify setup command (C-c ! v), both the erlang-rebar3 and erlang
checkers show up, both being enabled.

   Syntax checkers for buffer prop_basics.erl in erlang-mode:

     erlang-rebar3
       - may enable: yes
       - predicate:  t
       - executable: Found at /home/frans/.cache/rebar3/bin/rebar3

     erlang
       - may enable: yes
       - executable: Found at /usr/lib/erlang/bin/erlc

   Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
   checkers.

Disabling the erlang checker with Cc ! x makes the error disappear, BUT
with it all other syntax errors which is not a good thing.

Could somebody please check if this is a bug or has to do with my local
setup?

Frans


On 11/29/18 4:33 PM, Tristan Sloughter wrote:

> Damn, weird, it has to be getting that error from somewhere and if it isn't from the flycheck compile there must be another checker running that returns it.
>
> Not sure where to go from here though :(
>
> On Thu, Nov 29, 2018, at 02:43, Frans Schneider wrote:
>> Sorry for the late reply.
>>
>> Still having trouble. After cleaning out the mess in my Emacs setup, I
>> did the following:
>>
>> - installed flycheck (version 31) from melpa
>> - installed flycheck-rebar3 (version 1.1.0) also from melpa
>> - check flycheck compile (C-c ! C-c) gives no errors with the output:
>>
>>     rebar3 compile
>>     ===> Verifying dependencies...
>>     ===> Compiling myapp
>>
>>     Compilation finished at Thu Nov 29 10:23:32
>>
>> - introducing an error in the rebar.conf file and editing an Erlang
>> file, tells me flycheck does use the erlang-rebar3 checker with the
>> following error:
>>
>>     Suspicious state from syntax checker erlang-rebar3...
>>
>> So I guess the setup is correct.
>> Any more suggestions?
>>
>> Frans
>>
>>
>> On 11/27/18 3:29 PM, Tristan Sloughter wrote:
>>> Hm, I'm surprised flycheck-rebar3 doesn't fix it.
>>>
>>> It should be compiling with rebar3 and parsing the errors from it, meaning if it builds with rebar3 in the terminal there should be no errors. Can you check the messages buffer for output? And ensure it is indeed running rebar3 when doing the check.
>>>
>>> On Tue, Nov 27, 2018, at 02:36, Frans Schneider wrote:
>>>> Yes, I use `rebar3 as test proper`, or just `rebar3 proper`, to tun the
>>>> tests. It's just while editing that it gives the error `can't find
>>>> include lib "proper/include/proper.hrl`
>>>>
>>>> The flycheck-rebar3 checker doesn't help: to bad.
>>>>
>>>> I am switching between projects on a regular basis, so it would be nice
>>>> if setting the ERL_LIBS path would be done auto-magically.
>>>>
>>>>
>>>>
>>>>
>>>> On 11/26/18 8:58 PM, Tristan Sloughter wrote:
>>>>> Is it building with rebar3? I use https://github.com/joedevivo/flycheck-rebar3
>>>>>
>>>>> If it isn't building with rebar3 and you don't want it to then you'd need to be setting ERL_LIBS to include the libs in the _build directory.
>>>>>
>>>>> On Mon, Nov 26, 2018, at 02:18, Frans Schneider wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> In emacs while editing PropEr tests, flycheck complains about not being
>>>>>> able to find "proper/include/proper.hrl" which is obvious since that lib
>>>>>> is somewhere sitting in the _build directory and not defined in ERL_LIBS.
>>>>>> How do you guys configure emacs in a situation like this?
>>>>>> PropEr is part of the test profile in rebar3.
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> Frans
>>>>>> _______________________________________________
>>>>>> erlang-questions mailing list
>>>>>> [hidden email]
>>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>> _______________________________________________
>>>>> erlang-questions mailing list
>>>>> [hidden email]
>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions