GithubHelp home page GithubHelp logo

classicvalues / codeinspector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wolframresearch/codeinspector

1.0 1.0 0.0 5.24 MB

Find and report problems in Wolfram Language code

License: MIT License

CMake 2.30% Mathematica 97.70%

codeinspector's Introduction

CodeInspector

CodeInspector is a package for finding and reporting problems in Wolfram Language code. CodeInspector has a large collection of rules that can be used to inspect Wolfram Language source code files and can be customized to your preferences.

In a stand-alone kernel:

Needs["CodeInspector`"]

CodeInspectSummarize["If[a,b,b]"]
Out[2]= If[a,b,b]

        line 1:  If[a,b,b]
                      ^ ^  
                DuplicateClauses Error Both branches are the same.

In a front end:
CodeInspectSummarize

Static Analysis Tools in the Wolfram Language

"CodeParser and CodeInspector" on community.wolfram.com

Finding Bugs in the Wolfram Language from WTC 2019: Watch Video (youtube)

Finding Bugs in the Wolfram Language from WTC 2019: Watch Video (wolfram.com)

Finding Bugs in the Wolfram Language from WTC 2019: Download Presentation

Setup

CodeInspector depends on CodeParser paclet and CodeFormatter paclet.

CodeInspector and its dependencies are included in Mathematica 12.2 and above.

For older versions, install CodeInspector paclet and dependencies from the public paclet server:

PacletInstall["CodeParser"]
PacletInstall["CodeFormatter"]
PacletInstall["CodeInspector"]

Build and install the CodeInspector paclet locally

Using CodeInspector

After CodeParser and CodeInspector are installed, CodeInspector can be used.

Return the list of all problems found in a string of code:

Needs["CodeInspector`"]

CodeInspect["If[a,b,b]"]
Out[2]= {DuplicateClauses Error Both branches are the same.}

Summarize the problems found in a source code file:

Collatz

The input to CodeInspect and CodeInspectSummarize may be a string, a File, or a list of bytes.

Troubleshooting

Make sure that the paclets can be found on your system:

Needs["CodeInspector`"]

and try a basic example:

CodeInspect["If[a, b, b]"]

codeinspector's People

Contributors

fjra avatar timotheev avatar ljdandria avatar

Stargazers

Classic Values avatar

Watchers

 avatar

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.