GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - WolframResearch/codeinspector: Find and report problems in Wolfram Language code

BranchesTags
Open more actions menu

Latest commit

 

History

826 Commits
826 Commits

Folders and files

NameName
Last commit message
Last commit date
CodeInspector
CodeInspector
 
 
CodeTools/Generate
CodeTools/Generate
 
 
Tests
Tests
 
 
WolframLanguageSyntax/Data
WolframLanguageSyntax/Data
 
 
cmake
cmake
 
 
docs
docs
 
 
scripts
scripts
 
 
.WolframResources
.WolframResources
 
 
.gitignore
.gitignore
 
 
.project
.project
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
HowToBuild.md
HowToBuild.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

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.

See this tutorial in the Wolfram System help browser:

  • CodeInspector/tutorial/CodeInspectorTutorial

Troubleshooting

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

Needs["CodeInspector`"]

and try a basic example:

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

About

Find and report problems in Wolfram Language code

Topics

codeinspectorcodetoolslintlinterlintingmathematicastatic-analysiswolfram-languagewolfram-mathematica

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

74 stars

Watchers

20 watching

Forks

9 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.