Skip to content

Add elm-review rule NoUnused.CustomTypeConstructorArgs

Overview

Add elm-review rule NoUnused.CustomTypeConstructorArgs

This rule detects types where stored values are never used

type MyType =
    Has String
    NoVal

case val of
    Has _ -> ...
    NoVal -> ...

Assuming no other code uses the String, Has would have an unused argument.

Discussion

Generally, I like this, but it also may lead to removing code that we later need. I included all the current errors here, as it might be helpful to decide if it's going to be removing things we want to keep, or if we can agree on removing the arguments from all these types.

All current errors
-- ELM-REVIEW ERROR ---------------------- src/Helpers/ValidationResult.elm:5:16

NoUnused.CustomTypeConstructorArgs: Argument is never extracted and therefore
never used.

4| type ValidationResult comparable
5|     = Accepted { acceptable : comparable, actual : comparable }
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6|     | Rejected { acceptable : comparable, actual : comparable }

This argument is never used. You should either use it somewhere, or remove it at
the location I pointed at.

src/Helpers/ValidationResult.elm  ↑
====o======================================================================o====
↓  src/Page/InstanceSourcePicker.elm


-- ELM-REVIEW ERROR -------------------- src/Page/InstanceSourcePicker.elm:28:27

NoUnused.CustomTypeConstructorArgs: Argument is never extracted and therefore
never used.

27|     | ImageListMsg Page.ImageList.Msg
28|     | InstanceTypeListMsg Page.InstanceTypeList.Msg
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
29|     | NoOp

This argument is never used. You should either use it somewhere, or remove it at
the location I pointed at.

src/Page/InstanceSourcePicker.elm  ↑
====o======================================================================o====
↓  src/Page/InstanceTypeList.elm


-- ELM-REVIEW ERROR ------------------------ src/Page/InstanceTypeList.elm:31:24

NoUnused.CustomTypeConstructorArgs: Argument is never extracted and therefore
never used.

30|     = NoUsableFlavors
31|     | YesUsableFlavors FlavorRestriction
                           ^^^^^^^^^^^^^^^^^

This argument is never used. You should either use it somewhere, or remove it at
the location I pointed at.

src/Page/InstanceTypeList.elm  ↑
====o======================================================================o====
↓  src/Types/OuterMsg.elm


-- ELM-REVIEW ERROR ------------------------------- src/Types/OuterMsg.elm:56:34

NoUnused.CustomTypeConstructorArgs: Argument is never extracted and therefore
never used.

55|     | VolumeListMsg Page.VolumeList.Msg
56|     | VolumeMountInstructionsMsg Page.VolumeMountInstructions.Msg
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57|     | ServerCreateMsg Page.ServerCreate.Msg

This argument is never used. You should either use it somewhere, or remove it at
the location I pointed at.

src/Types/OuterMsg.elm  ↑
====o======================================================================o====
↓  src/Types/SharedMsg.elm


-- ELM-REVIEW ERROR ----------------------------- src/Types/SharedMsg.elm:124:27

NoUnused.CustomTypeConstructorArgs: Argument is never extracted and therefore
never used.

123|     | ReceiveServerAction
124|     | ReceiveServerEvents ErrorContext (Result HttpErrorWithBody (List OSTypes.ServerEvent))
                               ^^^^^^^^^^^^
125|     | ReceiveConsoleUrl (Result HttpErrorWithBody OSTypes.ConsoleUrl)

This argument is never used. You should either use it somewhere, or remove it at
the location I pointed at.

───────────────────────────────────────────────── src/Types/SharedMsg.elm:129:28

NoUnused.CustomTypeConstructorArgs: Argument is never extracted and therefore
never used.

128|     | ReceiveServerPassphrase OSTypes.ServerPassword
129|     | ReceiveSetServerName String ErrorContext (Result HttpErrorWithBody String)
                                ^^^^^^
130|     | ReceiveSetServerMetadata OSTypes.MetadataItem ErrorContext (Result HttpErrorWithBody (List OSTypes.MetadataItem))

This argument is never used. You should either use it somewhere, or remove it at
the location I pointed at.

I found 6 errors in 5 files.

Merge request reports