... this is always a passionate issue among people from different parts of the world. My personal motto is "in Rome do as Romans do", without questioning whether I think it's right or wrong. Paris and Barcelona are two large cities therefore you'll find all sorts of residents: different 'urban tribes' (if you catch my drift), different nationalities with different 'fashion patterns', etc. Thus i'd be wrong to say this city is like this or like that, the correct answer is: it depends.
Both in Paris and in Barcelona there's an unofficial dress code, or rather 'style', observed by many of their citizens and that then defines the style of the city. Paris is more formal than Barcelona's, probably because the later is a coastal city and generally speaking coastal cities tend to be less strict, so to speak. In Barcelona, this "style" is smart casual for most things. Shorts are not really used by men, except on outdoor/beach activities or if you're under 25. For women it's a bit different as fashion trends do impact and you'll find many wearing shorts (and sometimes short shorts, prudish be warned!), especially in younger generations. However note that citizens are not tourists, you go to work, to pick up your kids at school, etc so you don't dress the same than when you're holidaying.
But again, 2 million souls living in the city means many different options -including shorts!