kucherenko / jscpd

Copy/paste detector for programming source code.
MIT License
4.7k stars 203 forks source link

Running jscpd against Vue.js files and template blocks #497

Open franck-grenier opened 3 years ago

franck-grenier commented 3 years ago

Hello jscpd, I'm setting up your great tool on a Vue.js project and I'm getting a lot of clones, some of them not really pertinent in my opinion and my context.

Is-it possible to disable inspection of <template> blocks in .vue files ? While keeping <script> blocks inspected.

That could allow us to focus on JS logic duplications.

Thanks !

kucherenko commented 3 years ago

Thank you for the feature request, it should be useful functionality.

franck-grenier commented 2 years ago

Hello Andrey, As an example of irrelevant markup duplication report, have a look at the clone below (pure HTML Bootstrap markup) :

    </div>                                                           
</div>                                                               
<footer class="row">                                                 
    <div class="col" />                                              
    <div class="col col-auto mobile-fixed-fullscreen-button d-flex"> 
        <div                                                         
            class="btn hub-btn-outline-medium-grey     

By the way, all clones in my reports, even in <script> part of .vue files, are mentioned as markup :

Clone found (markup):
 - components/Modals/FormEmail2.vue [187:10 - 200:13] (13 lines, 68 tokens)
   components/Modals/FormProfilePicture.vue [233:28 - 246:14]
 187 │ 233 │                                                                                 
 188 │ 234 │                                                                                 
 189 │ 235 │                 this.resolvePromise = async (params) => {                       
 190 │ 236 │                     try {                                                       
 191 │ 237 │                         await callback(params);                                 
 192 │ 238 │                         resolve(params);                                        
 193 │ 239 │                     } catch ({response}) {                                      
 194 │ 240 │                         throw this.formErrors.apiError = response.data.message; 
 195 │ 241 │                     }                                                           
 196 │ 242 │                 };                                                              
 197 │ 243 │                 this.rejectPromise = reject;                                    
 198 │ 244 │             });                                                                 
 199 │ 245 │         },                                                                      
 200 │ 246 │         async validateForm

I guess it's a bug.

I'm running jscpd 3.3.26.

J3m5 commented 8 months ago

Hello That would indeed be very useful. Has there been any progress in this direction?