npmjs.com 如何计算代码质量
How npmjs.com calculates the code quality
当我们发布一个包到npm时,它会在搜索页面显示一些数据,比如流行度、质量、维护情况(示例图如下)。
我只是想知道 npm 是如何计算质量的?如果有人能提供一些线索,我将不胜感激。
如果你在搜索页面上看,你可以看到这个。见搜索页右侧:npm search for "react"
编辑,2020 年 1 月: NPM 不再显示 “由 npms.io”提供支持。我不知道这是否仍然准确。
原回答
npm shows these graphs in search results, but they do not calculate these values themselves. If you look below the search results, you'll see "Powered by npms.io".
根据这项服务,他们不检查代码,而是使用以下指标来衡量代码质量:
- 有README吗?有执照吗?有
.gitignore
和朋友吗?
- 版本稳定吗(
> 1.x.x
)?它被弃用了吗?
- 有测试吗?他们的覆盖率是多少?构建是否通过?
- 有过时的依赖项?他们有漏洞吗?
- 有自定义网站吗?有徽章?
- 是否配置了 linters?
Quality includes considerations such as the presence of a README file, stability, tests, up-to-date dependencies, custom website, and code complexity.
https://docs.npmjs.com/searching-for-and-choosing-packages-to-download
当我们发布一个包到npm时,它会在搜索页面显示一些数据,比如流行度、质量、维护情况(示例图如下)。 我只是想知道 npm 是如何计算质量的?如果有人能提供一些线索,我将不胜感激。
如果你在搜索页面上看,你可以看到这个。见搜索页右侧:npm search for "react"
编辑,2020 年 1 月: NPM 不再显示 “由 npms.io”提供支持。我不知道这是否仍然准确。
原回答
npm shows these graphs in search results, but they do not calculate these values themselves. If you look below the search results, you'll see "Powered by npms.io".
根据这项服务,他们不检查代码,而是使用以下指标来衡量代码质量:
- 有README吗?有执照吗?有
.gitignore
和朋友吗? - 版本稳定吗(
> 1.x.x
)?它被弃用了吗? - 有测试吗?他们的覆盖率是多少?构建是否通过?
- 有过时的依赖项?他们有漏洞吗?
- 有自定义网站吗?有徽章?
- 是否配置了 linters?
Quality includes considerations such as the presence of a README file, stability, tests, up-to-date dependencies, custom website, and code complexity.
https://docs.npmjs.com/searching-for-and-choosing-packages-to-download