Follow more HLint suggestions#4090
Conversation
| toMarkup D.pursuitCssT | ||
| H.body $ do | ||
| H.div ! A.class_ "everything-except-footer" $ do | ||
| H.div ! A.class_ "top-banner clearfix" $ do |
There was a problem hiding this comment.
I don't think I agree with hlint that redundant dos are a problem. In this case, I think I'd actually prefer to leave them in, as it means that you can go back and forth between elements with exactly one child vs more than one child without having to change the line which defines the parent. Can we keep ignoring the redundant do hint please?
b5b6717 to
b0818c9
Compare
|
Any other updates on this PR? Seems like it could be ready to merge. |
|
I wasn't planning on doing anything more in this PR other than striking commits that maintainers object to. I do think it should probably stay open for a little while longer just in case there are more objections; this covers a lot of small changes and almost all of it is subjective, and after it's squashed and merged it'll be harder to revert individual items. |
|
I fixed the merge conflict due to merging #4085. I'm not sure if that will cause CI to fail now if my code doesn't pass the new hlint requirements. |
|
@rhendric Since I broke your build due to merging #4085, do you want me to submit a PR to your fork to fix it? There's only three issues that need to be fixed (below): |
| IO.hSetBuffering IO.stderr IO.LineBuffering | ||
| cmd <- Opts.handleParseResult . execParserPure opts =<< getArgs | ||
| cmd | ||
| join $ Opts.handleParseResult . execParserPure opts =<< getArgs |
There was a problem hiding this comment.
I think this was the only thing in terms of readability where I found it easier to understand the original code rather than the updated code.
There was a problem hiding this comment.
What's the strength of this opinion—are you objecting or hoping to start a discussion without necessarily objecting?
I personally prefer the updated version—I think join immediately communicates that what follows is an IO of an IO—but I don't mind dropping this commit if this is an actual objection.
There was a problem hiding this comment.
Mm.... just ignore the comment for now and please merge this in as soon as you can.
The update is only not as readable to me because I am not as familiar with the code base. If I knew what handleParseResult and the other functions do, then the extra 'cmd' isn't necessary. That takes a few seconds to lookup.
|
As @JordanMartinez points out in #4094, I think it would probably be good to get this in sooner rather than later, and I think it's probably been open long enough for people to have the opportunity to object now.
I think we should enable the "create a merge commit" merge option then, and use that option when merging this PR. Squashing and merging is a good default, but in this case the utility of keeping these commits separate is obvious. |
Sounds good to me! How should we get CI to pass again? |
|
I think it would be ideal to keep the history nice and clean, so the additional fixes which became made necessary after the merge should ideally be amended into the original commit which corresponds to the relevant hlint warning. |
|
I've enabled normal merge commits. |
9a45974 to
29a9d2d
Compare
|
Sorry to have taken a while to check in here; I just got back from a little vacation. I've rebased and fixed all the conflicts in their appropriate commits. I'm ready to merge (and not squash) once the fate of |
Description of the change
We're ignoring quite a large number of HLint's warnings/suggestions, and I thought it might be a good idea to do something about that.
Here it is, one commit per line removed from
.hlint.yaml(except for the first one). I've grouped the commits into sort-of themes and ordered them approximately from what I expect will be least to most controversial (bearing in mind that there are a few suggestions left that even I didn't think would lead to improvement). A handy reference list is below, so that each one can be quibbled about individually. Maybe it would be worth it to break some of these out into smaller PRs? Should each theme be its own PR? I don't know. Let's start talking.Commits touching more than three code files are bolded.
🧠 The no-brainers
0696af28Remove unneeded HLint ignore directivesa7fa8610HLint fix: "Parse error"0fd6f53fHLint fix: "Unused LANGUAGE pragma"🤖 Boolean hijinks
50b475c0HLint fix: "Redundant =="b6a2aef8HLint fix: "Redundant if"📎 Did you mean...
c14cb8c1HLint fix: "Use notElem"667d083aHLint fix: "Use String"b8784430HLint fix: "Use isDigit"9f2b72a1HLint fix: "Use unless"2dd2764cHLint fix: "Use traverse_"6eef8922HLint fix: "Use /="518c3edaHLint fix: "Use $>"cc1bd476HLint fix: "Use =<<"25b5042aHLint fix: "Use maybe"9491b718HLint fix: "Use zipWithM_"da6cfd3aHLint fix: "Use fromMaybe"aa0269fdHLint fix: "Use gets"731a33f5HLint fix: "Use unwords"📜 To list or not to list?
fbcb5516HLint fix: "Use &&"82d83183HLint fix: "Use ++"bb6e1622HLint fix: "Use list literal pattern"7ff24174HLint fix: "Use :"🤔 Complex simplifications
c19cacabHLint fix: "Use ."80fd0361HLint fix: "Use Just"54fd3dc0HLint fix: "Hoist not"d2edcb24HLint fix: "Redundant fmap"🔢 Getting it sorted
7cf1c80eHLint fix: "Use sortOn"f279b60aHLint fix: "Avoid reverse"💵 Dollars and sense
11eb5b21HLint fix: "Redundant bracket"9540bb99HLint fix: "Redundant $"864346c1HLint fix: "Move brackets to avoid $"f208a8daHLint fix: "Use <$>"#4090 (comment)cbaf6a08HLint fix: "Redundant do"☝️ Pointlessness
f506048eHLint fix: "Eta reduce"a8f3c712HLint fix: "Use join"93f66a42HLint fix: "Use fmap"a3a477b3HLint fix: "Use const"e3a27227HLint fix: "Use lambda-case"💇 Miscellaneous style choices
39d75e4dHLint fix: "Use infix"102a4d51HLint fix: "Use tuple-section"74456748HLint fix: "Use camelCase"Finally, some words about the also-rans:
This one wants single-constructor
datatypes to be declared asnewtype, which maybe sounds harmless enough, but in some of the cases we have, such asAll of these are triggered by cases where, if one of the HOFs in question takes a lambda and the other a point-free expression, composition could lead to code that is less clear.
infix"All of these really want things like
\z -> TUnknown z bto be replaced with(`TUnknown` b), which I don't think is an improvement in cases where the function wasn't named and typed with the intent of being used infix.This is the weirdest suggestion. It gets triggered by any all-wildcard constructor pattern with three or more wildcards. I think whether to use
Ctor{}orCtor _ _ _has much more to do with semantics than the number of wildcards—specifically, whether adding a field to the constructor would be a good reason to revisit this code.This hint might have some value but silencing it involves substantial non-mechanical refactoring, which I just didn't want to undertake.
Checklist: