We construct the spin-projection operators for a theory containing a symmetric two-index tensor and a general three-index tensor. We then use them to analyse, at linearized level, the most general action for a metric-affine theory of gravity with terms up to second order in curvature, which depends on 28 parameters. In the metric case we recover known results. In the torsion-free case, we are able to determine the most general six-parameter class of theories that are projective invariant, contain only one massless spin 2 and no spin 3, and are free of ghosts and tachyons.1 By quadratic gravity we mean theories with action containing terms linear and quadratic in the Riemann tensor.2 As an example let us mention here Weyl geometry, where φ is constructed in terms of a vector field. This theory has been revisited recently in [27].3 By accidental symmetry we mean a gauge symmetry that is present in the linearized action but not in the full action 4 This is due to the use of the vierbein formalism. The general two-index tensor is the linearized vierbein and the three-index tensor is the linearized spin connection.