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

bears/haskell: Add GhcModBear for syntax checking #1267

Merged
merged 1 commit into from
Jan 15, 2017

Conversation

vijeth-aradhya
Copy link
Member

@vijeth-aradhya vijeth-aradhya commented Jan 6, 2017

Add a new bear in Haskell, namely GhcModBear for syntax checking.

Closes #297

@gitmate-bot
Copy link
Collaborator

Thanks for your contribution!

Reviewing pull requests take really a lot of time and we're all volunteers. Please make sure you go through the following check list and complete them all before pinging someone for a review.

As you learn things over your Pull Request please help others on the chat and on PRs to get their stuff right as well!

@Makman2
Copy link
Member

Makman2 commented Jan 6, 2017

alright there's a reason behind the travis error. You should try to pull our docker container and execute tests with and without your changes there, and see what's happening 👍

@vijeth-aradhya
Copy link
Member Author

@Makman2 Is it because of my changes? I see this error in other pull requests as well :/
And, what's the reason probably?

@vijeth-aradhya
Copy link
Member Author

@Makman2 And, I'm not sure how to use docker container for carrying out the tests. :/

@Makman2
Copy link
Member

Makman2 commented Jan 6, 2017

Actually I can't believe your changes are causing this, though they reoccur, so let's eliminate the probability that your code is the cause^^

Docker is some kind of a leightweight VM:

  1. Install Docker
  2. docker pull coala/base
  3. docker run -it coala/base bash

You get an interactive shell there. Then you clone coala and checkout your branch, install your new requirements, and execute tests -> py.test.

r'(?P<message>.+)')
class GhcModBear:
"""
Syntax checking with ghc for Haskell files.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think "ghc" should be enclosed in double backticks

@aptrishu
Copy link
Member

aptrishu commented Jan 8, 2017

Ah some problem with LanguageToolBear and InferBear.. It's just travis' problem.


@staticmethod
def create_arguments(filename, file, config_file):
return '-b', '. ', 'check', filename
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the '. ' for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put a comment in the code please? otherwise people will just remove it. Also do we have a test that would fail if this isn't given?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll add a comment saying that :)
No, there is no test as such.

@sils
Copy link
Member

sils commented Jan 12, 2017

code and tests look really proper, just that -b arg seems weird, waiting for response

@vijeth-aradhya
Copy link
Member Author

vijeth-aradhya commented Jan 12, 2017

The -b argument is to specify a separator for the messages as we have discussed. ( You can have a look at the asciinema for usage of . :) )
I had filed the issue here.

@vijeth-aradhya
Copy link
Member Author

vijeth-aradhya commented Jan 12, 2017

I have added the comment :)
No, there are no tests currently for . (for separation of messages).

@vijeth-aradhya
Copy link
Member Author

vijeth-aradhya commented Jan 13, 2017

I have modified a testcase to check for the . separator as discussed, but IMHO we should not check for exact error messages like that because different versions of ghc have slightly different error messages. (like in some versions it was `3' instead of ‘3’)
I'm pretty sure they won't remove it after putting a comment there ^

Thanks!

@vijeth-aradhya
Copy link
Member Author

vijeth-aradhya commented Jan 13, 2017

This is NOT a regex problem, but the output of ghc-mod differing :/
In the CI,

No instance for (Num String) arising from the literal `3'. Possible fix: add an instance declaration for (Num String). In the first argument of `putStrLn', namely `3'.

On my machine,

No instance for (Num String) arising from the literal ‘3’. In the first argument of ‘putStrLn’, namely ‘3’.

Since there is no universal output, it's better we don't test the . separator (IMO comment is sufficient instead of complicating stuff too much?!)

@sils
Copy link
Member

sils commented Jan 13, 2017

can we test for . at least?

@vijeth-aradhya
Copy link
Member Author

Initially, I had put only

No instance for (Num String) arising from the literal 

because there was tick (') difference.
I can't think of how to check only for . though :3

@vijeth-aradhya
Copy link
Member Author

I have added a vague test checking for . because the messages vary slightly according to ghc version. @sils
Please let me know if there any other changes :) I'd love to help and move on to other issues!

@sils
Copy link
Member

sils commented Jan 15, 2017

please use the full URL in the shortlog, not just #..., otherwise it won't be linked in the git logs locally

tempfile_kwargs={'suffix': '.hs'})
self.assertEqual(len(results), 1, str(results))
# to check for the seperator
self.assertTrue((len(str(results[0].message).split('.')) >= 4))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhm this just checks that there are three .s right? Can't we just do a simple assertIn('. ' to see that the space is there properly?

@sils
Copy link
Member

sils commented Jan 15, 2017

please use the full URL in the shortlog, not just #..., otherwise it won't be linked in the git logs locally

unack

Add ghc-mod feature to coala for syntax checking for
haskell files (.hs)

Closes coala#297
@vijeth-aradhya
Copy link
Member Author

I did use the full URL :/ It turns into #.. after I push @sils

@sils
Copy link
Member

sils commented Jan 15, 2017

you can see if it's the full URL if yo hover over the message and see the tooltip :)

@sils
Copy link
Member

sils commented Jan 15, 2017

ack 20f7a1a

@sils
Copy link
Member

sils commented Jan 15, 2017

@rultor merge

@sils
Copy link
Member

sils commented Jan 15, 2017

🎉 finally

@rultor
Copy link

rultor commented Jan 15, 2017

@rultor merge

@sils OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 20f7a1a into coala:master Jan 15, 2017
@rultor
Copy link

rultor commented Jan 15, 2017

@rultor merge

@sils Done! FYI, the full log is here (took me 1min)

@vijeth-aradhya
Copy link
Member Author

You have no idea how relieved I am! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

8 participants