The By-the-Book Cop is a stock character in police shows and crime fiction in general. They're the cop who believes in following the law as it is written, playing by the rules even when the criminal scum they're after does not. A stickler for procedure, the By-the-Book-Cop is quick to chide their rookie partner for playing fast and loose out in the streets, and when they're Da Chief, you'll see them constantly threaten to suspend the loose cannon for their impulsive heat-of-the-moment shoot-first-ask-questions-later behavior. If they deem that the situation warrants it, they may bend the rules slightly, but they'll never go so far as to break them; they are, after all, honest and incorruptible.
Appears less regularly as a main character, in which case they're likely to be presented with a To Be Lawful or Good dilemma, and/or act as the only cop who even glances at the book.
Often the complete opposite of a Cowboy Cop, with whom they are often paired to form an Odd Couple. If a Good Cop/Bad Cop dynamic forms, they tend to be the good one. Police officers who appear in the Police Procedural tend to be uniformly this type of cop, due to the relative paucity of cowboy cops in Real Life. Depending on the themes of whatever piece of fiction they are in, the By-the-Book-Cop can be either a protagonist who represents the epitome of honesty, or an antagonistic Obstructive Bureaucrat who gets in the Cowboy Cop's way.
Can sometimes overlap with Reasonable Authority Figure if they acknowledge that occasional breaches of procedure can be acceptable, or even necessary, depending on the circumstances. But it can just as easily crossover into Lawful Stupid if they adamantly insist on adhering to protocol no matter what (including towards Cop Killers). May also overlap with Goody Two-Shoes.
Compare Always Gets His Man (the idealized hero cop). Contrast Cowboy Cop (habitual rule-breaker, but good), Dirty Cop (unethical, self-serving), Rabid Cop (out-and-out psycho) and Bothering by the Book (using the bureaucracy's own regulations against them).