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

Add Getters & Setters metric #267

Merged
merged 180 commits into from
May 8, 2024
Merged

Add Getters & Setters metric #267

merged 180 commits into from
May 8, 2024

Conversation

padjal
Copy link
Contributor

@padjal padjal commented Apr 4, 2024

No description provided.

@padjal
Copy link
Contributor Author

padjal commented Apr 5, 2024

@yegor256 Can you approve the workflows?

@yegor256
Copy link
Owner

yegor256 commented Apr 6, 2024

@padjal try make test locally

Removed commented and unused code
@padjal
Copy link
Contributor Author

padjal commented Apr 6, 2024

@yegor256 Good points, I have revised them and refactored the code.

@padjal
Copy link
Contributor Author

padjal commented Apr 6, 2024

@yegor256 The only failing test locally is the jpeek, but I have not touched it
image

@yegor256
Copy link
Owner

yegor256 commented Apr 6, 2024

@padjal try to install Maven locally and run again. Maven is required.

@padjal
Copy link
Contributor Author

padjal commented Apr 21, 2024

@yegor256 Please see latest changes.

@padjal
Copy link
Contributor Author

padjal commented Apr 21, 2024

@yegor256 I have fixed all linting errors. However, a failing test blocks the workflow:
image

Locally, this test completes successfully:
image

Could you have a look?

@yegor256
Copy link
Owner

@padjal try to push something new into the branch, the tests should pass

@padjal
Copy link
Contributor Author

padjal commented Apr 21, 2024

@yegor256 Added something new as advised.

@padjal
Copy link
Contributor Author

padjal commented Apr 22, 2024

@yegor256 Could you please have a look?

@yegor256
Copy link
Owner

@padjal now the problem is clearly related to your branch

@padjal
Copy link
Contributor Author

padjal commented Apr 22, 2024

@yegor256 All I see is this
image

Is this related to the new metric?

@yegor256
Copy link
Owner

@padjal yes, I think so, because of the name getset.py (it belongs to your branch, I believe)

@padjal
Copy link
Contributor Author

padjal commented Apr 22, 2024

@yegor256 I cannot understand how the report creates such a file for the ast.py metric, but doesn't succeed to do it for the getset one. I have no idea how to debug awk '{ s= "\\item\\ff{" $1 "}: "; for (i = 3; i <= NF; i++) s = s $i " "; print s; }' < "${metric}" >> "${list}" in a meaningful way.

@padjal
Copy link
Contributor Author

padjal commented Apr 23, 2024

@yegor256 Do you have any tips here?

@padjal
Copy link
Contributor Author

padjal commented May 6, 2024

@yegor256 I have fixed the output. Please review.

@padjal
Copy link
Contributor Author

padjal commented May 6, 2024

@yegor256 Do you think that I should add anything else?

@yegor256
Copy link
Owner

yegor256 commented May 6, 2024

@padjal as far as I understand, the idea was to count getters and setters in a class. Now, the description of the metric looks different. I don't understand what is "maximum complexity of getter"? Can you explain it better?

@padjal
Copy link
Contributor Author

padjal commented May 6, 2024

@yegor256 I can change the main objective of the metric to be a counter of the getters and setters in a class. Do you think that this metric will yield any useful information?

As per hour research paper, the original idea of the Getters and setters metric was something like this:
Getters and setters are a well-known design pattern, especially in Java. A getter is supposed to be a method that returns the value of an encapsulated attribute, while a setter is supposed to set the value of it. However, some programmers misunderstand how getters and setters are intended to be designed; they include a lot more evaluations inside them. In order to find out how often getters and setters are not designed as expected, we analyzed 100K+ Java classes from 100+ public GitHub repositories, and then summarized the results obtained.

Research question - How often are getters and setters not designed as expected?

Now that I review this approach however, it might turn out that this is not a trivial task. Maybe your suggestion to just count the number of getter & setter methods in a class is better. Please tell me what you think and how I should proceed in this case.

@padjal
Copy link
Contributor Author

padjal commented May 7, 2024

@yegor256 What do you think?

@padjal
Copy link
Contributor Author

padjal commented May 7, 2024

@yegor256 I have changed the metric according to your suggestions. Please review.

@padjal
Copy link
Contributor Author

padjal commented May 7, 2024

@yegor256 Can you review this, please?

@yegor256 yegor256 merged commit 91a4017 into yegor256:master May 8, 2024
10 checks passed
@yegor256
Copy link
Owner

yegor256 commented May 8, 2024

@padjal thanks!

@padjal padjal deleted the get-set branch May 8, 2024 07:41
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

Successfully merging this pull request may close these issues.

9 participants