Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] sfp apextests:trigger failed to parse apex class #10

Closed
alanjaouen opened this issue Feb 7, 2024 · 2 comments
Closed

[BUG] sfp apextests:trigger failed to parse apex class #10

alanjaouen opened this issue Feb 7, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@alanjaouen
Copy link

Describe the bug
When triggering apex test for a package got the following message:

Failed to parse C:\Users\ajaouen\git_repositories\Salesforce\.sfpowerscripts\GwQYX_source\.sfpowerscripts\IN64C_mdapi\metadataPackage_1707337908320\classes\CountChargebackBatch.cls in C:\Users\ajaouen\git_repositories\Salesforce\.sfpowerscripts\GwQYX_source\.sfpowerscripts\IN64C_mdapi\metadataPackage_1707337908320
mismatched input '(' expecting {'after', 'before', 'get', 'inherited', 'instanceof', 'set', 'sharing', 'switch', 'transient', 'trigger', 'when', 'with', 'without', 'select', 'count', 'from', 'as', 'using', 'scope', 'where', 'order', 'by', 'limit', 'and', 'or', 'not', 'avg', 'count_distinct', 'min', 'max', 'sum', 'typeof', 'end', 'then', 'like', 'in', 'includes', 'excludes', 'asc', 'desc', 'nulls', 'first', 'last', 'group', 'all', 'rows', 'view', 'having', 'rollup', 'tolabel', 'offset', 'data', 'category', 'at', 'above', 'below', 'above_or_below', 'security_enforced', 'reference', 'cube', 'format', 'tracking', 'viewstat', 'custom', 'standard', 'calendar_month', 'calendar_quarter', 'calendar_year', 'day_in_month', 'day_in_week', 'day_in_year', 'day_only', 'fiscal_month', 'fiscal_quarter', 'fiscal_year', 'hour_in_day', 'week_in_month', 'week_in_year', 'converttimezone', 'yesterday', 'today', 'tomorrow', 'last_week', 'this_week', 'next_week', 'last_month', 'this_month', 'next_month', 'last_90_days', 'next_90_days', 'last_n_days', 'next_n_days', 'next_n_weeks', 'last_n_weeks', 'next_n_months', 'last_n_months', 'this_quarter', 'last_quarted', 'next_quarter', 'next_n_quarters', 'last_n_quarters', 'this_year', 'last_year', 'next_year', 'next_n_years', 'last_n_years', 'this_fiscal_quarter', 'last_fiscal_quarter', 'next_fiscal_quarter', 'next_n_fiscal_quarters', 'last_n_fiscal_quarters', 'this_fiscal_year', 'last_fiscal_year', 'next_fiscal_year', 'next_n_fiscal_years', 'last_n_fiscal_years', IntegralCurrencyLiteral, 'find', 'email', 'name', 'phone', 'sidebar', 'fields', 'metadata', 'pricebookid', 'network', 'snippet', 'target_length', 'division', 'returning', 'listview', ',', '.', Identifier}
command: create  package
package name: core-fr-legacy
package type: source
package directory: ./src/core-fr-legacy
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
Unable to parse these classes to correctly identify test classes, Its not your issue, its ours!Please raise a issue in our repo!
Following apex test classes were identified
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

 Class                  Error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

 CountChargebackBatch   {"line":33,"column":87,"message":"mismatched input '(' expecting {'after', 'before', 'get', 'inherited', 'instanceof', 'set', 'sharing', 'switch', 'transient', 'trigger', 'when', 'with', 'without', 'select', 'count', 'from', 'as', 'using', 'scope', 'where', 'order', 'by', 'limit', 'and', 'or', 'not', 'avg', 'count_distinct', 'min', 'max', 'sum', 'typeof', 'end', 'then', 'like', 'in', 'includes', 'excludes', 'asc', 'desc', 'nulls', 'first', 'last', 'group', 'all', 'rows', 'view', 'having', 'rollup', 'tolabel', 'offset', 'data', 'category', 'at', 'above', 'below', 'above_or_below', 'security_enforced', 'reference', 'cube', 'format', 'tracking', 'viewstat', 'custom', 'standard', 'calendar_month', 'calendar_quarter', 'calendar_year', 'day_in_month', 'day_in_week', 'day_in_year', 'day_only', 'fiscal_month', 'fiscal_quarter', 'fiscal_year', 'hour_in_day', 'week_in_month', 'week_in_year', 'converttimezone', 'yesterday', 'today', 'tomorrow', 'last_week', 'this_week', 'next_week', 'last_month', 'this_month', 'next_month', 'last_90_days', 'next_90_days', 'last_n_days', 'next_n_days', 'next_n_weeks', 'last_n_weeks', 'next_n_months', 'last_n_months', 'this_quarter', 'last_quarted', 'next_quarter', 'next_n_quarters', 'last_n_quarters', 'this_year', 'last_year', 'next_year', 'next_n_years', 'last_n_years', 'this_fiscal_quarter', 'last_fiscal_quarter', 'next_fiscal_quarter', 'next_n_fiscal_quarters', 'last_n_fiscal_quarters', 'this_fiscal_year', 'last_fiscal_year', 'next_fiscal_year', 'next_n_fiscal_years', 'last_n_fiscal_years', IntegralCurrencyLiteral, 'find', 'email', 'name', 'phone', 'sidebar', 'fields', 'metadata', 'pricebookid', 'network', 'snippet', 'target_length', 'division', 'returning', 'listview', ',', '.', Identifier}"}

To Reproduce
Steps to reproduce the behavior:
I bilieve it happend because of aliased fields, or ROLLUP in this query:

        List<AggregateResult> groupList = [
            SELECT blng__Account__c, blng__Invoice__c, COUNT(Id) paymentCount, GROUPING(blng__Invoice__c) grpInv
            FROM blng__Payment__c
            WHERE blng__Account__c IN :accIdSet AND errorSource__c = 'TOTO'
            GROUP BY ROLLUP(blng__Account__c, blng__Invoice__c)
        ];

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform Details (please complete the following information):

  • OS: windows
  • Version [e.g. CLI Version eg: 1.6.6] sfp -- The DX@Scale CLI -Version:25.5.3 -Release:December 23
  • Salesforce CLI(sfdx cli) Version: 2.26.10

Additional context
Add any other context about the problem here.

@Rocko1204
Copy link
Collaborator

Hi @alanjaouen The reason for your error is the GROUPING statement. We use an external library to parse the apex classes and the validation rules are not up to date. For 99% it works fine. For the moment it make sense when you use the informations from the affected line (you see the line in the output) and check if the statements exists here https://github.com/nawforce/apex-parser/blob/master/antlr/ApexParser.g4 This should help for the moment

@azlam-abdulsalam azlam-abdulsalam added bug Something isn't working and removed analysis labels Feb 9, 2024
@azlam-abdulsalam
Copy link

@alanjaouen This should be fixed in April24, Please reopen if the issue persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants