Represents the contents of the project to be analyzed. This information will then be fed to the review rules.
You may need to use use this module if you want
elm-review run in a new environmentYou can safely ignore this module if you just want to write a review rule that
does not look at project information (like the elm.json, dependencies, ...).
Create a new empty Project.
For tests, you can also start of with a project that contains the elm/core dependency using
Review.Test.Dependencies.projectWithElmCore. Some more prepared
dependencies can be found in that same module.
Represents a parsed file.
Add an Elm file to the project. If a file with the same path already exists, then it will replace it.
If the file is syntactically valid Elm code, it will then be analyzed by the
review rules. Otherwise, the file will be added to the list of files that failed
to parse, which you can get using modulesThatFailedToParse,
and for which a parsing error will be reported when running the review function.
Add an already parsed module to the project. This module will then be analyzed by the rules.
Remove a module from the project by its path.
Get the list of modules in the project.
Get the list of file paths that failed to parse because they were syntactically invalid Elm code.
elm.jsonAdd the content of the elm.json file to the project, making it
available for rules to access using
Review.Rule.withElmJsonModuleVisitor and
Review.Rule.withElmJsonProjectVisitor.
The raw value should be the raw JSON as a string, and project corresponds to
elm/project-metadata-utils's Elm.Project.Project type.
Get the contents of the elm.json file, if available.
This will give you a Elm.Project.Project type from the
elm/project-metadata-utils
package, so you will need to install and use it to gain access to the
information from the elm.json file.
README.mdAdd the content of the README.md file to the project, making it
available for rules to access using
Review.Rule.withReadmeModuleVisitor and
Review.Rule.withReadmeProjectVisitor.
Get the contents of the README.md file, if available.
"Extra files" are files that elm-review doesn't load by default because they do not relate to Elm source files or Elm packages,
that rules can then visit.
Add (or update) extra files to the project.
Add (or update) a single extra file to the project.
Update an existing file in the project. The file can be an Elm file of the project and/or an extra file.
Remove a single extra file from the project.
Remove an existing file from the project. The file can be an Elm file of the project and/or an extra file.
Get the extra files in the project.
Add a dependency to the project. These will be available for rules to make better assumptions on what is happening in the code.
Knowing the dependencies of the project will also help better parse the source files, since the dependencies will allow us to know the precedence and associativity of operators, which has an impact on the resulting AST when parsing a file.
For tests, elm-review comes with a few dependencies that you can find in
Review.Test.Dependencies.
Remove a dependency from a project by name.
Remove all dependencies of a project. Use this to flush the dependencies of a project when they are changed, before re-adding them.
Get the direct dependencies of the project.
Get the dependencies of the project.
The kind of change associated to a file. A file was either edited or removed.
Get the files that have been modified between two versions of a Project.
Includes removed files but added files are ignored.
Get the files that have been modified between two versions of a Project.
Added or removed files are ignored.
Precomputes the module graph.
@deprecated This is not useful anymore.
Holds all the information related to the project such as the contents of the
elm.jsonfile, the project modules and the project dependencies.