-
Notifications
You must be signed in to change notification settings - Fork 192
Style Guide
The Shoes 4 project does not have a tightly-laced style guide. Some kids like to crisscross their laces. Others like straight lines. Some people prefer double knots or puffy tongues or high heels. Still, there are a few guidelines we try to follow. You can help make the code easier to read by following these guidelines whenever they feel comfortable on your feet.
JRuby allows the use of Java-style notation for methods called on Java objects. We prefer a Ruby-style notation. Please use
-
object.add_paint_listener blockinstead ofobject.addPaintListener(block) -
composite.backgroundinstead ofcomposite.getBackground -
composite.background = colorinstead ofcomposite.setBackground(color) -
button.disposed?instead ofbutton.isDisposed
NOTE: Using Ruby notation sometimes produces surprising results. For example, Swt::Widgets::Composite objects have #getLayout and #setLayout methods. However, they also have a #layout method. This means that composite.layout is not the same method as composite.getLayout.
Work is underway to enable Rubocop on the Shoes project. This will help us to enforce consistent coding practices.
While not yet required by CI, feel free to run rubocop from the root directory to see how your changes fare!