rakish (adj.)

1706, "debauched, disreputable," from rake (n.2) + -ish. Related: Rakishly; rakishness.

The meaning "smart, jaunty, dashing" (1824) is said to be a different word, probably from rake "slant, slope" (1620s), used especially in reference to any deviation from the vertical in a ship's masts, of uncertain origin, perhaps from Scandinavian (compare Old Swedish raka "project, reach;" Danish rage "protrude, project") related to Old English reccan "stretch." "The piratical craft of former times were distinguished for their rakish build" [Century Dictionary].