Giter Site home page Giter Site logo

grunt-sloc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grunt-sloc's Issues

number of files read === 0

I tried to configure sloc and with --verbose. I can see a lot of selected files, but the number of files read is always zero.

			sloc: {
				'count': {
					options: {
						tolerant: true,
						reportDetail: true,
						reportType: "stdout"
					},
					files: {
						'.': ['<%= dir.src %>/**']

					}
				},
			},
...

image

Can anyone help me?

grunt sloc ignores files - Maybe side effect fix for #14

grunt sloc seems to be ignoring many files which are included in the src pattern.

To be more specific, here's my sloc config:

sloc: {
  'mylib': {
    files: {
      'mylib': ['*.js']
    }
  }
}

and here's my directory structure:

mylib/
mylib/one.js
mylib/two.js
mylib/util
mylib/util/three.js

number of files read by grunt sloc is zero. It should have been 2 files.

The problem does not occur after commenting out these lines related to solving issue #14:

    #14 negate match
     if (grunt.file.match(srcFilters, [f]).length === 0) {
        return;
     }

In the above code, f is an absolute path which seems to be the reason of the problem. One solution would have been to replace the above if condition with something like:

     var relPath = path.relative(path.join(process.cwd(), dest), f);
     if (grunt.file.match(srcFilters, [relPath ]).length === 0) {    

However after doing the above fix, src patterns such as **.js do not work.

I would think that instead of using readDir.readSync grunt's files.src.filter would do a better job. If you'd like to try this way, I can try to send a PR over the weekend.

Does not appear to be working

app
|-- Gruntfile.js
|-- notes.txt

[email protected]
grunt-sloc 0.4.2
grunt-cli v0.1.11
grunt v0.4.2
Mac OS X 10.9.1

'sloc': {
    'files': {
        './' : ['*.txt'],
    }
},

Upon cd app; grunt 'sloc', I only get:

Running "sloc:files" (sloc) task

Done, without errors.

Am I missing something?

Not working as intended

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

Cannot benefit from grunt negate matches

I would like to be able to exclude files from the directories to be parsed. For example, I would like to specify:

css: {
   'src/client': [ '**/**.styl', '!**/libs/**' ]
}

You could support them with the following lines added before the call to sloc(source, ext):

if (grunt.file.match(srcFilters, [f]).length === 0) {
   return;
}

Thanks, Dom

Support LESS

I was looking through the code. I see it supports SASS. Is there any change besides adding an entry for less in the array to support LESS? If this is the case, can I submit a PR for it?

Not working as intended

Directory:

app
|-- gruntfile.js
|-- server.js

In gruntfile.js:

sloc: {
        files: {
            './' : [ 'server.js' ],
                    }
     },

Terminal:

grunt sloc
Running "sloc:files" (sloc) task

Done, without errors.

? Windows.

Multiple Tasks Combine Results Instead of Staying Separate

I am using the following, and the output combines the first result (server) into the second report (client), instead of separating the two results.

sloc: {
    server: {
        files: {
            'server': ['**/*.js'],
            './': ['Gruntfile.js', 'server.js']
        }
    },
    client: {
        files: {
            'client': ['index.html']
        }
    }
},

OUTPUT:

Running "sloc:server" (sloc) task

physical lines : 221
lines of source code : 152
total comment : 47
singleline : 47
multiline : 0
empty : 22

number of files read : 2


Running "sloc:client" (sloc) task

physical lines : 379
lines of source code : 295
total comment : 47
singleline : 47
multiline : 0
empty : 37

number of files read : 3

All 0s in generated JSON file

When I run the following command:

                jformDistJson: {
                    options: {
                        reportType: 'json',
                        reportPath: '../doc/sloc/jform-dist-sloc-<%= pkg.version %>.json',
                    },
                    files: {
                        '../js': ['jForm/*.js']
                    }
                }

It produces this output:

Running "sloc:jformDistJson" (sloc) task
Create at: ../doc/sloc/jform-dist-sloc-1.7.1.json

Done, without errors.

I get all 0s in the JSON output:

{
  "total": 0,
  "source": 0,
  "comment": 0,
  "single": 0,
  "mixed": 0,
  "empty": 0,
  "block": 0,
  "file": 0
}

I am using:
Windows 2008 R2
grunt 0.4.5
grunt-sloc 0.7.1
sloc 0.1.10
node.js 4.4.0

This same relative path works in all of my other grunt tasks. In fact, I've tried seemingly every combination of absolute and relative paths and I get the same result. Can you please help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.