Skip to content

Commit

Permalink
🐛 Adding test to make sure that we don't find match in doc comment (k…
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-hurley authored Oct 16, 2023
1 parent 539de46 commit f549c97
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
26 changes: 13 additions & 13 deletions demo-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@
incidents:
- uri: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
message: apiextensions/v1beta1/customresourcedefinitions is deprecated, apiextensions/v1/customresourcedefinitions should be used instead
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 public static void main( String[] args )\n 9 {\n10 CustomResourceDefinition crd = new CustomResourceDefinition();\n11 System.out.println( crd );\n12 \n13 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");"
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {"
lineNumber: 3
variables:
file: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
kind: Method
name: main
kind: Module
name: io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition
- uri: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
message: apiextensions/v1beta1/customresourcedefinitions is deprecated, apiextensions/v1/customresourcedefinitions should be used instead
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 public static void main( String[] args )\n 9 {\n10 CustomResourceDefinition crd = new CustomResourceDefinition();\n11 System.out.println( crd );\n12 \n13 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n14 element.get();\n15 }\n16 }\n"
lineNumber: 10
codeSnip: " 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {\n14 CustomResourceDefinition crd = new CustomResourceDefinition();\n15 System.out.println( crd );\n16 \n17 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n"
lineNumber: 14
variables:
file: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
kind: Method
Expand All @@ -228,16 +228,16 @@
incidents:
- uri: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
message: java found apiextensions/v1/customresourcedefinitions found file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java:3
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 public static void main( String[] args )\n 9 {\n10 CustomResourceDefinition crd = new CustomResourceDefinition();\n11 System.out.println( crd );\n12 \n13 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");"
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {"
lineNumber: 3
variables:
file: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
kind: Method
name: main
kind: Module
name: io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition
- uri: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
message: java found apiextensions/v1/customresourcedefinitions found file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java:10
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 public static void main( String[] args )\n 9 {\n10 CustomResourceDefinition crd = new CustomResourceDefinition();\n11 System.out.println( crd );\n12 \n13 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n14 element.get();\n15 }\n16 }\n"
lineNumber: 10
message: java found apiextensions/v1/customresourcedefinitions found file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java:14
codeSnip: " 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {\n14 CustomResourceDefinition crd = new CustomResourceDefinition();\n15 System.out.println( crd );\n16 \n17 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n"
lineNumber: 14
variables:
file: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
kind: Method
Expand All @@ -248,8 +248,8 @@
incidents:
- uri: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
message: found generic call
codeSnip: " 4 \n 5 public class App \n 6 {\n 7 \n 8 public static void main( String[] args )\n 9 {\n10 CustomResourceDefinition crd = new CustomResourceDefinition();\n11 System.out.println( crd );\n12 \n13 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n14 element.get();\n15 }\n16 }\n"
lineNumber: 14
codeSnip: " 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {\n14 CustomResourceDefinition crd = new CustomResourceDefinition();\n15 System.out.println( crd );\n16 \n17 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n"
lineNumber: 18
variables:
VariableName: element
file: file:///analyzer-lsp/examples/java/src/main/java/com/example/apps/App.java
Expand Down
4 changes: 4 additions & 0 deletions examples/java/src/main/java/com/example/apps/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
public class App
{

/**
* {@link CustomResourceDefinition}
* @param args
*/
public static void main( String[] args )
{
CustomResourceDefinition crd = new CustomResourceDefinition();
Expand Down
3 changes: 2 additions & 1 deletion provider/internal/java/service_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (p *javaServiceClient) Evaluate(ctx context.Context, cap string, conditionI
}

symbols := p.GetAllSymbols(ctx, cond.Referenced.Pattern, cond.Referenced.Location)
p.log.Info("Symbols retrieved", "symbols", symbols)

incidents := []provider.IncidentContext{}
switch locationToCode[strings.ToLower(cond.Referenced.Location)] {
Expand All @@ -71,7 +72,7 @@ func (p *javaServiceClient) Evaluate(ctx context.Context, cap string, conditionI
case 9:
incidents, err = p.filterVariableDeclaration(symbols)
case 10:
incidents, err = p.filterTypeReferences(ctx, symbols)
incidents, err = p.filterDefault(symbols)
case 11:
incidents, err = p.filterDefault(symbols)
default:
Expand Down

0 comments on commit f549c97

Please sign in to comment.