danielstjules / jsinspect

Detect copy-pasted and structurally similar code
MIT License
3.56k stars 128 forks source link

add options.lineNumber & markdown reporter #75

Closed Froguard closed 11 months ago

Froguard commented 6 years ago

This PR offer 2 cases:

  1. Add options.lineNumber for print out file .jsinspectrc
    {
    "lineNumber": true
    }

    result:

    ./src/index.js:62,65
    62 │ methods: {
    63 │     hahahaha() {
    64 │         return (n) => {
    65 │             if(!n) {
  2. Add a new reporter (named 'md' or 'markdown') to support markdown file .jsinspectrc
    {
    "lineNumber": true,
    "reporter": "md" // or "markdown"
    }

    u can use cmd like

jsinspect > ./your/path/check-report.md

to gen a *.md file

oleg-koval commented 6 years ago

@Froguard damn, your PR solves my needs :) why it's not merged? :)

Froguard commented 6 years ago

@oleg-koval The gulp-pugin gulp-jsinspecty may solve your problem temporarily,before PR was merged。

var gulp = require('gulp');
var jsinspecty = require('gulp-jsinspecty');

gulp.task('default', function () {
  return gulp.src([
      'src/**/*.js',
      '!*.test.js'  
  ])
    .pipe(jsinspecty({
        lineNumber: true,
        reporter: 'markdown', // or a shortner 'md' 
        reportFilename: 'result.md'
    })) // you can also set options in .jsinspectrc file
    .pipe(gulp.dest('./')); // generate a file 'result.md'
});

gulp-jsinspecty is inspired by gulp-jsinspect

oleg-koval commented 6 years ago

@Froguard thanks for the help :) unfortunately can't use gulp for one of the projects, will wait this PR to merge