Go ahead!
When you find a bug in the system, I would appreciate it if you could open a new issue. I will do my best to fix the problem in my free time. Or if
you can solve it yourself. You can do that. All PR should target the main
branch. There is currently no staging
or development
branch. I
want to keep everything simple.
E0000 Example Rule can be used as a base for new rules. Please follow the next steps to add a new rule:
- Pickup available code for a new rule; let's say it is
E1234
. - Create a new rule module:
cp src/rules/e0.rs src/rules/e1234.rs
- Update
CODE
andDESCRIPTION
variables in the newsrc/rules/e1234.rs
:... static CODE: &str = "E1234"; static DESCRIPTION: &str = "Your rule description"; ...
- Create PHP examples for the new rule:
cp -r src/rules/examples/e0 src/rules/examples/e1234
- Implement the
validate
function insrc/rules/e1234.rs
. And cover it with tests inmod tests.
- Enable the new rule in
src/rules/mod.rs
:... pub mod e1234; ... pub fn all_rules() -> HashMap<String, Box<dyn Rule>> { ... add_rule(&mut rules, Box::default() as Box<e1234::Rule>); ... }
- Update
README.md
with new rule details. - Create a file named
e1234.md
. - Explain the rule.
- Done! Submit a new PR with the new rule.
- Wait for it to be released.
- Repait again.
The idea I have in my mind is that all the rules should be documented for an inexperienced PHP developer. If you have experience with PHP and an eye for beauty, your help is welcome.