[apex] Type declaration/casts/constructors have correct capitalization
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5.5k
- Forks
- 1.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 54
Description
Proposed Rule Name: Type has correct capitalization
Proposed Category: [Code Style]
Description:
Check if Type declaration and constructors have proper capitalization according to SFDX class cache.
Alternatively if not possible to implement at least that the Type conforms to the class naming regexp.
Also it might be good idea to split this into 2 rules -> 1 for constructors and 1 for Type declarations. (or maybe to 3 -> 1 for type casts).
Code Sample:
string s1; // gets flagged
String s2; // ok
account a1; // gets flagged
Account a2; // ok
Account a3 = new account(); // gets flagged
Account a4 = new Account(); // ok
list<Account> accounts1; //gets flagged
List<account> accounts2; // gets flagged
List<Account> accounts3; // OK
List<Account> accounts4 = (List<account>) new List<SObject>(); // gets flagged
List<Account> accounts5 = (List<Account>) new List<SObject>(); // gets flagged
Possible Properties:
- can PMD check other files in the hierarchy? (as the list of classes with proper names is generated with SFDX)
- it could be useful for some teams to be able to pass the list of sObjects & classes (with proper capitalization) or just regex
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named in the issue. Start by locating the Apex rule implementation and determine how type declarations, casts, and constructors are represented; done means the proposed examples are classified correctly and the source of valid capitalization is defined.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100