You can't
Not directly, because each feature is different, each application is different, and each developer is different.
That said, there are some indirect measures you can use to approximate the information you are looking for:
Cyclomatic complexity - in its simplest form, a measure of how many different ways through a given function there are. As a general rule, a high level of cyclomatic complexity means your function might be doing too much and could stand to be broken down more.
Module/function length - is a crude measurement (similar to lines of code but taken at the unit level rather than an overall level) but in general terms, the largest functions are also likely to be the most complex and the most troublesome.
Depth of inheritance - roughly speaking how many objects up and down the chain the current object links to. A customer object might be a specialized type of person object and have 3 address objects (residence, billing, shipping), multiple order objects which in turn have order line objects which then have product objects... You get the point. The more dependencies on an object, the more complex the code, and the more likely the code is to have some kind of problem.
This is not an exclusive list by any means. There is a decent summary available at this site (I have no affiliation) although it doesn't mention the one metric that should be used everywhere - WTF Per Minute. At the risk of sounding flippant, if the reaction in a code review or from a tester is "WTF???", the code has a problem. If a test session or a code review has generates a lot of "WTF???" reactions, that code has a lot of problems and needs attention.
And of course, the ultimate metric is pretty much impossible to measure directly, namely the proportion of customers and potential customers who walk (that is, abandon the software or go elsewhere) because the software exceeds their personal WTF limit. You really can't measure how many people look at your site and consider possibly using your software then decide they don't have enough confidence in your company's ability to deliver because of what they see on the website.