-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Goals
During yesterday Scapy meetup, we discussed how we can improve the current state of Scapy source style with the following constraints:
- limit the effects on git history
- perform incremental changes
- ease reviewing
- aim to fix a single type of error per pull-request, and explain why some are not fixed
- enforce PEP08 checks
- credit original authors
Methodology
We performed a flake8 run on commit f89055dac106f79f8892a33eca2e8b0ac29475ff that shows 21733 errors made of 55 different errors/warnings. Scapy LoC is currently 38k.
We decided to classify the errors type into three categories:
- immediate fixes: errors that not related to the style and can be fixed by regular commits by anyone;
- to be discussed: these errors need to be fixed carefully. Applying a linter might lead to bugs or hard to review changes;
- style related: we wish to do a single commit per error. This commit will fix all lines concerned by this error, and will be authored by 'Phil phil@secdev.org'. The error message will take advantage of the 'Co-authored-by' to credit original authors. For example, the following message will be used for E231:
E231 - missing whitespace after ',' Co-authored-by: gpotter2 <10530980+gpotter2@users.noreply.github.com> Co-authored-by: Guillaume Valadon <guillaume@valadon.net Co-authored-by: Philippe ROSE <shadawan@gmail.com> Co-authored-by: Francois Contat <francois.contat@ssi.gouv.fr> [..]
Automatic tests will be added and enforced as errors are fixed. In the mean time, the following command can be used to check for already fixed errors:
tox -e flake8
Stats
Here are the errors that need to be fixed. Comments, help and feedback are welcome!
- immediate fixes
| % | Count | Type & example |
|---|---|---|
| 0.234666 | 51 | |
| 0.138039 | 30 | |
| 0.10583 | 23 | |
| 0.0782221 | 17 | |
| 0.0046013 | 1 |
- style related
| % | Count | Type & example |
|---|---|---|
| 18.1521 | 3945 | |
| 12.4971 | 2716 | |
| 9.53849 | 2073 | |
| 7.40349 | 1609 | |
| 6.57065 | 1428 | |
| 5.28229 | 1148 | |
| 5.19947 | 1130 | |
| 4.85897 | 1056 | |
| 4.81296 | 1046 | |
| 2.72397 | 592 | |
| 2.4709 | 537 | |
| 2.45709 | 534 | |
| 1.89113 | 411 | |
| 1.73929 | 378 | |
| 1.73929 | 378 | |
| 1.72549 | 375 | |
| 0.980076 | 213 | |
| 0.92026 | 200 | |
| 0.81443 | 177 | |
| 0.561358 | 122 | |
| 0.478535 | 104 | |
| 0.414117 | 90 | |
| 0.39111 | 85 | |
| 0.28528 | 62 | |
| 0.276078 | 60 | |
| 0.271477 | 59 | |
| 0.266875 | 58 | |
| 0.230065 | 50 | |
| 0.207058 | 45 | |
| 0.174849 | 38 | |
| 0.174849 | 38 | |
| 0.133438 | 29 | |
| 0.128836 | 28 | |
| 0.119634 | 26 | |
| 0.115032 | 25 | |
| 0.115032 | 25 | |
| 0.0966272 | 21 | |
| 0.092026 | 20 | |
| 0.0874247 | 19 | |
| 0.0736208 | 16 | |
| 0.0322091 | 7 | |
| 0.0322091 | 7 | |
| 0.0092026 | 2 | |
| 0.0092026 | 2 | |
| 0.0046013 | 1 |
- to be discussed
| % | Count | Type & example |
|---|---|---|
| 1.70708 | 371 | |
| 0.634979 | 138 | |
| 0.363503 | 79 | |
| 0.138039 | 30 | |
| 0.0368104 | 8 |
Reactions are currently unavailable