The impact of plasma shaping through magnetic well modifications on the stability of resistive ballooning modes in tokamaks is analysed, also including finite diamagnetic flows. Various limiting cases of the dispersion relation, obtained by matching the averaged ballooning equation across the ideal and resistive layers, are analysed. It is found that stability is generally improved by the combination of vertical elongation and positive triangularity, although, in some cases, the growth rate of the unstable mode can be enhanced by these effects. Usually, vertically elongated plasmas with no triangularity are prone to exhibit worse stability properties. A value for the critical β above which resistive ballooning modes are driven unstable is identified, and a connection with type-III ELM activity is established.