Coder Social home page Coder Social logo

terryyin / lizard Goto Github PK

View Code? Open in Web Editor NEW
1.8K 55.0 244.0 2.6 MB

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.

License: Other

Makefile 0.13% Python 53.36% XSLT 0.28% C 0.01% HTML 12.98% CSS 0.51% Shell 0.06% PHP 0.58% JavaScript 9.80% Hack 0.04% Nix 0.12% Less 22.12%

lizard's Introduction

Web Site Lizard

https://travis-ci.org/terryyin/lizard.png?branch=master

Lizard is an extensible Cyclomatic Complexity Analyzer for many programming languages including C/C++ (doesn't require all the header files or Java imports). It also does copy-paste detection (code clone detection/code duplicate detection) and many other forms of static code analysis.

A list of supported languages:

  • C/C++ (works with C++14)
  • Java
  • C# (C Sharp)
  • JavaScript (With ES6 and JSX)
  • TypeScript
  • Objective-C
  • Swift
  • Python
  • Ruby
  • TTCN-3
  • PHP
  • Scala
  • GDScript
  • Golang
  • Lua
  • Rust
  • Fortran
  • Kotlin
  • Solidity
  • Erlang

By default lizard will search for any source code that it knows and mix all the results together. This might not be what you want. You can use the "-l" option to select language(s).

It counts

  • the nloc (lines of code without comments),
  • CCN (cyclomatic complexity number),
  • token count of functions.
  • parameter count of functions.

You can set limitation for CCN (-C), the number of parameters (-a). Functions that exceed these limitations will generate warnings. The exit code of lizard will be none-Zero if there are warnings.

This tool actually calculates how complex the code 'looks' rather than how complex the code really 'is'. People will need this tool because it's often very hard to get all the included folders and files right when they are complicated. But we don't really need that kind of accuracy for cyclomatic complexity.

It requires python2.7 or above (early versions are not verified).

Installation

lizard.py can be used as a stand alone Python script, most functionalities are there. You can always use it without any installation. To acquire all the functionalities of lizard, you will need a proper install.

python lizard.py

If you want a proper install:

[sudo] pip install lizard

Or if you've got the source:

[sudo] python setup.py install --prefix=/path/to/installation/directory/

Usage

lizard [options] [PATH or FILE] [PATH] ...

Run for the code under current folder (recursively):

lizard

Exclude anything in the tests folder:

lizard mySource/ -x"./tests/*"

Options

-h, --help            show this help message and exit
--version             show program's version number and exit
-l LANGUAGES, --languages LANGUAGES
                      List the programming languages you want to analyze. if left empty, it'll
                      search for all languages it knows. `lizard -l cpp -l java`searches for
                      C++ and Java code. The available languages are: cpp, java, csharp,
                      javascript, python, objectivec, ttcn, ruby, php, swift, scala, GDScript,
                      go, lua, rust, typescript
-V, --verbose         Output in verbose mode (long function name)
-C CCN, --CCN CCN     Threshold for cyclomatic complexity number warning. The default value is
                      15. Functions with CCN bigger than it will generate warning
-f INPUT_FILE, --input_file INPUT_FILE
                      get a list of filenames from the given file
-o OUTPUT_FILE, --output_file OUTPUT_FILE
                      Output file. The output format is inferred from the file extension (e.g.
                      .html), unless it is explicitly specified (e.g. using --xml).
-L LENGTH, --length LENGTH
                      Threshold for maximum function length warning. The default value is 1000.
                      Functions length bigger than it will generate warning
-a ARGUMENTS, --arguments ARGUMENTS
                      Limit for number of parameters
-w, --warnings_only   Show warnings only, using clang/gcc's warning format for printing
                      warnings. http://clang.llvm.org/docs/UsersManual.html#cmdoption-
                      fdiagnostics-format
--warning-msvs        Show warnings only, using Visual Studio's warning format for printing
                      warnings. https://msdn.microsoft.com/en-us/library/yxkt8b26.aspx
-i NUMBER, --ignore_warnings NUMBER
                      If the number of warnings is equal or less than the number, the tool will
                      exit normally; otherwise, it will generate error. If the number is
                      negative, the tool exits normally regardless of the number of warnings.
                      Useful in makefile for legacy code.
-x EXCLUDE, --exclude EXCLUDE
                      Exclude files that match the pattern. * matches everything, ? matches any
                      single character, "./folder/*" exclude everything in the folder
                      recursively. Multiple patterns can be specified. Don't forget to add ""
                      around the pattern.
-t WORKING_THREADS, --working_threads WORKING_THREADS
                      number of working threads. The default value is 1. Using a bigger number
                      can fully utilize the CPU and often faster.
-X, --xml             Generate XML in cppncss style instead of the tabular output. Useful to
                      generate report in Jenkins server
--csv                 Generate CSV output as a transform of the default output
-H, --html            Output HTML report
-m, --modified        Calculate modified cyclomatic complexity number , which count a
                      switch/case with multiple cases as one CCN.
-E EXTENSIONS, --extension EXTENSIONS
                      User the extensions. The available extensions are: -Ecpre: it will ignore
                      code in the #else branch. -Ewordcount: count word frequencies and
                      generate tag cloud. -Eoutside: include the global code as one function.
                      -EIgnoreAssert: to ignore all code in assert. -ENS: count nested control
                      structures.
-s SORTING, --sort SORTING
                      Sort the warning with field. The field can be nloc,
                      cyclomatic_complexity, token_count, parameter_count, etc. Or an customized field.
-T THRESHOLDS, --Threshold THRESHOLDS
                      Set the limit for a field. The field can be nloc, cyclomatic_complexity,
                      token_count, parameter_count, etc. Or an customized file. Lizard will
                      report warning if a function exceed the limit
-W WHITELIST, --whitelist WHITELIST
                      The path and file name to the whitelist file. It's './whitelizard.txt' by
                      default. Find more information in README.

Example use

Analyze a folder recursively: lizard mahjong_game/src

==============================================================
  NLOC    CCN  token  param    function@line@file
--------------------------------------------------------------
    10      2     29      2    start_new_player@26@./html_game.c
   ...
     6      1      3      0    set_shutdown_flag@449@./httpd.c
    24      3     61      1    server_main@454@./httpd.c
--------------------------------------------------------------
2 file analyzed.
==============================================================
LOC    Avg.NLOC AvgCCN Avg.ttoken  function_cnt    file
--------------------------------------------------------------
    191     15      3        51        12     ./html_game.c
    363     24      4        86        15     ./httpd.c

======================================
!!!! Warnings (CCN > 15) !!!!
======================================
    66     19    247      1    accept_request@64@./httpd.c
=================================================================================
Total NLOC  Avg.NLOC  Avg CCN  Avg token  Fun Cnt  Warning cnt   Fun Rt   NLOC Rt
--------------------------------------------------------------------------------
       554        20     4.07      71.15       27            1      0.04    0.12

Warnings only (in clang/gcc formation):lizard -w mahjong_game

./src/html_ui/httpd.c:64: warning: accept_request has 19 CCN and 1 params (66 NLOC, 247 tokens)
./src/mahjong_game/mj_table.c:109: warning: mj_table_update_state has 20 CCN and 1 params (72 NLOC, 255 tokens)

Set warning threshold for any field:lizard -T nloc=25

The option -Tcyclomatic_complexity=10 is equal to -C10. The option -Tlength=10 is equal to -L10. The option -Tparameter_count=10 is equal to -a10.

You can also do -Tnloc=10 to set the limit of the NLOC. Any function that has NLOC greater than 10 will generate a warning.

Generated code

Lizard has a simple solution with generated code. Any code in a source file that is following a comment containing "GENERATED CODE" will be ignored completely. The ignored code will not generate any data, except the file counting.

Code Duplicate Detector

lizard -Eduplicate <path to your code>

Generate A Tag Cloud For Your Code

You can generate a "Tag cloud" of your code by the following command. It counts the identifiers in your code (ignoring the comments).

lizard -EWordCount <path to your code>

Using lizard as Python module

You can also use lizard as a Python module in your code:

>>> import lizard
>>> i = lizard.analyze_file("../cpputest/tests/AllTests.cpp")
>>> print i.__dict__
{'nloc': 9, 'function_list': [<lizard.FunctionInfo object at 0x10bf7af10>], 'filename': '../cpputest/tests/AllTests.cpp'}
>>> print i.function_list[0].__dict__
{'cyclomatic_complexity': 1, 'token_count': 22, 'name': 'main', 'parameter_count': 2, 'nloc': 3, 'long_name': 'main( int ac , const char ** av )', 'start_line': 30}

You can also use source code string instead of file. But you need to provide a file name (to identify the language).

>>> i = lizard.analyze_file.analyze_source_code("AllTests.cpp", "int foo(){}")

Whitelist

If for some reason you would like to ignore the warnings, you can use the whitelist. Add 'whitelizard.txt' to the current folder (or use -W to point to the whitelist file), then the functions defined in the file will be ignored. Please notice that if you assign the file pathname, it needs to be exactly the same relative path as Lizard to find the file. An easy way to get the file pathname is to copy it from the Lizard warning output. This is an example whitelist:

#whitelizard.txt
#The file name can only be whitelizard.txt and put it in the current folder.
#You may have commented lines begin with #.
function_name1, function_name2 # list function names in multiple lines or split with comma.
file/path/name:function1, function2  # you can also specify the filename

Options in Comments

You can use options in the comments of the source code to change the behavior of lizard. By putting "#lizard forgives" inside a function or before a function it will suppress the warning for that function.

int foo() {
    // #lizard forgives the complexity
    ...
}

Limitations

Lizard requires syntactically correct code. Upon processing input with incorrect or unknown syntax:

  • Lizard guarantees to terminate eventually (i.e., no forever loops, hangs) without hard failures (e.g., exit, crash, exceptions).

  • There is a chance of a combination of the following soft failures:

    • omission
    • misinterpretation
    • improper analysis / tally
    • success (the code under consideration is not relevant, e.g., global macros in C)

This approach makes the Lizard implementation simpler and more focused with partial parsers for various languages. Developers of Lizard attempt to minimize the possibility of soft failures. Hard failures are bugs in Lizard code, while soft failures are trade-offs or potential bugs.

In addition to asserting the correct code, Lizard may choose not to deal with some advanced or complicated language features:

  • C/C++ digraphs and trigraphs are not recognized.
  • C/C++ preprocessing or macro expansion is not performed. For example, using macro instead of parentheses (or partial statements in macros) can confuse Lizard's bracket stacks.
  • Some C++ complicated templates may cause confusion with matching angle brackets and processing less-than < or more-than > operators inside of template arguments.

Literatures Referring to Lizard

Lizard is often used in software related researches. If you used it to support your work, you may contact the lizard author to add your work in the following list.

Lizard is also used as a plugin for fastlane to help check code complexity and submit xml report to sonar.

lizard's People

Contributors

alyssawangqq avatar apollux avatar coeur avatar corentin-plouet avatar dutchedge avatar e28eta avatar elmotec avatar feikou avatar friederbluemle avatar gacekjk avatar gcssloop avatar gustafj avatar hallta avatar janneronkko avatar jxieeducation avatar ligurio avatar luisfpereira avatar mazunki avatar mdmedley avatar mehrdad89 avatar penduo avatar petersw avatar rakhimov avatar reallyliri avatar serjant avatar shake551 avatar terryyin avatar trouvant avatar wonshtrum avatar yalechen-cyw3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lizard's Issues

Hang on some python files

Lizard gets stuck on some python files. Sample
https://www.dropbox.com/s/wjl70kodhb3qtlu/cp037.py

$ ~/repository/lizard/lizard cp037.py 
========================================
  NLOC    CCN   token  PARAM  location  
----------------------------------------
^C
Traceback (most recent call last):
  File "/home/cocobo/repository/lizard/lizard", line 6, in <module>
    lizard_main(sys.argv)
  File "/home/cocobo/repository/lizard/lizard.py", line 944, in lizard_main
    printer(result, options)
  File "/home/cocobo/repository/lizard/lizard.py", line 821, in print_result
    code_infos, option.extensions, scheme)
  File "/home/cocobo/repository/lizard/lizard.py", line 789, in print_and_save_modules
    for module_info in all_modules:
  File "/home/cocobo/repository/lizard/lizard.py", line 644, in __call__
    filename, open(filename, 'rU').read())
  File "/home/cocobo/repository/lizard/lizard.py", line 653, in analyze_source_code
    tokens = reader.generate_tokens(code)
  File "/home/cocobo/repository/lizard/lizard_ext/python.py", line 23, in generate_tokens
    r"|\'\'\'.*?\'\'\'" + r'|\"\"\".*?\"\"\"')
  File "/home/cocobo/repository/lizard/lizard.py", line 367, in generate_tokens
    return [t for t in _generate_tokens(source_code, addition)]
  File "/home/cocobo/repository/lizard/lizard.py", line 352, in _generate_tokens
    for token in token_pattern.findall(source_code):
KeyboardInterrupt

about filename in whitelizard.txt

Actually, it's path not filename.
You have to type the path instead of only filename.
I think the explanation in readme is too vague

Don't print result status when everything is ok

Hello,
I am using lizard as part of a larger code checking framework at work and therefore need to parse its output (great tool that works without much fiddling, by the way). In case no problems are found, a "No warning found. Excellent!" message is printed. I believe the more unix-oid way would be to print nothing and just quit quietly (that would also make parsing more straightforward). Do you think you could change this for the default settings or add a "--quiet" option or show it only for "--verbose"?
Thanks and best regards

Wrong CCN of Python file

Hi!

I stumbled upon a Python file at work for which lizard calculates a wrong CCN.

# code somewhat simplified
def method1(self):
    pass

class Class1(object):
    def method2(self):

        if True:
            pass
        if True:
            pass

        def method1(param):
            for x in (1,2):
                pass

        if True:
            pass

        if True:
            pass

        while True:
            if True:
                pass

            for x in (1,2):
                True

    def method3(self):
        if True:
            for x in (1,2):
                if True:
                    pass
                else:
                    pass
        if True:
            pass
        else:
            pass

    def method4(self):
        if True:
            pass

        if True:
            pass

        if True:
            if True
                pass

        if True:
            if True:
                pass

        if True:
            pass
        else:
            pass

def memoize(obj):
    obj.cache = {}

Lizard tells me that method1() ranges from line 1 to line 62 and has a CCN of 20. If I remove the last two lines (memoize()), it works as expected.

Bye, Robert

Btw: lizard is a great tool and I use it every day.

Inifinite loop on python2.6

Greetings,
I tried to run hfcca.py on python2.6 and it enters an infinite loop, unfortunately i was unable to gather much info on where to start debugging.

Currently, when i try leave the process by CTRL+C, I only get ^C on the screen. Only killing python gives the prompt back.

I get no error message nor anything except the following lines:

NLOC CCN token param function@line@file

Unfortunatelly the machines where i need to run hfcca are debian 6 (python 2.6 by default) and it's out of the question install 2.7.4 on each one.

Thanks for any info

CPP, problem introduced in lizard

Hi,

I am using my forked version of you repo (https://github.com/norkos/lizard.git) which is quite old one. While changing to new version I have met problem in files like:

include

class Timer{

ifndef TEST

Timer(int j);

else

Timer();

endif

};

ifndef TEST

Timer::Timer(int j)
{

else

Timer::Timer()
{

endif

for (int i = 0; i < 10; i++)
{
}

ifndef TEST

std::cout << "Branch";

endif

}

int main(){
return 0;
}

No function is find in this file.

NLOC Avg.NLOC AvgCCN Avg.ttoken function_cnt file

 17      0    0.0         0         0     check.cpp

Previously I had:

nloc CCN token param function@line@file

10      3     32      1    Timer::Timer@[email protected]
 1      1      3      0    main@[email protected]

Could you please help me ? Thank you in advance.

btw. I am aware that this code is tricky ...

#ifndef in c++

Hi,

first of all: great tool :) I have found out that is not dealing correctly with 'ugly' ifdefs in C++.

int main(){

ifndef NORBUS

if(true){
return 1;

else

if(false){
return 0;

endif

}
return 1;

}

Could you please look at this ?

Thanks,
Norbert

Lizard failing on char sequence

Lizard fails to parse a file when (a form of) the following sequence is encounterd (in regex) [a-zA-Z]<.*>>
So the following sequence is a failing sequence: a<>>

I encounterd the bug when trying to parse a java file with the following line of code:
private static final Map<String, Map<Byte, String>> VAR_NAME = ImmutableMap.<String, Map<Byte, String>> builder()
Although this is really ugly, it is valid java.

I worked around the problem by adding a space between ">>"

Crash when parsing Linux kernel

Parsing the Linux kernel will crash with an error like this:

Traceback (most recent call last):
  File "/home/cocobo/repository/lizard/lizard", line 6, in <module>
    lizard_main(sys.argv)
  File "/home/cocobo/repository/lizard/lizard.py", line 923, in lizard_main
    printer(result, options)
  File "/home/cocobo/repository/lizard/lizard.py", line 800, in print_result
    code_infos, option.extensions, scheme)
  File "/home/cocobo/repository/lizard/lizard.py", line 768, in print_and_save_modules
    for module_info in all_modules:
  File "/home/cocobo/repository/lizard/lizard.py", line 624, in __call__
    filename, open(filename, 'rU').read())
  File "/home/cocobo/repository/lizard/lizard.py", line 635, in analyze_source_code
    for _ in tokens:
  File "/home/cocobo/repository/lizard/lizard.py", line 611, in token_processor_for_function
    reader.state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 323, in state
    self._state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 437, in _state_template_in_name
    if self.bracket_stack.pop() != "<":
IndexError: pop from empty list

The problem is in the file drivers/isdn/hardware/avm/avmcard.h
Here is a small cutout

#define SEND_POLL       0x72    /*
                     * after load <- RECEIVE_POLL
                     */
#define SEND_INIT       0x11    /*
                     * first message <- RECEIVE_INIT
                     * int32 NumApplications  int32
                     * NumNCCIs int32 BoardNumber
                     */
#define RECEIVE_POLL        0x32    /*
                     * <- after SEND_POLL
                     */
#define RECEIVE_INIT        0x27    /*
                     * <- after SEND_INIT int32 length
                     * byte total length b1struct board
                     * driver revision b1struct card
                     * type b1struct reserved b1struct
                     * serial number b1struct driver
                     * capability b1struct d-channel
                     * protocol b1struct CAPI-2.0
                     * profile b1struct capi version
                     */
#define RECEIVE_MESSAGE     0x21    /*
                     * <- after SEND_MESSAGE int32
                     * AppllID int32 Length capi-data
                     * ....
                     */
static inline void b1_put_word(unsigned int base, unsigned int val)
{
    b1_put_byte(base, val & 0xff);
    b1_put_byte(base, (val >> 8) & 0xff);
    b1_put_byte(base, (val >> 16) & 0xff);
    b1_put_byte(base, (val >> 24) & 0xff);
}

The crash seems to be caused by those <- in the comment sections.

#ifndef in c++

Hi,

please check the example:

class Constructor{
int m_timer;

public:
Constructor::Constructor()

ifdef MAGIC

:
m_timer(5)

endif

{
int a = 0;
}
};

it doesn't work correctly even when i use -P flag.

Sorry for so strange examples :) and I think your tool is great. Such a code should be avoided.

Preprocessing counting.

I am not getting the right numbers for cyclomatic_complexity for C preprocessing that is done outside of methods (i.e. it is done in the header of the file).

Is this a known issue or is there any fix for this?

Support for #elif

Hi,

please check the example:

int main(){

ifdef A

#define C

elif (defined E)

#define D

endif

return 0;

}

breaking the lizard. Thank you.

Set whitelist via flag

I have the white list for Lizard stored in a different directory than where I run Lizard from (due to build automation).
I would like to see an option to pass a white-list to Lizard via a special command line flag.

map function iterates indefinitely

The third argument in the following map function repeats indefinitely (both with preprocessor set and unset (true or false)). It worrks if the third argument is removed.
r = map(analyze_source_file, files, itertools.repeat(options.use_preprocessor))

This appends None objects to the filename list and the file open function will fail.

From "map()" Python Documentation:
"If additional iterable arguments are passed, function must take that many arguments and is applied to the items from all iterables in parallel. If one iterable is shorter than another it is assumed to be extended with None items."

Error message:

f = open(filename)
TypeError: coercing to Unicode: need string or buffer, NoneType found

Running Ubuntu 12.04

br
Simon

Swift langage support

We are using lizard on objc project (thanks you for this nice tool that improve xcode using a simple script), is there any chances that brand new Swift language will be supported ?

I have no idea on how to add support for it, maybe some indication will help to support it.

RuntimeError: maximum recursion depth exceeded error

Some files cause a maximum recursion depth exceeded error. Sample
https://www.dropbox.com/s/0pg9cwnkdoevy03/fp_and_simd.c from valgrind

Traceback (most recent call last):
  File "/home/cocobo/repository/lizard/lizard", line 6, in <module>
    lizard_main(sys.argv)
  File "/home/cocobo/repository/lizard/lizard.py", line 944, in lizard_main
    printer(result, options)
  File "/home/cocobo/repository/lizard/lizard.py", line 821, in print_result
    code_infos, option.extensions, scheme)
  File "/home/cocobo/repository/lizard/lizard.py", line 789, in print_and_save_modules
    for module_info in all_modules:
  File "/home/cocobo/repository/lizard/lizard.py", line 644, in __call__
    filename, open(filename, 'rU').read())
  File "/home/cocobo/repository/lizard/lizard.py", line 656, in analyze_source_code
    for _ in tokens:
  File "/home/cocobo/repository/lizard/lizard.py", line 631, in token_processor_for_function
    reader.state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 323, in state
    self._state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 528, in _state_old_c_params
    self._state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 528, in _state_old_c_params
    self._state(token)
...
  File "/home/cocobo/repository/lizard/lizard.py", line 528, in _state_old_c_params
    self._state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 428, in _state_global
    self.context.start_new_function(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 216, in start_new_function
    self.current_line)
RuntimeError: maximum recursion depth exceeded

headers in cpp

Hi,

as c/c++ files we use (c|C|cpp|CPP|CC|cc|mm). Unfortunately it can happen that someone will put inline functions into headers.

Could you extend this pattern for headers file ? Complexity for function declarations already works fine.

IndexError: pop from empty list errors

I ran lizard on various projects and got a bunch of pop from empty list errors. Here are some samples
https://www.dropbox.com/s/h43p1b4uozqly59/vgabios.c from qemu
https://www.dropbox.com/s/bpib35xzrq3hik3/arg9.C from gcc
https://www.dropbox.com/s/u5o94tbgn7do6d6/temp_arg_nontype.cpp from llvm
https://www.dropbox.com/s/k49d5ywfav58im0/johab.c from glibc
https://www.dropbox.com/s/slnz4uhxv8mul0h/common.h from tcmalloc

Traceback (most recent call last):
  File "/home/cocobo/repository/lizard/lizard", line 6, in <module>
    lizard_main(sys.argv)
  File "/home/cocobo/repository/lizard/lizard.py", line 944, in lizard_main
    printer(result, options)
  File "/home/cocobo/repository/lizard/lizard.py", line 821, in print_result
    code_infos, option.extensions, scheme)
  File "/home/cocobo/repository/lizard/lizard.py", line 789, in print_and_save_modules
    for module_info in all_modules:
  File "/home/cocobo/repository/lizard/lizard.py", line 644, in __call__
    filename, open(filename, 'rU').read())
  File "/home/cocobo/repository/lizard/lizard.py", line 656, in analyze_source_code
    for _ in tokens:
  File "/home/cocobo/repository/lizard/lizard.py", line 631, in token_processor_for_function
    reader.state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 323, in state
    self._state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 457, in _state_template_in_name
    if self.bracket_stack.pop() != "<":
IndexError: pop from empty list

#ifndef in c++

Hi,

first of all: great tool :) I have found out that is not dealing correctly with 'ugly' ifdefs in C++.

int main(){

ifndef NORBUS

if(true){
    return 1;

else

if(false){
    return 0;

endif

}
    return 1;

}

Could you please look at this ?

Thanks,
Norbert

Rename hfcca

Hfcca has already got a little user base. But the hfcca is hard to pronounce (even I don't know how to pronounce it.)

So better use a different name.

add support for `--version` option

Please add support to trace the current version number and exit when invoked with --version, e.g.:

$ ./hfcca.py --version
hfcca 1.6.0

support js

Hi

so could lizard support JS?

thanks!

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.