代碼的壞味道

前端工程javascript代碼中的壞味道javascript

常見問題:前端

一、Function 'englishToPigLatin' has a complexity of xxx.java

二、This function has too many statements (16)git

三、Blocks are nested too deeply (5).github

 

關於Lint的配置項:如最大語句數,複雜度,最大嵌套數,最大長度,最多傳參,最多嵌套回調npm

 學會使用ESlint或其餘診斷工具 工具

檢查出粘貼複製和結構相似的代碼片斷 – jsinspect (https://github.com/danielstjules)spa

$ npm install -g jsinspectcode

$ jsinspect -t 30 -i ./path/to/srcip

(某個總體部分有多少個重複點?)

 Match - 2 instances   

  (出現重複的代碼地方)
 - .\transferOperation.js:740,747

   + .\transferOperation.js:754,761

 

(掃描總結)

85 matches found across 33 files

相關文章
相關標籤/搜索