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

hlint is hard-coded to be installed on GHC 8.4.3 (not the latest GHC) #176

Closed
RyanGlScott opened this issue Sep 22, 2018 · 5 comments
Closed

Comments

@RyanGlScott
Copy link
Contributor

when (cfgHLint config) $ tellStrLns
[ sh $ "if [ $HCNUMVER -eq 80403 ]; then cabal new-install -w ${HC} -j2 --symlink-bindir=$HOME/.local/bin hlint" ++ hlintVersionConstraint ++ "; fi"
]

The code is hard-coding the use of 80403. This should probably be $LATEST_COMPILER instead so that it stays up to date with the latest GHC releases (such as 8.6.1, for instance).

There are a couple of other lines of code in haskell-ci that also exhibit this problem.

@phadej
Copy link
Collaborator

phadej commented Sep 23, 2018 via email

@RyanGlScott
Copy link
Contributor Author

Sure, by all means let this be a configuration option—anything else is better than how it works now :)

@RyanGlScott
Copy link
Contributor Author

I looked into implementing this recently. My game plan is to have a revamped --hlint (and --doctest) flag with three possible states, as represented by this data type:

-- | Used to implement the @--hlint@ and @--doctest@ flags.
data RunProgramOptions
  = Don'tRunProgram
    -- ^ Don't run the program at all.
    --   (e.g., the @--hlint@ flag wasn't passed).
  | RunProgramUsingLatest
    -- ^ Run the program, but only when using the latest version of GHC in the
    --   @tested-with@ stanza.
    --   (e.g., the @--hlint@ flag was passed with no arguments).
  | RunProgramUsingVersionRange VersionRange
    -- ^ Run the program, but only when the version of GHC being used falls
    --   within the provided version range.
    --   (e.g, @--hlint=\"==8.4.3\"@).

There's one annoying problem that I ran into, however. In addition to the --hlint flag, one can also specify an hlint stanza in a configuration file (e.g., hlint: True). However, this uses a completely different configuration language (some data type called FieldDescr that I've never heard of before) than what the CLI flags use (System.Console.GetOpt).

What would a FieldDescr counterpart to the revamped hlint flag look like? It's clear that Don'tRunProgram (i.e., not passing --hlint) would correspond to not giving an hlint stanza, and RunProgramUsingVersionRange (i.e., --hlint="==8.4.3") would correspond to something like hlint: == 8.4.3. But what would RunProgramUsingLatest correspond to? I have no idea, and I can't even find out what FieldDescr is on Hackage, so I'm a bit stuck here.

@peti
Copy link
Contributor

peti commented Oct 22, 2018

A solution to this issue would be very much appreciated. I recently updated my test builds from ghc 8.4.3 to 8.4.4 and was unpleasantly surprised by the fact that this means hlint won't be running any more.

Personally, I believe that specifying --hlint for a configuration that actually doesn't include ghc-8.4.3 should abort the tool with an error because no valid configuration that satisfies these options can be generated.

@phadej
Copy link
Collaborator

phadej commented Feb 10, 2019

Fixed in #204

@phadej phadej closed this as completed Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants