Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Commit 492eba4

Browse files
committed
docs cleanup
1 parent 9e7bf32 commit 492eba4

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

README.md

+5-13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ After that, you can run readable on any file or directory like this:
2020

2121
$ npx readable
2222

23+
### Exit code
24+
25+
Returns 0 if no errors. Returns 2 if there are some rrors. Can return 2 if some
26+
exception happend during linting.
27+
2328
### Configuration
2429

2530
After running `readable --init`, you'll have a `.readable.json` file in your directory. In it, you'll see some rules configured like this:
@@ -79,16 +84,3 @@ To update api docs:
7984
npm run docs
8085

8186

82-
## TODO
83-
84-
- [x] works for PHP initially, but a next version could support more languages, such as JS (next version not in scope)
85-
- [x] can easily run on the commandline (eg npm run analyze)
86-
- [x] can be plugged into our CI (running the cli command returns either green or red code-state via exit status)
87-
- [x] written in javascript or typescript. This way we have to option to build this into a vs code plugin (vs code plugin itself not in scope). We are open to other suggestions on this point
88-
- [x] does NOT have to parse code into an AST for static code-like analysis. We want to focus on coding conventions that can be detected with simpler methods (eg regex or pattern matching, simple algorithms,..)
89-
- [x] should be easy to extend with a new rule (documentation with samples should be provided)
90-
- [x] should run fast for the given ruleset ( below 1 minute for 2000+ php files of 100-150 lines)
91-
- [x] rules should be configurable (turned on/off and add parameters) via a json config file
92-
- [x] in order to use the analyzer on a CI on an existing codebase, we need a whitelist approach. One rule might have 100 violations, but we still want to use that rule on the codebase for new code. That means those 100 existing violations should be ignored. An ignore-config-file (similar to 'Psalm' by vimeo) should be used. A command should exist to generate such an ignore file. The ignore file should be json-structured. It should contain the types of violations, the filename/path and the amount of occurrences to be ignored in that file or folder.
93-
- [x] every rule should have at least a 2 unit tests, a green example and an example that is in violation
94-

docs/rules.md

-21
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,3 @@ Avoid indent deeper than 4 (maximum block nesting, eg for loop within an if with
138138
```JSON
139139
"max-nest": 3,
140140
```
141-
142-
## TODO
143-
144-
Below is an exhaustive set of the initial rules we need implemented. Each rule should have it's own 'class/module' and act as a plugin for the wider system:
145-
146-
- [x] avoid triple inner for/foreach (eg for within for within for loop)
147-
- [x] avoid a class without a single comment at the top stating purpose
148-
- [x] avoid any function longer than 50 lines
149-
- [x] avoid indent deeper than 4 (maximum block nesting, eg for loop within an if within a for loop within a for loop)
150-
- [x] avoid complicated ifs (eg more than 2 &&.., combination of && and ||)
151-
- [x] avoid ternary operator combined with line length exceeding 50 chars
152-
- [x] avoid namespaces with 15+ files
153-
- [x] avoid loops with inside of them more than 15 lines (a block that should be a function)
154-
- [x] avoid files with more than 200 lines.
155-
- [x] avoid dangerous calls to eval, print_r, var_export, var_dump, phpinfo, exec,..(forbidden function list)
156-
- [x] avoid assignment inside of an if statement
157-
- [x] avoid an if statement or for loop without braces
158-
- [x] avoid variables with names shorter than 3 letters (while whitelisting $i or $id)
159-
- [x]
160-
- [x] avoid overriding of a function's arguments
161-
- [x] avoid empty catch blocks

0 commit comments

Comments
 (0)