zoukankan      html  css  js  c++  java
  • nodejs版本代码注释率统计上新啦~~~

    github链接在这

    Installation

    $ npm install jscrs -g
    

    Usage

    $ npx jscrs
    

    or

    $ jscrs
    

    options

    不建议使用自定义配置

    config

    配置文件,该文件必须是json格式。配置文件支持的选项与cli options相同

    • Cli options: --config, -c
    • Type: path
    • Default: null

    比如自定义配置文件

    $ jscrs -c /config/jscrs/config.json
    

    Ignore case

    是否启用忽略.gitignore文件内相关文件和目录的功能

    • Cli options: --gitignore, --g,
    • Type: boolean
    • Default false

    Output

    生成htmljson报告的输出路径

    • Cli options: --output, -o
    • Type: path
    • Default: ./report/

    config file

    强烈建议

    请在项目根目录下新建.cr.config.json文件,并写入自定义内容

    {
      "ext": [
        "ts",
        "tsx",
        "js",
        "jsx",
        "vue",
        "html",
        "md" // md文档算作注释
      ],
      "path": [
        "/src"
      ],
      "ignore":[
        "/dist/**",
        "dest/**",
        "./node_modules/**",
        "test/**",
        "data/**",
        "src/doc/**",
        "doc",
        "entries/",
      ]
    }
    

    如果不添加该文件,且未在bash命令中指定自定义文件位置,使用默认配置项,默认项主要为以下内容

    {
        ext: [
          'ts',
          'tsx',
          'js',
          'jsx',
          'vue',
          'html',
          'css',
          'less',
          'scss'
        ],
        path: [process.cwd()],
        ignore: [
          '/dist/**',
          'dest/**',
          './node_modules/**',
          'test/**',
          'data/**',
          'src/doc/**',
          'doc',
          'entries/'
        ],
        reports: ['console', 'html', 'json'],
        gitignore: false,  // 默认不启用该功能
        output: './report' // 默认输出目录
      }
    

    JSCRS Reporters

    支持console, html, json

    API

    提供API方便集成

    import {
      IOptions,
      IAnalysis,
      IReport,
      analysis
    } from 'jscrs';
    
    const options: IOptions = {};
    
    const ana: IAnalysis = new analysis(options);
    
    /**@return IReport*/
    const report: IReport = ana.statisticCommentRate();
    
    /**IReport to log*/
    ana.generateReports();
    
  • 相关阅读:
    Java Native Method
    SQL语句优化
    Ibatis的环境搭建以及遇到的问题解决
    Java 构建器
    SpringMVC自定义视图 Excel视图和PDF视图
    java 枚举的常见使用方法
    mysql 根据某些字段之和排序
    MFC The Screen Flickers When The Image Zoomed
    How To Debug Qmake Pro File
    Gcc And MakeFile Level1
  • 原文地址:https://www.cnblogs.com/phillyx/p/13021734.html
Copyright © 2011-2022 走看看