@@ -1001,18 +1001,28 @@ impl FunctionAnalyzer<'_> {
1001
1001
fn resolve_jira_api_type ( url : & str ) -> Option < IntrinsicName > {
1002
1002
// Pattern matching to classify, eg: api.[asApp | asUser]().requestJira(route`/rest/api/3/myself`);
1003
1003
match url {
1004
+ // JSM requests
1004
1005
url if url. starts_with ( "/rest/servicedeskapi/" ) => {
1005
1006
Some ( IntrinsicName :: RequestJiraServiceManagement )
1006
1007
}
1007
- url if url. starts_with ( "/rest/agile/" ) => Some ( IntrinsicName :: RequestJiraSoftware ) ,
1008
- // Accept Jira API v2.0 or v3.0
1008
+ // Jira Software requests from https://developer.atlassian.com/cloud/jira/software/rest/intro/#introduction
1009
+ url if url. starts_with ( "/rest/agile/" )
1010
+ || url. starts_with ( "/rest/devinfo/" )
1011
+ || url. starts_with ( "/rest/featureflags/" )
1012
+ || url. starts_with ( "/rest/deployments/" )
1013
+ || url. starts_with ( "/rest/builds" )
1014
+ || url. starts_with ( "/rest/remotelinks/" )
1015
+ || url. starts_with ( "/rest/security/" )
1016
+ || url. starts_with ( "/rest/operations/" )
1017
+ || url. starts_with ( "/rest/devopscomponents/" ) =>
1018
+ {
1019
+ Some ( IntrinsicName :: RequestJiraSoftware )
1020
+ }
1021
+ // Jira requests, accept Jira API v2.0 or v3.0
1009
1022
url if url. starts_with ( "/rest/api/2/" ) || url. starts_with ( "/rest/api/3/" ) => {
1010
1023
Some ( IntrinsicName :: RequestJira )
1011
1024
}
1012
- _ => {
1013
- warn ! ( "Provided Jira API URL: {:?} is neither Jira, JS, JSM!" , url) ;
1014
- None
1015
- }
1025
+ _ => None ,
1016
1026
}
1017
1027
}
1018
1028
@@ -1032,21 +1042,16 @@ impl FunctionAnalyzer<'_> {
1032
1042
// Resolve Jira API requests to either JSM/JS/Jira as all are bundled within requestJira()
1033
1043
match first_arg {
1034
1044
Expr :: TaggedTpl ( TaggedTpl { tpl, .. } ) => {
1035
- if let Some ( TplElement { raw, .. } ) = tpl. quasis . first ( ) {
1036
- resolve_jira_api_type ( raw) . unwrap_or_else ( || {
1037
- // Conservatively assume any of Jira APIs may be used if we can't statically determine which one
1038
- warn ! ( "Falling back to any Jira request" ) ;
1039
- IntrinsicName :: RequestJiraAny
1040
- } )
1041
- } else {
1042
- panic ! ( "No url identifiable to classify requestJira() type" ) ;
1043
- }
1044
- }
1045
- _ => {
1046
- warn ! ( "Unable to classify requestJira() type" ) ;
1047
- IntrinsicName :: RequestJiraAny
1045
+ tpl. quasis . first ( ) . map ( |elem| & elem. raw )
1048
1046
}
1047
+ Expr :: Lit ( Lit :: Str ( str_lit) ) => Some ( & str_lit. value ) ,
1048
+ _ => None ,
1049
1049
}
1050
+ . and_then ( |atom| resolve_jira_api_type ( atom. as_ref ( ) ) )
1051
+ . unwrap_or_else ( || {
1052
+ warn ! ( "Could not resolve Jira API type, falling back to any Jira request" ) ;
1053
+ IntrinsicName :: RequestJiraAny
1054
+ } )
1050
1055
} else if * last == "requestBitbucket" {
1051
1056
IntrinsicName :: RequestBitbucket
1052
1057
} else {
0 commit comments