-
Notifications
You must be signed in to change notification settings - Fork 29
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
Comment is repeated. #136
Comments
I'm running into what I think might be the same issue. Here is a (more) minimal repro: The file needs something to fix in it (in this case, redundant foo = bar $ baz
instance ToJSON WordStudyQuestionTransitionTypeJSON where
toJSON
( WordStudyQuestionTransitionTypeJSON
WordStudyQuestionTextAssets {..}
QuestionJSON {..}
) =
-- We cannot rely on toJSON representations of both because we have overlapping keys: type and content
-- We want "type" to come from the new question model and "content" to be renamed
object $
-- From New Question Model
[ "id" .= qjId
, "stemId" .= qjStemId
, "skillIds" .= qjSkillIds
, "parentId" .= qjParentId
, "position" .= qjPosition
, "worth" .= qjWorth
, "subject" .= qjSubject
, "lang" .= qjLang
, "type" .= qjType
, -- From Legacy
"level" .= wordStudyQuestionTextAssetsLevel
, "contentAudioUrl" .= wordStudyQuestionTextAssetsContentAudioUrl
, "hasQuestionAudio" .= wordStudyQuestionTextAssetsHasQuestionAudio
, "diagram" .= wordStudyQuestionTextAssetsDiagram
, "imageUrl" .= wordStudyQuestionTextAssetsImageUrl
, "imageDescription" .= wordStudyQuestionTextAssetsImageDescription
, "wordAudioUrl" .= wordStudyQuestionTextAssetsWordAudioUrl
, "correctAnswers" .= wordStudyQuestionTextAssetsCorrectAnswers
, -- Duplicate fields: renaming the new one
"content" .= wordStudyQuestionTextAssetsContent
, "content_2" .= qjContent
]
-- From Legacy additional
<> case wordStudyQuestionTextAssetsAnswers of
Nothing -> []
Just answers' -> ["answers" .= answers']
<> case wordStudyQuestionTextAssetsBucketFieldNames of
Nothing -> []
Just bucketFieldNames' -> ["bucketFieldNames" .= bucketFieldNames'] Then run, hlint --refactor --refactor-options=-i example.hs And it produces the following diff: % 1 diff -U 3 example.bak.hs example.hs
--- example.bak.hs 2023-12-18 16:51:39.401224049 -0500
+++ example.hs 2023-12-18 16:50:59.821121001 -0500
@@ -1,4 +1,4 @@
-foo = bar $ baz
+foo = bar baz
instance ToJSON WordStudyQuestionTransitionTypeJSON where
toJSON
@@ -10,6 +10,10 @@
-- We want "type" to come from the new question model and "content" to be renamed
object $
-- From New Question Model
+
+ -- From New Question Model
+
+ -- From New Question Model
[ "id" .= qjId
, "stemId" .= qjStemId
, "skillIds" .= qjSkillIds I'm using the following versions, % hlint --version
HLint v3.5, (C) Neil Mitchell 2006-2022
% refactor --version
v0.10.0.0% |
Confirm, that the bug with repeating comments is still happening for
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To reproduce, at this revision agda/agda@1fd9e26, edit
.hlint.yaml
deleting- ignore: {name: "Redundant variable capture"} # 6 hints
and then run this refactor:It adds repeats a comment.
The text was updated successfully, but these errors were encountered: