Skip to main content

Extendable Clang AST based c/c++ linter

Project description

EXCAL - Extendable Clang AST based Linter.

This is a simple project implementing a C/C++ linter based on the clang AST. The main porpoise is to create a tool which is easily extendable via plugins.

Installation

Plugins

The Goal of this project is to provide an interface that allows it to easily implement linter rules based on an AST.

A Plugin will need to provide a register method in which it will register itself within the Project. The Plugin then can provide a class inherits from the NodeVisitor class. Here the visit_X functions can be overwritten. When parsing the AST, these functions will be called whenever a desired Node is reached. From there further operations may be done on the provided AstNode.

See the following example:

    from visitor import NodeVisitor
    from pluginManager import PluginManager
    from astNode import AstNode
    
    PLUGIN_NAME = "AutonomusReply"
    
    class customVisitor(NodeVisitor):
        def __init__(self) -> None:
            super().__init__()
    
        def visit_class_base(self, node: AstNode) -> None:
            return
    
    def register(pm: PluginManager):
        pm.register(PLUGIN_NAME, customVisitor)

There are two ways to provide Plugins. The preferred one is to Create as a standalone python Package. See this example The other way is to put the Plugin in the plugins folder and register it in the plugins.json file.

    {
      "plugins": ["plugins.myPlugin"]
    }

All possible functions can be seen in src/visitor.py. To see which function may be needed for your use-cases run the excal project using the -p flag. This will print an AST of the desired file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

excal-0.0.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

excal-0.0.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file excal-0.0.1.tar.gz.

File metadata

  • Download URL: excal-0.0.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for excal-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7f7bd738c2c07edf697c2672f23ee4d7734f2863981fda5f6e01bd5bfeb61b5d
MD5 fb5a978d87f38b407df8f9bca454c388
BLAKE2b-256 8e57a6051d8e970545679e41d591f3824f95359b6a3921ba51b781d45efe950f

See more details on using hashes here.

File details

Details for the file excal-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: excal-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for excal-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c527b256dbf4b0b7a6c6de3c0dcac685231e9e73776e7b8fb4d16b5bccfddbb2
MD5 afc4d808c8aa8120b3865b800ec213b5
BLAKE2b-256 f782b52341faf192c0e5b306ee8aab50a1f041992f3c5889dec4abab7c89205b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page