The location of accessory buildings and uses in residential districts shall meet the following requirements: (1) Where an accessory building is attached to the main building, a substantial part of one wall of the accessory building shall be an integral part of the main building, or such accessory building shall be attached to the main building in a substantial manner by a roof and, therefore, subject to the requirements applicable to the main building. (2) A detached accessory building shall not be closer than ten feet to the main building, nor closer than five feet to the lot line. (3) A detached accessory building not more than two stories in height may be constructed on not more than 30 percent of the rear yard. (4) No detached accessory building may be located on the front yard of a lot, nor the side yards except for detached garages.