KamasamaK / vscode-cflint

An extension to integrate CFLint into Visual Studio Code.
MIT License
17 stars 9 forks source link
cflint cfml linter vscode vscode-extension

VS Code CFLint

VS Marketplace Open VSX cfml

CFLint is a linter for CFML and you can find more information at its GitHub repository. This extension integrates CFLint into VS Code.

Features

Linting

This extension uses the CFLint tool to scan CFML files and provide feedback on potential issues through the editor and Problems view of VS Code. The ways in which this is triggered are configurable in the Settings. The defaults are only to run when CFML files are opened or saved. The linter optionally takes rule configuration via a .cflintrc file, for which details can be found at CFLint's repo. This extension facilitates the creation and viewing of this file via Commands. It also facilitates editing the file by utilizing the schema.

Here is an example from the CFDocs project using CFLint v1.4.1 with no rule configuration on VS Code v1.28.

CFDocs

  1. The status bar item for Problems. Indicates number of Error, Warning, and Info issues reported, respectively. Clicking it will bring up the Problems view. Alternatively, you can use Ctrl+Shift+M.
  2. The Problems view. Grouped by file, ordered by severity, line number, column number. Clicking the problem will focus the issue in the editor.
    [Quick Fixes] [Severity icon] [Provider] [Issue Message] [Issue ID] (line number, column number)
  3. Highlights within the editor. Hovering reveals the message.
  4. Filter issues in Problems view.

Code Actions / Quick Fixes

These are potential resolutions that are provided for each diagnostic. Aside from the rule changes in the settings file, these are largely dependent on the location given by CFLint. See Known Issues/Limitations

Other

See Commands below.

Requirements

You must first install CFLint. You may skip the steps below if you already have them.

  1. Download and install latest Java SE 8+ JRE, or JDK if you plan to build it yourself.
  2. Download latest CFLint (v1.5.0+) standalone/all JAR from Maven Central or the GitHub releases. Alternatively, build it yourself using these instructions to get the bleeding-edge. This is the JAR file that will be provided to cflint.jarPath in the settings.

Extension dependencies

Requires an extension that contributes the language since linting is only done for particular language IDs. The recommended one is KamasamaK.vscode-cfml.

Settings

The following are the configurable Settings (Ctrl+Comma) that this extension contributes to VS Code:

Commands

Used in Command Palette (Ctrl+Shift+P). Alternatively, can be bound to Keyboard Shortcuts (Ctrl+K Ctrl+S).

Note: The output commands above have CFLint produce the reports directly, so some extension settings are not considered.

Known Issues/Limitations

  1. Not an issue with the extension itself, but be aware that CFLint is a heavy/slow application compared to most linters, especially when used through the command line. Some things are done with the extension to account for this.
  2. As of this writing, CFLint (v1.5.0) often misreports issue location.

Future Plans

Release Notes

See CHANGELOG.md

Contributing

See CONTRIBUTING.md

Support

For questions or help, join the #ide channel in the CFML Slack workspace to talk with people about this or other editor tools. To file a bug or feature request, open a GitHub issue.