Quantcast Apex Linter for Salesforce
At Quantcast we're interested in promoting the highest coding standards, and Salesforce is no exception.
This framework provides a simple and consistent framework for implementing code checks using regular expressions.
It automatically identifies both the line and character, and allows an annotation to override the warning as needed.
The initial release flags the following cases:
- Object types as Map keys or Set members
- SObject hashes are computed
from field values.
- Changes to field values of keys make Map values inaccessible.
- For Sets, it causes Set.contains() to return false
- Object hashes default to memory locations
- These differences produce subtle bugs, so we recommend against the practice
- However, we do allow it with a link to the issue documentation.
- SObject hashes are computed from field values.
- Creates situations in which test execution can conflict with production data.
- Encourages DML in tests, which slows them down.
- Row-locking data used by production systems can cause deployments and production processes to fail.
SeeAllData=falsedoesn't do anything in classes where
@futurein test classes
- Futures are scheduled in a small finite queue.
- If "Disable Parallel Test Execution" is off, this queue can get full.
- We recommend:
@futureto avoid mixed DML issues.
Test.stopTest()to avoid "Too Many SOQL Queries".
- A check for the obsolete
- Use the
- Use the
Using the Apex Linter
To run the Apex Linter, you'll need Python 3.7.
To run it over the source tree:
python3 -m apexlint src/
At Quantcast we run the Apex Linter on every pull request.
Contributing to the Apex Linter
We welcome contributions to the Apex Linter in the form of enhancement requests, patches, additional tests, bug reports, new ideas, and so on. Use GitHub issues to report bugs. and refer to the Apex Linter code contribution policy when contributing code.
Post comments or questions to mailto:firstname.lastname@example.org
Join Google Group to search archives: http://groups.google.com/group/qc-salesforce-dev
Quantcast Apex Linter is released under the Apache 2.0 license.