npmjs.com如何计算代码质量 [英] How npmjs.com calculates the code quality

查看:155
本文介绍了npmjs.com如何计算代码质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们将软件包发布到npm时,它将在搜索页面中向我们显示一些数据,例如受欢迎程度,质量和维护(示例图像为实拍). 我只是想知道npm如何计算质量?如果有人可以提供一些线索,请多多关照.

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). I just wonder how npm calculates the quality? Really appreciate if someone can give some clue.

如果您在搜索页面上查看,可以看到此信息.请参阅搜索页面的右侧: npm搜索反应"

You can see this if you look on the search page. See the right side of search page: npm search for "react"

推荐答案

npm 确实会在搜索结果中显示这些图,但它们本身不会计算这些值.如果您在搜索结果下方查看,则会看到由 npms.io ".

根据这项服务,他们不会检查代码,而是使用以下指标来衡量代码质量:

According to this service, they don't inspect the code, but use the following metrics to measure code quality:

  • 有自述文件吗?有执照吗?有.gitignore和朋友吗?
  • 版本是否稳定(> 1.x.x)?是否已弃用?
  • 有测试吗?他们的覆盖率是多少?构建通过了吗?
  • 有过时的依赖关系吗?他们有漏洞吗?
  • 有自定义网站吗?有徽章吗?
  • 是否配置了短毛猫?
  • Has README? Has license? Has .gitignore and friends?
  • Is the version stable (> 1.x.x)? 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?

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

编辑,2020年1月::NPM不再显示由npms.io提供支持" .我不知道这是否仍然正确.

Edit, january 2020: NPM does not show "Powered by npms.io" anymore. I don't know if this is still accurate.

这篇关于npmjs.com如何计算代码质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆