hpi-swa-teaching / SketchMorph2

(SWT22-06)
MIT License
5 stars 1 forks source link

(Semi-)Automatic Refactoring #96

Closed ClFeSc closed 3 years ago

ClFeSc commented 3 years ago

I've written a script to automatically perform some refactoring. It currently does the following:

I've added a second commit showing the result of running the script on the current dev. We can safely remove this commit before merging anything as it can be reproduced by running the script again (which takes about 3.5 seconds).

There is also the possibility of automatically committing changes of the script with the CI. This has the drawback of not running the tests on the newly pushed changes since GitHub doesn't run the CI on commits pushed by the token that the CI gets. The workaround would be to add a personal token to the repository, but we can't do that on our own.

That's why my suggestion would be to just run this script locally from time to time.

What are your thought on this?

maximilian-franz commented 3 years ago

Maybe we could look into expanding the refactoring to fully conform with Kent Becks "Smalltalk Best Practice Patterns", but that is not a must and shouldn't be of high priority for now (in my opinion at least).

ClFeSc commented 3 years ago

Maybe we could look into expanding the refactoring to fully conform with Kent Becks "Smalltalk Best Practice Patterns", but that is not a must and shouldn't be of high priority for now (in my opinion at least).

I'm not sure it's possible to do this all automated. When thinking of cases like long lines I can't see a simple program to be able to split it up in multiple lines without making it look extremely weird in at least some cases. And it would take forever to implement. My focus were our own style guidelines as well as some basic stuff like the spaces around the @. Maybe the next group working on this project can extend it further. Furthermore, I'm currently working on a linter that should alert us when something is wrong, but I'm not going to implement a whole book of styleguides into it. But it will be able to tell us issues that the auto-refactor can't fix.

ClFeSc commented 3 years ago

I think I won't do much more for this respecting the time remaining.