Skip to content
Stefan Hornburg (Racke) edited this page Apr 12, 2014 · 17 revisions

Git

Please make really sure that your commits are correct and contain the files you expect.

Commit messages

Please use relevant commit messages and don't repeat them literally if you fix a mistake in an earlier commit.

Before push

Perl modules

Before pushing any non-trivial changes, run

RELEASE_TESTING=1 make test

and fix any errors that show up from these tests.

Debugging

Always include the subject of debugging in the log messsage. For example, if you dumping errors:

debug to_dumper($errors);

This might result in the following message:

debug @0.070835> $VAR1 = undef;

So other developers will have no clue when looking at the logs, please use instead:

debug "Form error: ", to_dumper($errors);

Layout (HTML/CSS)

Add/update version numbers to style sheets after changing them. This ensure that HTML stays in sync with CSS.

<link rel="stylesheet" type="text/css" media="screen" href="/css/main.css?v=46" />

It should be clear what belongs inside the HTML, this is a really bad example:

<tr>
  <td colspan="2">bla</td>
</tr>              

Also HTML elements which are supposed to filled with content need either HTML class or id attribute.

List of views for the layout

  • ...

  • Email receipt

  • Page not found (400)

  • Error (500)

  • Account

    • View orders (overview + detail)

DBIC

Relationship accessor names

NOTE: The following rules do not apply to many_to_many relationship bridges.

If the relationship is to a column in a foreign class (i.e. not back to the calling class) then by default the accessor name should be the same as the foreign class name. For example in the Zone class we have:

__PACKAGE__->has_many(
    "ZoneCountry", "Interchange6::Schema::Result::ZoneCountry",
    "zones_id", { cascade_copy => 0, cascade_delete => 0 },
);

If you have several relationships to the same foreign class then the accessor name can be prefixed in order to make the relationship clear. For example in the Order class we have ShippingAddress and Billing Address:

__PACKAGE__->belongs_to(
  "ShippingAddress",
  "Interchange6::Schema::Result::Address",
  { addresses_id => "shipping_addresses_id" },
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->belongs_to(
  "BillingAddress",
  "Interchange6::Schema::Result::Address",
  { addresses_id => "billing_addresses_id" },
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);

These rules are checked by t/schema_sanity.t when make test is run with RELEASE_TESTING=1.

The schema_sanity tests also check for size when it is required and also that column definitions across relationships are compatible (amongst other things).

Clone this wiki locally