apexlink

SFDX CLI plugin for Apexlink Salesforce metadata analysis library

Usage no npm install needed!

<script type="module">
  import apexlink from 'https://cdn.skypack.dev/apexlink';
</script>

README

ApexLink

SFDX CLI plugin for the apex-link Salesforce metadata static analysis library. This plugin provides a simple 'check' command that can be used to examine metadata for errors, in addition it can report on various warnings such as unused fields & methods or variable shadowing. The command can also be used to obtain Apex class dependencies in either CSV or JSON format.

SFDX CLI

To install the CLI plugin (from npm)

sfdx plugins:install apexlink

Check the installation was successful with

sfdx plugins

This should show apexlink in the plugin list.

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. This command does not require an sfdx project, if you omit the directory it will search the current directory for metadata. To also see warnings add the argument "--verbose".

Unused fields, properties & methods

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

sfdx apexlink:check --verbose --unused <directory>

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 default format is CSV.

Usage

$ npm install -g apexlink
$ sfdx COMMAND
running command...
$ sfdx (-v|--version|version)
apexlink/2.3.2 darwin-x64 node-v16.6.0
$ sfdx --help [COMMAND]
USAGE
  $ sfdx COMMAND
...

sfdx apexlink:check [--depends] [--unused] [--nocache] [--debug] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Validate Apex code in current or passed directories

USAGE
  $ sfdx apexlink:check [--depends] [--unused] [--nocache] [--debug] [--verbose] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

ARGUMENTS
  DIRECTORY  directory to search for metadata files, defaults to current directory

OPTIONS
  --debug                                                                           show debug log

  --depends                                                                         output class dependencies rather
                                                                                    than issues, in CSV (default) or
                                                                                    JSON format

  --json                                                                            show output in json format (disables
                                                                                    --verbose)

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

  --nocache                                                                         don't use cache during loading

  --unused                                                                          show unused messages, requires
                                                                                    --verbose

  --verbose                                                                         show warning messages

EXAMPLES
  $ sfdx apexlink:check
  $ sfdx apexlink:check --verbose $HOME/myproject
  $ sfdx apexlink:check --json --depends $HOME/myproject

See code: src/commands/apexlink/check.ts

Version License Known Vulnerabilities