GithubHelp home page GithubHelp logo

aplint-ext's Introduction

A (soon to be) configurable linting tool for Apex and Visualforce code.

Features

  • Lints Apex and Visualforce file on save, from command pallette, editor menu, and touchbar (macOS)
  • Lints Apex and Visualforce file in current directory from command pallette, editor menu, and touchbar (macOS)
  • Generates diagnostic output to both text editor and problems terminal
  • Clear diagnostic output in problems terminal from command pallette, editor menue and touchbar (MacOS)
  • View rule definition and details from within VSCode or in your default browser (see examples for usage)
  • Preview your code documentation in a sperate browser window to ensure documentation is formatted correctly

Usage

APLint, by default, lints any Apex or Visualforce page on save. Other commands can be executed using Command-Shift-P (⌘ ⇧ P) or Ctrl-Shift-P on Windows. The currently supported comamnds are:

APLint: Run On file           // runs APLint on the current file
APLint: Run On Directory      // runs APLint on the currect directory
APLint: Clear Problems        // clears all diagnostics
APLint: Preview Documentation // opens a brower window with documentation preview

Example

How to: Use APLint (with onSave linting enabled)

How to: View rule documentation in VSCode

Example: Documentation Preview

Configuration

  • Add custom ruleset path(s) in settings.json using the aplint.customRulesets key (see extension settings for more details)

Rule Categories

  • Best Practices: Rules which enforce generally accepted best practices.
  • Code Style: Rules which enforce a specific coding style.
  • Design: Rules that help you discover design issues.
  • Documentation: Rules that are related to code documentation.
  • Error Prone: Rules to detect constructs that are either broken, extremely confusing or prone to runtime errors.
  • Performance: Rules that flag suboptimal code.
  • Security: Rules that flag potential security flaws.

A full index of the above rules can be found here.

Additional Rules

Additional rules can be enabled by selecting the Manulife linting profile in the extension settings of APLint, or by adding the key "aplint.lintingProfile": "Manulife" to the settings.json file of VSCode. These rules include:

All rules can be found here.

TODO

  • Custom action configuration
    • Ability to turn off onSave event
    • Ability to disable APLint all together
  • Custom rule configuration
    • Ability to provide custom ruleset
    • Ablity to select from multiple default rulesets
  • Warning thresholds
    • Ability to determine which level of severity determines a diagnostic warning, info, etc.
  • Point to rule
    • Ability to take user to the rule that triggered the linting error
  • Quick actions
    • Auto-generate code snipits
    • Suggest fixes for common types of problems as comments

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting merge requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Gareth Sharpe - Initial work - @sharpga

Acknowledgments

aplint-ext's People

Contributors

gareth-sharpe avatar

aplint-ext's Issues

[BUG] Settings UI fails to load when no documents open in VS Code and this extension is installed

Describe the bug

When VS Code has no documents open and you open Settings UI, the extension is activated but as it throws an error the VS Code Settings UI will be rendered as blank:

image

In "Log (Window)" Output window the stack trace points to the place of error:

[2022-03-08 09:32:28.770] [renderer1] [error] Cannot read property 'document' of undefined: TypeError: Cannot read property 'document' of undefined
    at ...........\.vscode\extensions\aplint.sf-core-aplint-ext-1.2.1\src\index.ts:54:49
    at d.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:145)
    at w.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:1856)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:86:65165
    at d.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:145)
    at w.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:1856)
    at _.acceptDocumentsAndEditorsDelta (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:85:74821)
    at _.$acceptDocumentsAndEditorsDelta (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:85:72910)
    at n._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:89:13812)
    at n._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:89:13496)
    at n._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:89:12158)
    at n._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:89:10836)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:89:8945
    at d.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:145)
    at w.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:1856)
    at c.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66:19017)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:104:34267
    at d.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:145)
    at w.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:1856)
    at c.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66:19017)
    at s._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66:23598)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66:21132
    at d.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:145)
    at w.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:58:1856)
    at w.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66:15848)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66:14978
    at Socket.P (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:104:13790)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:467:12)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)

To Reproduce
Steps to reproduce the behaviour:

  1. Have an empty vs code instance running
  2. Open "Settings UI" from the menu (Ctrl/Cmd + P)
  3. See error (as image above)

Expected behaviour
Extension should detect it is not a document it should touch and handle it

Desktop (please complete the following information):

  • Win 11 (OS is not important)

Extension issue

  • Issue Type: Bug
  • Extension Name: sf-core-aplint-ext
  • Extension Version: 1.2.1
  • OS Version: Windows_NT x64 10.0.18362
  • VSCode version: 1.41.0

⚠️ We have written the needed data into your clipboard. Please paste! ⚠️

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.