Skip to content
Commits on May 27, 2016
  1. @sharplet

    Add Swift guideline recommending weak references are evaluated once

    If a weak reference is evaluated multiple times within the same scope,
    it's technically possible for the reference to change between `nil` and
    non-`nil` between references. In order to ensure that valid references
    remain valid for the entire scope, recommend that weak references are
    evaluated only once.
    sharplet committed Mar 4, 2016
  2. @gfontenot

    Prefer protocol conformance to object inheritance

    Protocol conformance in Swift 2+ is a much more powerful form of
    polymorphism than object inheritance and so should be the preferred
    method. Among other things, using protocols means that you don't need to
    care about the kind of object (struct, enum, or class), which puts way
    fewer restrictions on your larger project architecture decisions.
    Conversely, since object inheritance can only be achieved with classes,
    they force you to make certain decisions about your application
    architecture that might have adverse side effects.
    gfontenot committed Feb 12, 2016
  3. @robwierzbowski @mike-burns

    Put remote devs on equal footing for code review

    Instead of promoting in-person communication, we can promote synchronous
    communication. This matches the intent without ignoring the increasing
    chance that a developer is remote.
    robwierzbowski committed with mike-burns May 9, 2016
Commits on Apr 29, 2016
  1. @bernerdschaefer

    Prefer private for non-public accessors

    We added a preference for `protected` over `private` for non-public
    accessors in [#190]. The primary motivation was because Ruby emitted
    warnings when declaring private attributes.
    
    In Ruby versions 2.3.0 and greater, Ruby no longer warns about private
    attributes, so there's no longer a need to use `protected` for them.
    
      [#190]: #190
    bernerdschaefer committed Mar 23, 2016
Commits on Apr 21, 2016
  1. @mike-burns

    Start a quick "how to ..." section

    This section is to address the growing amount of internal tools we have
    built over time; it is an attempt at making them more discoverable in a
    problem/solution format instead of a long list, plus a quick-start
    guide.
    
    This is in RST format so that we can make use of the table of contents
    feature.
    mike-burns committed Apr 7, 2016
Commits on Apr 18, 2016
  1. @jferris

    Fix obsolete Rubocop configuration

    The DefaultScope cop was removed:
    
    bbatsov/rubocop#1895
    
    The TrailingComma cop was split into two:
    
    bbatsov/rubocop@a0719f9
    jferris committed Apr 18, 2016
Commits on Mar 29, 2016
  1. @mandybess
Commits on Mar 14, 2016
  1. @MattMSumner

    Trailing comma for object literals and arrays

    Why:
    
    * We'd like to explicitly encourage the use of a trailing comma when
      defining multi line JavaScript object literals or arrays.
    
    This PR:
    
    * Adds a guideline for using trailing commas and an example.
    MattMSumner committed Jan 8, 2016
  2. @kaishin
Commits on Mar 3, 2016
  1. @tysongach
Commits on Mar 2, 2016
  1. @BlakeWilliams

    Use a leading underscore for memoization

    When using an instance variable prefix the variable with an underscore
    to discourage direct use of the ivar over the method.
    BlakeWilliams committed Nov 16, 2015
Commits on Feb 26, 2016
  1. @drapergeek

    Recommend against `toggleProperty`

    Using `toggleProperty` makes tracking down interactions a lot harder. Using explicit actions for what you expect to happens make code easier to maintain and debug.
    drapergeek committed Jan 26, 2016
Commits on Feb 12, 2016
  1. @gfontenot

    Specify when to use () and Void in func signatures

    We want to avoid ambiguity, especially with our return types. Functions
    that return `()` can become hard to read when passed as an argument to a
    higher order function. For example:
    
    ```swift
    func f(g: () -> ()) { }
    ```
    
    The parens for the return value end up getting lost in the closing
    parens for the higher order function. Conversely, by using `Void`:
    
    ```swift
    func f(g: () -> Void) { }
    ```
    
    `Void` stands out as a specific type on its own, and doesn't get lost in
    a mess of parens.
    
    At the same time, `()` is a nice brief indication that a function takes
    no arguments, and mimics the look of an empty tuple. So if you declare
    these two functions:
    
    ```swift
    func fa(g: () -> Void) { }
    func fb(g: (a: T) -> Void) { }
    ```
    
    There is a visual similarity between the two functions.
    
    This is also how Apple prefers to style functions taking or returning
    `Void`.
    gfontenot committed Jan 20, 2016
  2. @MattMSumner

    Remove advice to use coffeescript

    Why:
    
    * More projects have been using JavaScript or JavaScript with a
      transpiler such as babel to get future features of the language.
    * Leaving clients a project with CoffeeScript adds an additional
      barrier to finding talent comfortable working on their product.
    * ES6 transpiling give most of the benefits we enjoy with CoffeeScript,
      such as classes and object destructuring, without the drawback of a
      different syntax from JavaScript.
    * More developers are familiar with JavaScript then CoffeeScript.
    
    This PR:
    
    * Removes an "Example:" with no following example.
    MattMSumner committed Jan 8, 2016
  3. @tonyd256 @gfontenot

    Guard against bad `guard` syntax

    Suggest formatting for dealing with `guard` syntax in Swift.
    tonyd256 committed with gfontenot Jan 20, 2016
  4. @gfontenot

    Use 2 spaces for indentation in Swift

    This brings Swift inline with the defaults for Ruby and other languages.
    The benefit here is that while working outside of Xcode (as some of us
    try to do), we can use a consistent setting for indentation instead of
    having to special case Swift.
    
    From a visual aspect, I've gotten used to the look of 2 spaces, and I
    think it feels nice to move away from the 4 space indentations of
    Objective-C.
    
    A few of our projects (internal and external) are already using 2
    spaces, and I think in _general_ people have liked it more.
    
    Note that this has already been proposed, but was shot down because we
    couldn't come to a real consensus. I'd like to re-poll the team and see
    where we stand now.
    gfontenot committed Jan 20, 2016
  5. @gfontenot

    Add line length limit for Swift

    We should probably have _some_ guideline for line length in Swift. 80
    feels too short, since we tend to work with fairly verbose APIs.
    SwiftLint has settled on 100 characters, which seems like a reasonable
    length.
    
    In Xcode you can add a line length guide inside Preferences -> Text
    Editing.
    gfontenot committed Jan 20, 2016
  6. @gfontenot

    Remove callout to Objective-C styleguide in Swift

    We aren't following many (any?) of the guidelines from Objective-C.
    There's no real reason to bring attention to it anymore. We should
    instead look ahead and add guidelines for Swift without the legacy
    baggage.
    gfontenot committed Jan 20, 2016
  7. @gfontenot

    Specify preference for structs over classes

    Also note that if you _are_ going to use a `class`, you should default
    to marking it as `final`.
    gfontenot committed Jan 19, 2016
  8. @tonyd256

    Update for latest Swift 2+

    Since this was written, we got optional chaining with `?` and `println` changed to `print`.
    tonyd256 committed with tonyd256 Jan 20, 2016
Commits on Jan 27, 2016
  1. @seanpdoyle

    Prefer testing your Ember application with QUnit

    https://trello.com/c/VnZehZn1
    
    > Prefer testing your application with [QUnit][ember-test-guides].
    
    [ember-test-guides]: https://guides.emberjs.com/v2.2.0/testing/
    seanpdoyle committed Jan 7, 2016
Commits on Jan 15, 2016
  1. @jferris

    Use an ORDER BY clause for user-visible queries

    > If sorting is not chosen, the rows will be returned in an unspecified
    > order. The actual order in that case will depend on the scan and join
    > plan types and the order on disk, but it must not be relied on. A
    > particular output ordering can only be guaranteed if the sort step is
    > explicitly chosen.
    
    http://www.postgresql.org/docs/8.3/static/queries-order.html
    jferris committed Jan 7, 2016
  2. @jferris

    Avoid rendering issues from async loading

    We want pages which render quickly, smoothly, and securely. Techniques
    which disrupt a smooth rendering process should be avoided.
    jferris committed Dec 4, 2015
Commits on Jan 12, 2016
  1. @seanpdoyle

    JavaScript: Disallow multiple `var` declaration

    The `disallowMultipleVarDecl` rule already exists in the `.jscsrc`.
    Unfortunately, it is invalidly declared.
    
    This commit corrects the declaration.
    
    [rule]: http://jscs.info/rule/disallowMultipleVarDecl
    seanpdoyle committed Jan 12, 2016
Commits on Jan 11, 2016
  1. @malandrina

    Add best practices for building Ruby JSON APIs

    * Recommend that readers review Heroku's HTTP API Design Guide before
      developing JSON APIs
    * Recommend `oj` for parsing JSON and RSpec request specs for integration
      testing, per iOS on Rails
    * References:
      https://github.com/thoughtbot/ios-on-rails/blob/master/book/rails/introduction.md#parsing-incoming-json-requests
      https://github.com/thoughtbot/ios-on-rails/blob/master/book/rails/creating_a_get_request.md#it-all-starts-with-a-request-spec
    malandrina committed Oct 21, 2015
  2. @LkeMitchll

    Add link to an explanation of `git rebase -i ...`

    I did not understand the `git rebase -i ...` interface at first.
    
    This link to the Github docs really helped explain the interface.
    LkeMitchll committed Jan 8, 2016
Commits on Jan 8, 2016
  1. @tysongach
  2. @seanpdoyle

    Enable Hound

    Enable [Hound] linting for style guidelines with accompanying code
    samples.
    
    [Hound]: https://houndci.com
    seanpdoyle committed Jan 8, 2016
  3. @seanpdoyle

    Add `requireTrailingComma` rule to JSCS

    Add the [`requireTrailingComma`][rule] rule to JSCS configuration.
    
    Enforce the presence of trailing comma's in multi-line array and object
    literal declarations.
    
    [rule]: http://jscs.info/rule/requireTrailingComma
    seanpdoyle committed Jan 6, 2016
  4. @seanpdoyle

    Reccommend `belongs_to :relation, touch: true`

    Based on @sgrif's recommendation (near 17:19) on [The Bike Shed][bikeshed-41].
    
    Thinking about an application's caching strategy and its implications to
    the data model is usually put off until some point in the future.
    
    `touch`ing `belongs_to` relationships is a straightforward way to
    pre-emptively configure applications to integrate with Rails' russian
    doll caching.
    
    Rails 5 will batch `touch`-generated DB writes.
    
    [bikeshed-41]: http://bikeshed.fm/41
    seanpdoyle committed Dec 9, 2015
  5. @geoffharcourt

    Suggest referencing class by constant in AR macros

    For ActiveRecord associations where AR can't automatically determine the
    class for the association, the `class_name` option allows the developer
    to specify what class should be used. This option can take either the
    constant of the model class `Person`, or a string that matches the
    class' name `"Person"`.
    
    Using a string to specify this option postpones feedback that the class
    might be missing. For example, if my model has an association like this
    where the `Author` class does not yet exist:
    
    ```ruby
        class Post < ActiveRecord::Base
          has_one :author, class_name: "Person"
        end
    ```
    
    Specs will only fail if they interact with the association. If
    `class_name` is specified as `class_name: Person`, and `Person` does not
    exist, an uninitialized constant `NameError` exception will stop all
    execution of the application.
    
    There may possibly be some memory-use benefit to creating fewer strings
    during application initialization, but I think the early failure
    feedback benefit of this practice provides enough value on its own to
    recommend it as a best practice.
    geoffharcourt committed Dec 23, 2015
Commits on Jan 5, 2016
  1. @joshuaclayton

    Prefer method invocation over instance variables

    Referring to instance variables in various methods within a class
    violates the single level of abstraction principle; it applies a
    specificity that methods using this information need no context of.
    
    By preferring method invocation over instance variables, it provides the
    developer the ability to refer to a concept which can be defined by a
    method via direct definition or via `attr`, `attr_reader`, or `attr_accessor`.
    joshuaclayton committed May 6, 2015
Commits on Jan 4, 2016
  1. @mjankowski
Commits on Dec 9, 2015
  1. @gfontenot

    Add guideline for capitalization in Swift

    When naming initialisms or acronyms, we should be following the
    capitalization of the initial letter.
    
    BAD:
    
    ```swift
    let Id: String
    let userId: String
    ```
    
    GOOD:
    
    ```swift
    let id: String
    let userID: String
    ```
    gfontenot committed Dec 9, 2015
Commits on Dec 7, 2015
  1. @seanpdoyle

    Add `style/javascript/.jscsrc`

    Inspired by our Ruby styleguide, which has an accompanying
    `.rubocop.yml.
    
    Adding a JSCS linter to thoughtbot/guides allows us to configure Hound
    to use our company-wide styleguide:
    
    ```yml
    jscs:
      enabled: true
      config_file: https://raw.githubusercontent.com/thoughtbot/guides/master/style/javascript/.jscsrc
    ```
    
    Uses new [`JSCS@2.6.x`][jscs] rules.
    
    [jscs]: https://github.com/jscs-dev/node-jscs/releases/tag/v2.6.0
    seanpdoyle committed Nov 15, 2015
Something went wrong with that request. Please try again.