在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):oddjobsman/gulp-sloc开源软件地址(OpenSource Url):https://github.com/oddjobsman/gulp-sloc开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-slocA port of the grunt-sloc plugin for gulp with some minor changes. UsageFirst install the npm install --save-dev gulp-sloc Then, add it to your var sloc = require('gulp-sloc');
gulp.task('sloc', function(){
gulp.src(['scripts/*.js'])
.pipe(sloc());
}); This would output the following: [gulp] -------------------------------
[gulp] physical lines : 135
[gulp] lines of source code : 97
[gulp] total comment : 5
[gulp] singleline : 5
[gulp] multiline : 0
[gulp] empty : 33
[gulp]
[gulp] number of files read : 2
[gulp] strict mode
[gulp] ------------------------------- APIsloc(options)options.tolerantType: Set as false to analyze only files with a subset of popular extensions. true to analyze files with any file extension. The default is false. If true, the SLOC will be executed on all of the files specified, regardless of file extension. With options.reportTypeType: It will generate a JSON file with the SLOC analysis results and sends it further downstream. Use with the var sloc = require('gulp-sloc');
gulp.task('sloc', function(){
gulp.src(['lib/**/*.js'])
.pipe(sloc({
reportType: 'json'
}))
.pipe(gulp.dest('./reports/'));
}); Would output the following in the file {"loc":138,"sloc":100,"cloc":5,"scloc":5,"mcloc":0,"nloc":33,"file":2} options.reportFileType: The name of the file which would contain you'd like to output the JSON file. Use with the var sloc = require('gulp-sloc');
gulp.task('sloc', function(){
gulp.src(['./test/**/*.js'])
.pipe(sloc({
reportType: 'json',
reportFile: 'testSloc.json'
}))
.pipe(gulp.dest('./reports/'));
}); Would output the sloc results in the file Supported Languages and Extensions
Contributing
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论