Menu

Tree [r20] /
 History

HTTPS access


File Date Author Commit
 doc 2022-05-24 henkidefix [r17] added documentation
 examples 2023-07-31 henkidefix [r19] add julia script to examples
 test 2019-08-20 henkidefix [r12] add unittest
 Licence.txt 2017-12-25 henkidefix [r1] initial commmit
 clocpy.py 2024-05-11 henkidefix [r20] print results dorted
 detect-binairy-file.txt 2017-12-25 henkidefix [r1] initial commmit
 pylintrc 2018-07-11 henkidefix [r4] refactor to improve reading and testing
 readme.txt 2022-05-24 henkidefix [r17] added documentation
 requirements.txt 2021-11-03 henkidefix [r16] migrate to f-strings (python 3.6)
 versioninfo.txt 2023-07-31 henkidefix [r19] add julia script to examples

Read Me

Python Count Lines of Code.

   This program read source code,
   ignore the comment and count the lines with real code.
   
   CLOC is a linux program that everyone uses,
   but i found for my projects it has some issues
   specilally when multiple languages are used.
   This python program's output was modelled much like the original cloc.
   
   If you don't like this program, the original CLOC by AlDanial 
   may just suit your needs: https://github.com/AlDanial/cloc
   
   Program: clocpy
   Author:  Henk Speksnijder
   Date     14 july 2018
   Licence: MIT
   Default it does NOT report binary files.
   -b      = do report the binary files.
   Default it does not recurse subdirectories.
   -r      = recurse into subdirectories.


clocpy detect these variants

- bash
    see txt
- julia
    whitespace              = space, tab
    comment one line        = #
    comment multi line start= #=
    comment multi line stop = =#
- nim
    whitespace              = space, tab
    comment one line        = #
    comment multi line start= #[
    comment multi line stop = ]#
- python
    whitespace              = space, tab  
    comment one line        = #  
    comment multi line start= triple quote  
    comment multi line stop = triple quote  
- pascal
    whitespace              = space, tab
    comment one line        = //
    comment multi line start= (*   /old, not accepted/
    comment multi line stop = *)   /old, not accepted/
    comment multi line start= {
    comment multi line stop = }
    Note something like {mode}{H+} is counted as code !
- c++
    whitespace              = space, tab
    comment one line        = //
    comment multi line start= /*
    comment multi line stop = */
- txt
    whitespace              = space, tab
    comment one line        = #
    comment multi line start= NoMultilineComment
    comment multi line stop = NoMultilineComment

20180714 added scanning multi-line comment for julia and nim.
20151225 finally exactly the same result from all 4 versions.

*Henk Speksnijder 20171118*