Yup it’s a dress code they have the right to refuse to serve as a restaurant.
Absolutely, but the Equality Act means having a dress code for one gender is potentially unlawful (that’s not the same as illegal!). However if their rules were “we expect you to be dressed like you are going out for dinner, not loafing on a beach” would be fine – and I’d have no issue with them refusing you entry in shorts (and ironically even allowing ladies in short skirts!)…
Men wearing shorts and even short sleeves / open necks (outside of sports) can be frowned upon in some Asian cultures. Not sure if it’s the case here but if the restaurant is Pakistani or Bangledishi owned that could be a factor. Even in any respectable European restaurant they wouldn’t want you in shorts. There’s usually no sign because it’s just a bit like knowing not to wear you pants on your head to dinner.
A more politically correct sign would be “No Scratters”.