Since code quality is quite a broad term, lots of measurements should be taken to determine the code quality of a piece of code.
Possible metrics to be applied are unit test code coverage, the number of compiler warnings, cyclomatic complexity, etc. TIOBE offers a predefined set of 8 software metrics to get a good indication of code quality. See our TIOBE Quality Indicator Quality Model for more details.