Skip to content

Commit 86c0a63

Browse files
committed
feat: add rule on line length
1 parent 9fa702e commit 86c0a63

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/code-quality/RULES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ This file contains all the rules for the supported languages.
1010
## Python
1111
* If the function names are not in snake case, decrease score of 3 points
1212
* If the function names is longer than 25 characters, decrease score of 1 points
13+
* If the line in a function have more than 80 characters, decrease score of 1 point

src/code-quality/languages/python/python.visitor.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@ export class PythonVisitor {
1919
if (line.startsWith('def')) {
2020
const funcNameRaw = line.substring(3);
2121
const funcName = funcNameRaw.split('(')[0];
22-
console.log(funcName);
2322
// If function name is not written is snake case => quality -3
2423
if (!CommonQualityFunction.isSnakeCase(funcName)) {
2524
this.codeQuality.score -= 3;
2625
}
26+
// If function name name is greater than 25 character => quality -1
2727
if (funcName.length > 25) {
2828
this.codeQuality.score -= 1;
2929
}
3030
}
31+
// If there more than 80 characters in the line => quality -1
32+
if (line.length > 80) {
33+
this.codeQuality.score -= 1;
34+
}
3135
});
3236
},
3337
}).visit(astTree);

0 commit comments

Comments
 (0)