shoes / shoes3

a tiny graphical app kit for ruby
http://walkabout.mvmanila.com
Other
181 stars 19 forks source link

Cleaning Ruby side of Shoes #332

Open IanTrudel opened 7 years ago

IanTrudel commented 7 years ago

Shoes needs some refactoring and simplification in order to make it easier to understand and maintain. This issue is meant as notes for a future release.

We should enforce a coding style on every Ruby/Shoes files using Rubocop. The default coding style is A community-driven Ruby coding style guide but it's customizable. rubocop -a <filename>

There are several orphan constants such as LIB_DIR, CACHE_DIR, GEM_CENTRAL_DIR that would use some cleaning, better names and most likely be wrapped around Shoes class (i.e. Shoes::RELEASE_NAME).

Some Ruby code is written like a Makefile, such as cache.rb. There are some oddities such as case RUBY_VERSION.

There is dead code or code that seems unused. For example, setup.rb:Shoes::setup.install_source. Useless? Unused? Should be removed.

ccoupe commented 7 years ago

I'm not a fan of enforced styles or running additional checkers for every build or telling anyone that might want to fix something that they have to do it 'our way' whatever that would be.

IanTrudel commented 7 years ago

Clean and simple are things that will encourage people to fix something.

Coding style should be enforced through Rubocop possibly in Shoes Rakefile. We run it once in a while (or after a new release or all the time) rather than asking contributors to run it. People tend to follow existing coding style... but right now there is no consistency in Shoes. So in doubt people use what they already know or guesswork, isn't it?

IanTrudel commented 7 years ago

I created a pull request from my rubyside repo. It contains code formatted Shoes and Samples. Setting up Rubocop to be less aggressive and give code some consistency. Works fine here so far.