Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>COBOL QualityNew to Visual Studio Code? Get it now.
COBOL Quality

COBOL Quality

Shimshon Fishler

|
2 installs
| (0) | Free
Static analysis for COBOL code quality
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

COBOL Quality

A VS Code extension that provides static analysis for COBOL code quality. Automatically detects unused variables, indentation violations, and other code quality issues directly in your editor.

Features

Current Features

  • Unused Variable Detection - Identifies variables declared in WORKING-STORAGE or LOCAL-STORAGE sections that are never referenced in your code

    • Automatically excludes level-88 condition names, FILLER items, LINKAGE SECTION variables, REDEFINES, and GLOBAL declarations
    • Level-01 group items are only flagged as unused when all of their sub-variables are also unreferenced
    • Shows as greyed-out text with DiagnosticTag.Unnecessary
  • Indentation Validation - Enforces COBOL column formatting rules

    • Validates Area A (columns 8-11) for divisions, sections, and paragraph headers
    • Validates Area B (columns 12-72) for statements
    • Automatically detects and respects free-format mode (>>SOURCE FORMAT FREE)
    • COBOL scope terminators (END-EXEC, END-IF, END-PERFORM, etc.) are correctly excluded from paragraph header detection
  • Real-time Analysis - Code is analyzed automatically:

    • When you open a COBOL file
    • When you save changes
    • When you switch between open files
  • Integrated with VS Code Problems Panel - All findings appear as inline squiggles and in the Problems panel with clear descriptions

Supported File Types

  • .cbl - COBOL source files
  • .cob - COBOL source files
  • .cobol - COBOL source files
  • .cpy - COBOL copybook files

Planned Features

  • Unused section/paragraph detection
  • Cryptic identifier detection
  • Duplicate code detection
  • Configuration options for rule severity
  • Dedicated sidebar tree view panel

Installation

From VS Code Marketplace (Recommended)

  1. Open VS Code
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on Mac)
  3. Search for "COBOL Quality"
  4. Click Install

From VSIX File

If you have a .vsix file:

  1. Open VS Code
  2. Go to Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
  3. Click the ... menu at the top of the Extensions view
  4. Select "Install from VSIX..."
  5. Navigate to and select the .vsix file

Usage

Simply open any COBOL file (.cbl, .cob, .cobol, or .cpy) and the extension will automatically analyze your code.

Issues will appear as:

  • Yellow squiggles for warnings (e.g., unused variables)
  • Red squiggles for errors (e.g., indentation violations)
  • Entries in the Problems panel (Ctrl+Shift+M or Cmd+Shift+M)

Example Issues Detected

WORKING-STORAGE SECTION.
01 WS-COUNTER PIC 9(4).          *> Warning: Unused variable
01 WS-NAME PIC X(20).

PROCEDURE DIVISION.
  DISPLAY WS-NAME.               *> Only WS-NAME is used
  STOP RUN.

Development & Deployment

Prerequisites

  • Node.js (v20 or higher)
  • npm
  • VS Code

Setup Development Environment

  1. Clone the repository:
git clone https://github.com/shimf/CobolQuality.git
cd CobolQuality
  1. Install dependencies:
npm install
  1. Open in VS Code:
code .
  1. Press F5 to launch the Extension Development Host

Building the Extension

To compile the extension:

npm run compile

To build for production:

npm run package

Running Tests

Run all tests:

npm test

Run unit tests only:

npm run test:unit

Creating a VSIX Package

  1. Install the VS Code Extension Manager (vsce):
npm install -g @vscode/vsce
  1. Package the extension:
vsce package

This creates a .vsix file (e.g., cobol-quality-0.0.2.vsix) in the root directory.

Publishing to VS Code Marketplace

First Time Setup

  1. Create a publisher account at Visual Studio Marketplace

  2. Get a Personal Access Token from Azure DevOps:

    • Create a new token with Marketplace (Manage) scope
    • Save the token securely
  3. Login with vsce:

vsce login <publisher-name>

Publishing

  1. Update the version in package.json:
{
  "version": "0.0.3"
}
  1. Publish the extension:
vsce publish

Or publish a specific version:

vsce publish minor  # 0.0.2 -> 0.1.0
vsce publish patch  # 0.0.2 -> 0.0.3
vsce publish major  # 0.0.2 -> 1.0.0

Manual Upload

Alternatively, you can manually upload the .vsix file:

  1. Go to Visual Studio Marketplace Publisher Portal
  2. Click your publisher
  3. Click "New Extension" > "Visual Studio Code"
  4. Upload the .vsix file

Project Structure

CobolQuality/
├── src/
│   ├── analyzer/           # Core analysis engine
│   │   ├── index.ts       # Main analyzer entry point
│   │   ├── scanner.ts     # COBOL line scanner
│   │   ├── symbolTable.ts # Symbol table builder
│   │   ├── types.ts       # Type definitions
│   │   └── rules/         # Analysis rules
│   │       ├── indentation.ts
│   │       └── unusedVariables.ts
│   ├── providers/
│   │   └── diagnosticProvider.ts  # VS Code diagnostics integration
│   ├── utils/
│   │   └── document.ts    # Document utilities
│   └── extension.ts       # Extension entry point
├── test/                  # Test suite
├── dist/                  # Compiled output
├── package.json           # Extension manifest
└── tsconfig.json          # TypeScript configuration

Configuration

Currently, the extension works out of the box with no configuration required. Future versions will support:

  • Rule severity customization
  • Naming conventions
  • Duplicate code thresholds
  • Copybook search paths

Compatibility

  • VS Code Version: 1.74.0 or higher
  • COBOL Dialect: Rocket Software (Microfocus) COBOL
  • Works alongside: Rocket COBOL VS Code extension

Known Limitations

  • COPY statements: Copybooks are not resolved in v1. Variables from copybooks may be flagged as unused.
  • ALTER statements: Not yet handled for reachability analysis.
  • Multi-file analysis: Cross-file PERFORM tracking not yet implemented.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT License - see the LICENSE file for details

Support

  • Report issues: GitHub Issues
  • Source code: GitHub Repository

Roadmap

The extension is being developed in phases:

  • Phase 1 ✓ - Indentation rules & VS Code integration
  • Phase 2 ✓ - Unused variable detection
  • Phase 3 (In Progress) - Unused section/paragraph detection
  • Phase 4 - Cryptic identifier detection
  • Phase 5 - Duplicate code detection

See the project documentation for detailed roadmap information.


Made with ❤️ for the COBOL developer community

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft