Skip to main content

An experimental static code analyser for OpenSCAD.

Project description

SCA2D - Static Code Analysis for SCAD

This is an experimental linter for OpenSCAD. The focus is to properly lex the .scad files so that we can test for dangerous code like redefining variable from other scopes. SCA2D is in a very early stage of development.

How to install

If you have Python 3.6 or later installed on your machine (and on the PATH) you can install SCA2D from PyPi by running the following command from a terminal

pip install sca2d

to upgrade your current versions of SCA2D run:

pip install sca2d --upgrade

You can check that SCA2D is installed by running the following:

sca2d -h

you should see a help screen.

Install issues

If you have problems with installation possible problems include:

  • You may need to run pip3 instead of pip
  • Python may not be on the PATH, this often happens in Windows depending on how python was installed

How to run

To analyse a .scad file run:

sca2d filename.scad

This will print any code messages to the screen.

To analyse all .scad files in a directory run:

sca2d directory_path

This will also print any code messages to the screen.

If you wish to inspect the parse tree that SCA2D generates and then uses you can instead run:

sca2d --output-tree filename.scad

the tree will be printed into a file called filename.sca2d.

What works

  • Parsing most .scad files. We don't yet do extensive testing. Please raise an issue if you find a parsing error in SCA2D.
  • Parsing included and used .scad files and checking variable, function, and module usage in different scopes.
  • Checking for a minimal number of code errors

How to get involved

The best way to get involved is to find bugs and then open an issue. You could also make changes and open a merge request.

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

sca2d-0.2.2.tar.gz (44.4 kB view hashes)

Uploaded Source

Built Distribution

sca2d-0.2.2-py3-none-any.whl (42.2 kB view hashes)

Uploaded Python 3

Supported by

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