Skip to content

ImpurityReason

A reason why a function is impure.

Stub code in purity.sdsstub
enum ImpurityReason {

    /**
     * The function reads from a file and the file path is a constant.
     *
     * @param path The path of the file.
     */
    FileReadFromConstantPath(path: String)

    /**
     * The function reads from a file and the file path is given by a parameter.
     *
     * @param parameterName The name of the parameter that specifies the file path.
     */
    FileReadFromParameterizedPath(parameterName: String)

    /**
     * The function writes to a file and the file path is a constant.
     *
     * @param path The path of the file.
     */
    FileWriteToConstantPath(path: String)

    /**
     * The function writes to a file and the file path is given by a parameter.
     *
     * @param parameterName The name of the parameter that specifies the file path.
     */
    FileWriteToParameterizedPath(parameterName: String)

    /**
     * The function calls another, potentially impure function that gets passed as a parameter.
     *
     * @param parameterName The name of the parameter that accepts the function.
     */
    PotentiallyImpureParameterCall(parameterName: String)

    /**
     * The function is impure for some other reason. If possible, use a more specific reason.
     */
    Other
}

FileReadFromConstantPath

The function reads from a file and the file path is a constant.

Parameters:

Name Type Description Default
path String The path of the file. -

FileReadFromParameterizedPath

The function reads from a file and the file path is given by a parameter.

Parameters:

Name Type Description Default
parameterName String The name of the parameter that specifies the file path. -

FileWriteToConstantPath

The function writes to a file and the file path is a constant.

Parameters:

Name Type Description Default
path String The path of the file. -

FileWriteToParameterizedPath

The function writes to a file and the file path is given by a parameter.

Parameters:

Name Type Description Default
parameterName String The name of the parameter that specifies the file path. -

Other

The function is impure for some other reason. If possible, use a more specific reason.

PotentiallyImpureParameterCall

The function calls another, potentially impure function that gets passed as a parameter.

Parameters:

Name Type Description Default
parameterName String The name of the parameter that accepts the function. -