HLint

Help
gidyn
2011-02-09
2012-12-06
  • gidyn
    gidyn
    2011-02-09

    Could HLint output be added to the problems tab? I've added it as an external tool, but I don't know how to integrate it any better than that. Including HLint in the background builds would also be good.

     
  • JP Moresmau
    JP Moresmau
    2011-02-11

    Well, it is on the TODO, so if there's interest we could try to integrate it soonish. I don't use HLint myself, which I suppose is a shame, but it probably would be a worthwhile option. Could you expand a bit on how you launch it, what option you pass to it, etc…
    From what I can see now we could:
    - give an option in the Haskell preferences to use HLint by pointing to the executable, and maybe choosing some options
    - maybe give the option to run HLint or not and with which options at the project level
    - if enabled, run HLint alongside the normal project build
    - show HLint output in the Problems view.
    - I don't know how precise the suggestions are, but maybe we could also have an action on each HLint suggestion to actually apply it on the code.

     
  • gidyn
    gidyn
    2011-03-25

    I have it configured as an external tool, with the argument "${project_loc}\src", and build before launch.
    The only thing really missing from this setup is that the output should go to the problems tab instead of a dumb console, although the ability to add this as a post-build step would also be a good enhancement.

     

  • Anonymous
    2012-02-26

    This feature appears to be implemented, which is great.  However, I can not get it to work.  HLint Builder shows up when I right click on my Eclipse project -> Properties -> Builders.  Furthermore, I have HLint installed, and executing `hlint <file>` from Terminal works fine.

    EclipseFP 2.2.2
    Eclipse SDK 3.7.1
    GHC 7.0.4
    HLint 1.8.24

     

  • Anonymous
    2012-02-26

    Clarification: "I can not get it to work" means that none of the HLint output appears in my Problems window within Eclipse, even though running hint from the Terminal does indeed find numerous problems.

     
  • JP Moresmau
    JP Moresmau
    2012-02-27

    The HLint builder should run when your project is built. If you're not using automatic building, you may need to right click your project and choose build. Any error in the error log?

     

  • Anonymous
    2012-02-27

    When I build the project, I see the HLint usage message printed to the Console window of Eclipse.  It is as if hlint is being called without any arguments.

     
  • JP Moresmau
    JP Moresmau
    2012-02-27

    I've upgraded to use your version and it still works. Are you under MacOS? The Terminal may not use the same PATH as EclipseFP, so maybe you're not using the version of HLint you think you are… Otherwise can you send me your project to check (jp _at_ moresmau.fr)

     

  • Anonymous
    2012-02-28

    I am on Mac OSX 10.7.3.  I have only one version of hlint installed, so it must be calling the same hlint.  The usage message shown in Eclipse's Console agrees:

    HLint v1.8.24, (C) Neil Mitchell 2006-2011
      hlint [files/directories] [options]
      -?        --help                     Display help message
      -v        --version                  Display version information
      -r[file]  --report[=file]            Generate a report in HTML
    ...
    

    Let me conjure up a project which reproduces the effect but is within a reasonable size. 

     

  • Anonymous
    2012-02-29

    Here you can download a ZIP file of an Eclipse project containing two source files: Main.hs and PRCaDist.hs.  Main.hs has nothing substantive in it.  Runing hlint PRCaDist.hs on the command line finds 8 suggestions.  The project will not successfully build in Eclipse due to missing dependencies for PRCaDist.hs.  Nevetheless, I still get the hlint usage message in the Eclipse Console every time the project is built. 

     
  • JP Moresmau
    JP Moresmau
    2012-02-29

    I get the 8 suggestions in the problem view after I put your project in my workspace. Sorry, looks like you'll have to do more investigation at your end. You can do a capture of the console where you see the hlint message and send it to me?

     

  • Anonymous
    2012-02-29

    Here you can find Eclipse on the left with the Console output message and Terminal on the right with all 8 problems found. 

    Here you can find the Eclipse Problems window showing no problems.  Everything else is the same.

    Thank you for looking into this.

     
  • JP Moresmau
    JP Moresmau
    2012-02-29

    There is nothing in the code that dumps the hlint output in the console, that's why I'm utterly confused by your screenshots… How have you configure the hlint builder? Have you added hlint as an external tool or done something special with hlint?

     
  • JP Moresmau
    JP Moresmau
    2012-02-29

    OK, I see in  your .project file <buildCommand>
    <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
    <triggers>full,incremental,</triggers>
    <arguments>
    <dictionary>
    <key>LaunchConfigHandle</key>
    <value>&lt;project&gt;/.externalToolBuilders/hlint.launch</value>
    </dictionary>
    </arguments>
    </buildCommand>

    Remove that entirely. That explains the console view.
    I still think the fact you don't see the real problems means that the HLintBuilder does not find hlint, maybe, because on MacOs the GUI programs do not have the same PATH as the Terminal, there's a file somewhere you can tweak I think.

     

  • Anonymous
    2012-03-01

    Ah, I see.  I think I added that in a naive attempt to get it to work, but I thought I removed it.  It is gone, now. 

    You were indeed right.  The PATH I see in Mac's Terminal is not the same as the PATH seen by GUI programs.  This is detailed here.  Setting a global PATH to include a directory which had hlint made it work. 

     
  • JP Moresmau
    JP Moresmau
    2012-03-01

    The next version of EclipseFP will let you set the path to hlint manually if you need to, and autodetect it from the path too, to make these kinds of things easier.

     

  • Anonymous
    2012-03-02

    That is a very good idea.

     
  • JP Moresmau
    JP Moresmau
    2012-03-02

    It's now the "current version" of EclipseFP since 2.2.3 was released yesterday