Automatizando a Revisão do Código
@AndreiCalazans
@Andrei_Calazans
g2i.co
O QUE VOCÊ REVISA?
Google's Engineering Practices
coverageThreshold
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: -10
}
},
Thomas J. McCabe’s Cyclomatic Complexity - 1976
No loops?
Enforce Functional Style? (eslint-plugin-functional)
// eslint-disable-next-line no-loops/no-loops
for (let i = 0; i < arr.length; i++) {
// ...
}
{
"name": "from-svod-to-avod",
"comment": "we can not import from avod when in svod",
"severity": "error",
"from": {
"path": "svod"
},
"to": {
"path": "avod"
}
},
dependency-cruiser
jscpd apps/svod/src/mobile
function foo(d) {
d += 3;
return d+999
}
function bar(d) {
return d*100
}
12. AST picture: https://sites.psu.edu/robertbcolton/tag/abstract-syntax-tree/
14. Parser API: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
15. estree https://github.com/estree/estree
16. eslint simple https://github.com/humanwhocodes/eslint-simple-rule#readme