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 Project.
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 Review.review.
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.
Precomputes the module graph that you get using moduleGraph.
This is to avoid a potentially long computation at every review run. Once the graph
is precomputed, it will be recomputed every time a module is changed, meaning
you won't need to reuse this call precomputeModuleGraph again.
You should use this function if and when you know you loaded all the files in the project.
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.
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.
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 dependencies of the project.
Holds all the information related to the project such as the contents of the
elm.jsonfile, the project modules and the project dependencies.