rhiokim / grunt-sloc

Source line of codes plugin for Grunt.js
MIT License
23 stars 12 forks source link

Not working as intended #15

Closed jbubsk closed 8 years ago

jbubsk commented 10 years ago

There is problem for me with line counting , I'm using OS X Mavericks 10.9.4, grunt-sloc 0.5.2. And after running task through all files there're just zero's

Running "sloc:main" (sloc) task
Verifying property sloc.main exists in config...OK
Files: scripts/angular/application.js, scripts/angular/config/config.js, scripts/angular/controller/accounts.js, scripts/angular/controller/authentication.js, scripts/angular/controller/cards.js, scripts/angular/controller/controllers.js, scripts/angular/controller/footer.js, scripts/angular/controller/information.js, scripts/angular/controller/information_header.js, scripts/angular/controller/menu_navigation.js, scripts/angular/controller/payments.js, scripts/angular/directive/datePicker.js, scripts/angular/interceptor/responseError.js, scripts/angular/jettap.js, scripts/angular/router/routers.js, scripts/angular/service/authentication.js, scripts/angular/service/services.js, scripts/angular/templates/templates.js -> src
Options: reportType="stdout", reportPath=null, reportDetail, tolerant=false

  physical lines         0       
  lines of source code   0       
  total comment          0       
  singleline             0                 
  multiline              0                 
  empty                  0       

  number of files read   0       
  mode                   strict  

.
 |
-|
'

Done, without errors.
Process finished with exit code 0
YouriT commented 9 years ago

What's your config ? It's not very well explained in the doc, I got it by introspecting the lib but in fact what you will need to understand is the following

files: {
    'target': [FILES...]
}

means a weird thing which is : target = base directory and then files means look for files within this "target" directory. So for example I'm using this config :

sloc: {
    all: {
        files: {
            '.': [
                ['src/**/*.js']
            ]
        }
    }
}

so the task will try to do ./src/...... .js

Great work apart that but a little explanation in the doc would be perfect :)

samhmills commented 9 years ago

Yea that's not very well explained at all, thanks @YouriT your example worked great for me!