apexlink
SFDX CLI plugin for Apexlink
Last updated 3 months ago by nawforce .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install apexlink 
SYNC missed versions from official npm registry.

ApexLink

Version License Known Vulnerabilities

ApexLink is a SFDX CLI plugin & Java library for static analysis of Salesforce Apex code aimed at improving developer productivity. The core library is useful for any number of analysis problems while the CLI plugin acts as a demo of capability while the features of the library are built out.

SFDX CLI

To install the CLI plugin (from npm)

sfdx plugins:install apexlink

To perform a simple validity check use:

sfdx apexlink:check <directory>

This parses and performs semantic checks on the code and reports any errors, such as types not being found. The library contains a pretty comprehensive set of platform types that it validates against.

More complex validations can be performed that support namespaced packages and multiple source directories, see the command help for more details. Currently this command does not require an sfdx project, if you omit the directory it will search the current directory for metadata.

Unused fields, properties & methods

You can use the check command to report on unused fields, properties and methods of Apex classes.

sfdx apexlink:check --zombies <directory>

This analysis currently may return false positives for:

  • Fields & Properties only bound to SOQL queries
  • Properties only used by Visualforce Pages
  • Fields, properties & methods only referenced from triggers.

Class dependencies

The check command can also report Apex class dependencies with:

sfdx apexlink:check --depends --json <directory>

If you omit the --json the dependency report is returned as CSV records. Understanding dependencies is useful when analysing cold start behaviours but it has also been written with a view to supporting the identification of dead code/metadata.

Parallel test execution

There is a WIP command included for parallel test execution

sfdx apexlink:retest

For more information on this please see read this post

Building

To create a jar use:

mvn package

Maven

To use the jar in a maven project add the following to your pom.xml

<dependency>
    <groupId>com.github.nawforce</groupId>
    <artifactId>apexlink</artifactId>
    <version>0.5</version>
</dependency>

Source & Licenses

ApexLink is written in a combination of Java and Scala but should run on any fairly recent JVM. Please let me know if you have trouble building or running it. All the source code included uses a 3-clause BSD license. The only third-party component included is the Apex Antlr4 grammar originally from Tooling-force.com, although the version used is now markedly different from the original.

Current Tags

  • 0.5.0                                ...           latest (3 months ago)

8 Versions

  • 0.5.0                                ...           3 months ago
  • 0.4.2                                ...           7 months ago
  • 0.4.1                                ...           7 months ago
  • 0.4.0                                ...           7 months ago
  • 0.3.1                                ...           8 months ago
  • 0.3.0                                ...           8 months ago
  • 0.2.0                                ...           10 months ago
  • 0.1.0                                ...           10 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 8
Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |