neuron-explorer
Qwen3.5‑4B 전용 조향형 뉴런 탐색기, 모든 MLP 뉴런을 밀어 결과를 보관·탐색
C/C++ 헤더나 Java import에 구애받지 않는 간단한 코드 복잡도 분석기로 대부분 언어 지원
A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
개발 도구JavaScript · PythonGitHub @terryyin직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
설치형 프로젝트는 배포 도메인 없이도 확인할 수 있습니다. 개인 저장소는 GitHub 로그인으로, 조직 저장소는 위의 저장소 확인 파일로 직접 확인해 주세요.
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
README 전체를 불러오는 중입니다.
README 전문 보기 ↗.. image:: https://badge.fury.io/py/lizard.svg :target: https://badge.fury.io/py/lizard .. |Web Site| image:: http://www.lizard.ws/website/static/img/logo-small.png :target: http://www.lizard.ws
|
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:
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
You can set limits for CCN (-C) and the number of parameters (-a). Functions that exceed these limits will generate warnings. The exit code of lizard will be non-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 Python 3.8 or above. The test suite runs on Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14, on Linux and Windows, in continuous integration; other versions are not verified.
JavaScript and TypeScript parameters
Named and anonymous arrows report the same formal parameter counts and binding
names. Empty object and array patterns each occupy a parameter slot without
adding a name to the API's ``parameters`` list; ``({}, [], tail) => tail`` has
``parameter_count`` 3 and ``parameters`` ``['tail']``. Trailing commas and
TypeScript receiver declarations add no slots. Callback types add no functions.
Each default parameter or destructuring initializer adds 1 to CCN, because
the initializer runs only when the supplied value is ``undefined``. For example,
``function f(a = 1, b = a + 1) { return a + b; }`` has CCN 3: the base
complexity of 1 plus two defaults. Defaults in object and array destructuring
also count, including nested defaults and destructuring inside a function body.
Explicit decisions within an initializer, such as a ternary expression or
``&&`` / ``||``, contribute separately.
This also applies to JSX and TSX. Defaults may increase CCN above a configured
threshold. See `arrow boundaries <docs/javascript-arrow-boundaries.md>`_ for
ternary branches, type annotations and the existing curried-arrow convention.
Installation
------------
lizard.py can be used as a standalone 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/*"
Use .gitignore file:
::
lizard mySource/
If there is a .gitignore file in the given path, lizard will automatically use it as an additional filter to exclude files that match the gitignore patterns. This is useful when you want to analyze only the tracked files in your git repository. To analyze all discovered source files regardless of .gitignore, use --no-gitignore:
::
lizard --no-gitignore mySource/
.. _options:
.. _example-use:
Command-line reference
~~~~~~~~~~~~~~~~~~~~~~
See the `command-line reference
<https://github.com/terryyin/lizard/blob/master/docs/cli.rst>`_ for all
options, sample reports, and threshold examples.
Using lizard as Python module
-----------------------------
You can also use lizard as a Python module in your code:
.. code:: python
>>> 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).
.. code:: python
>>> i = lizard.analyze_file.analyze_source_code("AllTests.cpp", "int foo(){}")
.. _generated-code:
.. _code-duplicate-detector:
.. _generate-a-tag-cloud-for-your-code:
.. _cognitive-complexity:
.. _whitelist:
.. _options-in-comments:
Extensions and warning controls
-------------------------------
See `extensions and warning controls
<https://github.com/terryyin/lizard/blob/master/docs/extensions-and-warnings.rst>`_
for duplicate detection, word counts, Cognitive Complexity, generated
code, whitelists, and forgiveness comments.
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.
Literature Referring to Lizard
------------------------------
Lizard is often used in software-related research. If you used it to support your work, you may contact the lizard author to add your work in the following list.
- Software Quality in the ATLAS experiment at CERN, which refers to Lizard as one of the tools, has been published in the Journal of Physics: http://iopscience.iop.org/article/10.1088/1742-6596/898/7/072011
- S Martin-Haugh et al 2017 J. Phys.: Conf. Ser. 898 072011
Lizard is also used as a plugin for fastlane to help check code complexity and submit xml report to sonar.
- `fastlane-plugin-lizard <https://github.com/liaogz82/fastlane-plugin-lizard>`_
- `sonar <https://github.com/Backelite/sonar-swift/blob/develop/docs/sonarqube-fastlane.md>`_
- `European research project FASTEN (Fine-grained Analysis of SofTware Ecosystems as Networks, <http://fasten-project.eu/)>`_
- `for a quality analyzer <https://github.com/fasten-project/quality-analyzer>`_
How To Contribute
-----------------
Contributions are welcome. Project-specific development rules are in
``AGENTS.md``. Adding a language reader uses
``.agents/skills/lizard-language-support/``.
AI lifecycle guidance is installed under ``.agents/skills/`` and ``.claude/skills/``.