##Linters
Larger projects (both containing language definitions and containing user models) need to comply to certain conventions. These conventions are not part of the language definitions due to several reasons:
- these conventions might be project specific
- some conventions do NOT refer to nodes but rather project organization, modules, etc
- some conventions need to be definable by the users (not at meta-level packaged into language definitions)
Usage of linter
- Create a model and import the language
org.mpsqa.lint.generic
- Define a new linter by creating a root node
checkable script
- specify the parameters of this linter (definable in inspector)
- write a short documentation about the intent of the linter
- specify the logic of the linter (as a closure returning a list of violations)
- specify concrete values of parameters
- specify if the linter provokes an (model checking) error, warning or info
- add a quick fix that is invoked when pressing "Perform Quick fixes" in the model checker tool (optional)
- Re-use an existing linter by creating a root node
reuse checkable script
- refer to the linter definition
- if the referenced linter has parameter, provide concrete values for those parameters
- specify if the linter provokes an (model checking) error, warning or info
Library of Linters MPS-QA ships with a set of pre-defined linters which can be easily re-used. They belong to the following categories (our collection of pre-defined litners grows week by week):
- Generic Linters
- Linters about modules - examples:
- not_migrated_modules - detects modules which have not yet been migrated to the newest version of their languages
- not_used_modules_dependencies - dependencies declared but not used
- modules_and_file_system_layout_consistency - modules saved in directories with different names (might cause confusions in the diff-view of git)
- Linters about models - examples:
- models_with_no_file_per_root_persistency - models with classical persistency (especially in user projects, the file-per-root might be preferred)
- models_with_same_name_but_different_capitalization - models in a project which have the same names but different capitalization
- Linters about project's filesystem - examples:
- maximum_file_size
- Linters about nodes - examples:
- not_updated_resolve_info - references to nodes which DO NOT have 'resolve info' updated
- root_nodes_without_children
- Linters about modules - examples:
- Linters about language definition aspects
- Linters about generators aspect
- Linters about behavior aspect
- Linters about expressions (baselan expressions, extension expressions)