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

Incorrect Java class name identification #189

Open
kevintweber-crandkgroup opened this issue Oct 19, 2024 · 1 comment
Open

Incorrect Java class name identification #189

kevintweber-crandkgroup opened this issue Oct 19, 2024 · 1 comment

Comments

@kevintweber-crandkgroup

In the file CoverageProcessor.py and method def extract_package_and_class_java(self), the line of code that identifies the class name is incorrect.

class_pattern = re.compile(r"^\s*public\s+class\s+(\w+).*")

This only handles classes with a single pattern: public class NameOfClass ...
Other class declarations are not handled:

  • public final class NameOfClass ...
  • abstract public class NameOfClass ...
  • class NameOfClass ...
  • public static class NameOfClass ...

Additionally, interfaces can also be tested.

  • public interface NameOfInterface ...
  • public sealed interface NameOfInterface ...

I would recommend modifying the class_pattern to be:

class_pattern = re.compile(r"\s*(class|interface)\s+(\w+).*")

and then match the second group instead of the first.

Additionally, you should get only the first class declaration, which will not pull in inner classes.

Good luck!

-- Kevin

P.S. Great project! Well done.

@EmbeddedDevops1
Copy link
Collaborator

@kevintweber-crandkgroup Thank you very much for filing the issue. We'll add this to the queue. If you happen to get to it before us please do open up a Pull Request and add a sample project under templated_tests/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants