{"_id":"@caiwenshu/cqc","_rev":"2-af929b5ab2e484b87a0b650ff30dde60","name":"@caiwenshu/cqc","dist-tags":{"latest":"0.5.3"},"versions":{"0.5.2":{"name":"@caiwenshu/cqc","version":"0.5.2","description":"Code Quality Checker - Check your code quality by running one command.","main":"src/CodeQualityChecker/index.js","bin":{"cqc":"bin/cqc.js"},"scripts":{"lint":"eslint .","test":"npm run lint && _mocha","cover":"istanbul cover node_modules/mocha/bin/_mocha","coveralls":"npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls"},"keywords":["quality","code quality","complexity","duplicate","sloc"],"repository":{"type":"git","url":"git+https://github.com/xcatliu/cqc.git"},"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/cqc/issues"},"homepage":"https://github.com/xcatliu/cqc#readme","dependencies":{"babel-eslint":"^8.0.1","commander":"^2.11.0","eslint":"^4.7.1","eslint-plugin-react":"^7.4.0","eslint-plugin-vue":"^3.13.0","globby":"^6.1.0","jscpd":"^0.6.14","lodash":"^4.17.4","sloc":"^0.2.0","vue-eslint-parser":"^2.0.1-beta.1","winston":"^2.3.1"},"devDependencies":{"chai":"^4.1.2","coveralls":"^3.0.0","eslint-config-alloy":"^1.2.1","istanbul":"^0.4.5","mocha":"^3.5.3","mocha-lcov-reporter":"^1.3.0","sinon":"^4.0.0"},"gitHead":"c0061c41b0c0565b5cff5f4a29b74f41a5dc9036","_id":"@caiwenshu/cqc@0.5.2","_npmVersion":"5.6.0","_nodeVersion":"8.11.4","_npmUser":{"name":"caiwenshu","email":"wenshu.cai@shenmajr.com"},"dist":{"integrity":"sha512-vHkHxhvUsDrx4CvJf4voXYnjcqh93ko9di3nlou8r0/tO6kLCBZHZUrCun5Cd4FxIWCJIacA33QfX7d94L0IrQ==","shasum":"1524c057b4e103c5456ecc8ba4b8ed157c6adfa5","tarball":"https://registry.npmjs.org/@caiwenshu/cqc/-/cqc-0.5.2.tgz","fileCount":50,"unpackedSize":104837,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcmFJbCRA9TVsSAnZWagAAytEP/1lD7H3bJkaHKxO5JgOp\n9DK6qT9rc0gbsitnjaYIWlMml/Df2jw8hu2R/xPNwdM42RPIER+KfZrmaBG0\nN8D/t6qsSE0yfhpYguMsJBMtEwSHn1qErk28HteUk1OltA8rIaqZh15/QF9R\n1FqNb9JyY1xJ+n4k6u9QKh7vlrN3wLmRJ5s21GqxZIWooAZzFVmwSPul3IR7\nnm10/9hbSJDN2htWsQmSTgLkebwG45ozPo3bpfwlksHN3xXcrwe59suSISrt\nLtThYLwil94KO7SNEVi7L1AXqjzdNF3lwH/NVteg6Z0F8xIcmTmcuJeViF/i\n9rOuQ9vp4QE8A8WQ86Pvse+6rlzJwnFXQ8kwydCtT9h15GA/7z/HH4icTW0k\ns0xaNmpDxHMZW5eLgtE8wf8zP0i/wMReoCgmQKpw83cLpyaP31rlmpOmWZq4\nwP2DIknrcdZCjMLhDOBqHVFPeDM0xmTrNlx++zMl1Z6gN1gfqZESh0dp4S+W\nGsWt+bpsSr7+RfAFoPH8gdzXK9C0dNGksdWk1FO1YRbRd7h1C4UYgKTCKMH7\nD5BA0QNuY6teUgM88GsYTWmzo5RSYkkb3H5pYC1wissbwMkYcLfbb6d6gmTj\nDuQWEXRPRCra/yymvIe4JydrU45KsYcQN+GCkCZrCKrNH1tCnBTLTcF2M6L7\nlQK5\r\n=WpTg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHbZ2F8vxIZF525xe+dKJ4LgfX35MqZCqQ2em2IuvBMiAiAQS3X3eRg4b35VifDmVgBGjR+xuGKSBYZr8NffOkAOag=="}]},"maintainers":[{"name":"caiwenshu","email":"wenshu.cai@shenmajr.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cqc_0.5.2_1553486426437_0.1929482742288815"},"_hasShrinkwrap":false},"0.5.3":{"name":"@caiwenshu/cqc","version":"0.5.3","description":"Code Quality Checker - Check your code quality by running one command.","main":"src/CodeQualityChecker/index.js","bin":{"cqc":"bin/cqc.js"},"scripts":{"lint":"eslint .","test":"npm run lint && _mocha","cover":"istanbul cover node_modules/mocha/bin/_mocha","coveralls":"npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls"},"keywords":["quality","code quality","complexity","duplicate","sloc"],"repository":{"type":"git","url":"git+https://github.com/xcatliu/cqc.git"},"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/cqc/issues"},"homepage":"https://github.com/xcatliu/cqc#readme","dependencies":{"babel-eslint":"^8.0.1","commander":"^2.11.0","eslint":"^4.7.1","eslint-plugin-react":"^7.4.0","eslint-plugin-vue":"^3.13.0","globby":"^6.1.0","jscpd":"^0.6.14","lodash":"^4.17.4","sloc":"^0.2.0","vue-eslint-parser":"^2.0.1-beta.1","winston":"^2.3.1"},"devDependencies":{"chai":"^4.1.2","coveralls":"^3.0.0","eslint-config-alloy":"^1.2.1","istanbul":"^0.4.5","mocha":"^3.5.3","mocha-lcov-reporter":"^1.3.0","sinon":"^4.0.0"},"gitHead":"6151b8d5425dcd16b1632e2ce16db05d86f6a861","_id":"@caiwenshu/cqc@0.5.3","_npmVersion":"5.6.0","_nodeVersion":"8.11.4","_npmUser":{"name":"caiwenshu","email":"wenshu.cai@shenmajr.com"},"dist":{"integrity":"sha512-fGjWszvQ05sJZVKlG/zS/dyT4vk9BWMQb2DwO1kwz11DqyJ6xlmDLmW1beSKWkju3iXyN3/CX/5d3f+XlmpWsQ==","shasum":"2b64f0e834a048ef63ed68259079325d2a57b85e","tarball":"https://registry.npmjs.org/@caiwenshu/cqc/-/cqc-0.5.3.tgz","fileCount":50,"unpackedSize":108410,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcmIXvCRA9TVsSAnZWagAA8zIP/01X2BsHGKu45vbP4832\nffpAcxeP/EfDIYzYInKR/GfWXLxOODahOLWbOtQTcftXfK8T6jI6ariJrtXB\nyoP4hPYjcBNuOhf3Z0r6/27uXm+eGKtCM23pEd5Yd6TDj9FloSvENKfBOnzI\n6craaIbSgOwxZbrJpWrSJ2jF/eHr0BqNiPtOCWNhzMWiIkKwmWJ8JFSMjTQf\nBZrdAyNBrtWOfhXWNHVh27lq+V7vX4n3p8bnWGhxfdHGqQCshPIOGviuIo/k\nIBldZMZXLe5mDJ5wECAhAz60pPN/Rh5ssd9TFkIera+ZbwUYfwyJ9ZHe9wAV\nypwQ8/iuOD7y7rhEKDYruPsF0tGTtN+/pus1zhv5RIPfRk6estmZvXeFAPru\nDyp22pg7sX1c42qA2m15b5p/oiJ1aFYmZK7K2retmbBq36om8MBT/HF59SIV\nHFVF3mSfyrqPjyMtA16mE7W/F6V4OjgUUBiD3fIre/026GcDPBJGklVe5g8W\nA6fx2zUT/Ct2YWQWDeC7Bv2EQbU2Be4B0uCWr9cZnJiGa91CqK8ArHLiw1uJ\n6hmWEphjcCaPEm8F7p2nWunnKGMbOKAyyIoyjX7sj63DvK0/v0l9QsiT/r7H\nYoXdCCsUxIToj0WD5SC2FUhlWDiYwUl5WHd4B6/WIq5Jwwq7xtZl2LtzVFH7\nRb3B\r\n=Virb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0t29D1gBtLcEb2aMtsSL/SVyYI35YleQ+g6N4nSDoBQIgeGaHjyiI7iKM3jJ9YfPs3z6KQ2kz8VPQhejf6iBVBYA="}]},"maintainers":[{"name":"caiwenshu","email":"wenshu.cai@shenmajr.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cqc_0.5.3_1553499630428_0.1712930113390403"},"_hasShrinkwrap":false}},"time":{"created":"2019-03-25T04:00:26.255Z","0.5.2":"2019-03-25T04:00:26.567Z","modified":"2022-04-04T21:31:23.266Z","0.5.3":"2019-03-25T07:40:30.583Z"},"maintainers":[{"name":"caiwenshu","email":"wenshu.cai@shenmajr.com"}],"description":"Code Quality Checker - Check your code quality by running one command.","homepage":"https://github.com/xcatliu/cqc#readme","keywords":["quality","code quality","complexity","duplicate","sloc"],"repository":{"type":"git","url":"git+https://github.com/xcatliu/cqc.git"},"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"bugs":{"url":"https://github.com/xcatliu/cqc/issues"},"license":"MIT","readme":"# Code Quality Checker\n\n[![Build Status](https://img.shields.io/travis/xcatliu/cqc.svg)](https://travis-ci.org/xcatliu/cqc) [![npm package](https://img.shields.io/npm/v/cqc.svg)](https://www.npmjs.org/package/cqc) [![npm downloads](http://img.shields.io/npm/dm/cqc.svg)](https://www.npmjs.org/package/cqc) [![Coveralls](https://img.shields.io/coveralls/xcatliu/cqc.svg)](https://coveralls.io/github/xcatliu/cqc)\n\nCheck your code quality by running one command.\n\n    publish npmjs\n    \n    npm publish --access=public\n    \n\n## Supported Languages\n\n- js, jsx, vue\n- css, less, scss, sass, styl\n\n## Quick Start\n\nInstall cqc:\n\n```bash\nnpm install -g cqc\n```\n\nRun Code Quality Checker for all JavaScript files in `src` directory:\n\n```bash\ncqc src\n```\n\nOutput:\n\n```\nNumber of files:        12\nSource lines of code:   696\nDuplicate rate:         3.23%\nHigh complexity rate:   0.00%\n```\n\n## Usage\n\nTo run cqc, use the following format:\n\n```bash\ncqc [options] <file|dir|glob>*\n```\n\nFor example:\n\n```bash\ncqc src/file1.js src/file2.js\n```\n\nor\n\n```bash\ncqc src lib\n```\n\nor\n\n```bash\ncqc src/**/*.js src/**/*.jsx\n```\n\nPlease note that when passing a glob as a parameter, it will be expanded by your shell. The results of the expansion can vary depending on your shell, and its configuration. If you want to use node `glob` syntax, you have to quote your parameter (using double quotes if you need it to run in Windows), as follows:\n\n```bash\ncqc \"src/**/*.js\" \"src/**/*.jsx\"\n```\n\n### Options\n\nOption | Type | Default | Description\n------ | ---- | ------- | -----------\nFiles options |\n`--ext` | string | `.js` | Specify file extensions. `--ext` is only used when the arguments are directories. If you use glob patterns or file names, then `--ext` is ignored.\n`--ignore-path` | path | | Specify path of ignore file\n`--ignore-pattern` | pattern | | Pattern of files to ignore\n`--filter-pattern` | pattern | | Output percentage of all files but only details that related to the filter pattern\nScript options |\n`--jscpd-min-lines` | number | `5` | Set the min size of duplication in code lines\n`--jscpd-min-tokens` | number | `70` | Set the min size of duplication in code tokens\n`--complexity-max` | number | `10` | Set the allowed max complexity of a function\nDisable options |\n`--disable-base` | | | Disable base checker\n`--disable-sloc` | | | Disable sloc checker\n`--disable-jscpd` | | | Disable jscpd checker\n`--disable-complexity` | | | Disable complexity checker\nReporter options |\n`-f`, `--format` | string | | Specify an output format. Supported format: json\n`--verbose` | | | Verbose mode. A lot more information output\n`--threshold-jscpd` | number | | Set the jscpd threshold, process will exit if duplicate rate is more than threshold\n`--threshold-complexity` | number | | Set the complexity threshold, process will exit if complexity rate is more than threshold\n`--json-path` | string | | output json file,unite ` -f json` format.\n\nExamples:\n\n#### Set the file extensions\n\n```bash\ncqc src --ext \".js,.jsx\"\n```\n\n#### Set the ignore file path\n\n```bash\ncqc src/**/*.js --ignore-path \".gitignore,.eslintignore\"\n```\n\n#### Ignore vendors and third-party libraries\n\n```bash\ncqc src/**/*.js --ignore-pattern \"src/vendor/**/*.js,src/third-party/**/*.js\"\n```\n\n#### Output json format\n\n```bash\ncqc src/**/*.js --format json\n```\n\nOutput:\n\n```json\n{\n    \"base\": {\n        \"numberOfFiles\": 12\n    },\n    \"sloc\": {\n        \"source\": 696\n    },\n    \"jscpd\": {\n        \"percentage\": \"3.23\"\n    },\n    \"complexity\": {\n        \"percentage\": \"0.00\"\n    }\n}\n```\n\n#### Verbose mode\n\n```bash\ncqc src/**/*.js --verbose\n```\n\nOutput:\n\n```\nNumber of files: 12\nFile list:\n    - E:\\github\\xcatliu\\cqc\\src\\BaseChecker\\index.js\n    - E:\\github\\xcatliu\\cqc\\src\\CheckerResult\\cqcReporter.js\n    - E:\\github\\xcatliu\\cqc\\src\\CheckerResult\\index.js\n    - E:\\github\\xcatliu\\cqc\\src\\CheckerResult\\logStdout.js\n    - E:\\github\\xcatliu\\cqc\\src\\CodeQualityChecker\\index.js\n    - E:\\github\\xcatliu\\cqc\\src\\ComplexityChecker\\eslintConfig.js\n    - E:\\github\\xcatliu\\cqc\\src\\ComplexityChecker\\getParserFromFilepath.js\n    - E:\\github\\xcatliu\\cqc\\src\\ComplexityChecker\\index.js\n    - E:\\github\\xcatliu\\cqc\\src\\JscpdChecker\\getLanguageFromFilepath.js\n    - E:\\github\\xcatliu\\cqc\\src\\JscpdChecker\\index.js\n    - E:\\github\\xcatliu\\cqc\\src\\JscpdChecker\\jscpdReporter.js\n    - E:\\github\\xcatliu\\cqc\\src\\SlocChecker\\index.js\n\nPhysical lines:             854\nSource lines of code:       696\nComments:                   36\nSingle-line comments:       36\nBlock comments:             0\nMixed source and comments:  0\nEmpty lines:                122\nTODO's:                     1\n\nDuplicate rate:             3.23%\nFiles of duplicated code:   3\nCount of duplicated code:   2\nLines of duplicated code:   28\nDuplication details:\n    - E:\\github\\xcatliu\\cqc\\src\\CheckerResult\\logStdout.js: 67-71\n      E:\\github\\xcatliu\\cqc\\src\\CheckerResult\\logStdout.js: 73-77\n    - E:\\github\\xcatliu\\cqc\\src\\JscpdChecker\\index.js: 42-64\n      E:\\github\\xcatliu\\cqc\\src\\JscpdChecker\\jscpdReporter.js: 22-44\n\nHigh complexity rate:                0.00%\nNumber of functions:                 58\nNumber of high complexity functions: 0\n```\n\n#### Set the jscpd threshold\n\n```bash\ncqc src --threshold-jscpd 3\n```\n\nOutput:\n\n```\nNumber of files:        12\nSource lines of code:   696\nDuplicate rate:         3.23%\nHigh complexity rate:   0.00%\n\nOops, duplicate rate is MORE than threshold 3%, please check the details by adding --verbose option.\n```\n\n## API\n\nIt's also able to use cqc as a node module:\n\n```js\nconst CodeQualityChecker = require('cqc');\nconst codeQualityChecker = new CodeQualityChecker();\n\n// This will return a checkerResult object which include the check result\nconst cqcResult = codeQualityChecker.check([\n    'src'\n], {\n    ext: '.js',\n    ignorePath: '.gitignore,.eslintignore',\n    ignorePattern: 'src/vendor/**/*.js,src/third-party/**/*.js',\n    filterPattern: 'src/path/to/filterPattern',\n\n    jscpdMinLines: 5,\n    jspcdMinTokens: 70,\n    complexityMax: 10,\n\n    disableBase: false,\n    disableSloc: false,\n    disableJscpd: false,\n    disableComplexity: false,\n\n    format: undefined,\n    verbose: true,\n    thresholdJscpd: 3,\n    thresholdComplexity: 10\n});\n\n// Calling report function will console.log result like cli did\ncqcResult.report({\n    format: undefined,\n    verbose: true,\n    thresholdJscpd: 3,\n    thresholdComplexity: 10\n});\n```\n\n## Concept Definition\n\nConcept | Definition\n------- | ----------\nNumber of files             | The number of input files\nSource lines of code        | The lines of code except commants and blank lines\nLines of duplicated code    | Lines of code (more than 5 lines or more than 70 tokens) which is exactly the same between two files, or in different place of one file\nDuplicate rate              | Lines of duplicated code / Source lines of code\nComplexity                  | https://en.wikipedia.org/wiki/Cyclomatic_complexity\nNumber of functions         | The number of functions\nNumber of high complexity functions | The number of functions which has complexity more than 10\nHigh complexity rate        | Number of high complexity functions / Number of functions\n","readmeFilename":"README.md"}