简体   繁体   English

npmjs.com 如何计算代码质量

[英]How npmjs.com calculates the code quality

When we publish a package to npm, it will show us some data such as popularity, quality, and maintenance in the search page (The example image is blow).当我们将一个包发布到 npm 时,它会在搜索页面中向我们展示一些诸如流行度、质量、维护等数据(示例图片是吹的)。 I just wonder how npm calculates the quality?我只是想知道 npm 如何计算质量? Really appreciate if someone can give some clue.如果有人可以提供一些线索,真的很感激。

在此处输入图片说明

You can see this if you look on the search page.如果您查看搜索页面,您可以看到这一点。 See the right side of search page: npm search for "react"查看搜索页面右侧: npm search for "react"

Edit, january 2020: NPM does not show "Powered by npms.io" anymore.编辑,2020 年 1 月: NPM 不再显示“Powered by npms.io” I don't know if this is still accurate.我不知道这是否仍然准确。


Original answer原答案

npm shows these graphs in search results, but they do not calculate these values themselves. npm在搜索结果中显示这些图表,但它们本身不计算这些值。 If you look below the search results, you'll see "Powered by npms.io ".如果您查看搜索结果下方的内容,您将看到“Powered by npms.io ”。

According to this service, they don't inspect the code, but use the following metrics to measure code quality:根据这项服务,他们不检查代码,而是使用以下指标来衡量代码质量:

  • Has README?有自述文件吗? Has license?有执照吗? Has .gitignore and friends?.gitignore和朋友吗?
  • Is the version stable ( > 1.xx )?版本是否稳定( > 1.xx )? Is it deprecated?它被弃用了吗?
  • Has tests?有测试吗? What's their coverage %?他们的覆盖率是多少? Is the build passing?构建通过了吗?
  • Has outdated dependencies?是否有过时的依赖项? Do they have vulnerabilities?他们有漏洞吗?
  • Has custom website?有自定义网站吗? Has badges?有徽章吗?
  • Are there linters configured?是否配置了 linter?

Source: https://npms.io/about来源: https : //npms.io/about

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM