Good metrics for quality in code
As more and more code goes to production it is important to establish right set of metrics for measuring quality in code. With excerpts from Mesauring Software Quality: A Guide to Employing Metrics in Software Development Processese Copyright © 2020 by IT Revolution

Quality covers lots of aspects such as - reliability, maintainability, scalability, agility (related to software architecture monolithic of microservices and serviceability
State of DevOps Report published by DORA says that high-performing organizations have lower lead times and increased frequency of software deployments
What are are two leading indicators categories for measuring quality?
Measure against the code: for e.g. static code analysis tools, usage of feature flags etc.
Measure against development and operations processes: For e.g. different types of testing which happen, time taken in integration testing, progressive delivery such as A/B Testing, Canary Deployment
What are key elements when measuring software quality?
Run Experiments
Establish Targets
Establish Guardrails
Update Goals and Metrics
Continuous focus and improvement
User Satisfaction and Experience
What are leading indicators for category 1 - measure against the code?
Code can be measured in a variety of ways - bugs, compute, structural complexity, dependencies, crashes, compute test coverage, responsiveness
Testing: Three most common metrics are: static-coverage metrics, performance information, failure rates
Need to ensure that test coverage is done right and new tests are capturing new bugs
Some of the issues in test-coverage are: measuring the wrong things, wrong approach, wrong type of testing, not maintaining testing
Code complexity metrics check if code is using deeply nested control-flow constructs
Need to have architecture level metrics - whether recommended coding patterns such as use of feature flags or dependency injection. Is codebase is realizing full benefits enabled by its chosen architecture
Also check brittleness of code using say chaos engineering
What are leading indicators for category 2 - measure against the process?
Measuring the process or parts of the process can help in improving the quality
How long testing is taking to provide the feedback?
What percentage of tests are automated tests?
What different types of testing is used and what is the fault tolerance of different systems?
How customer expectation testing is being done?
Is code review done as a part of merge and pull requests?
Are overall measurements such as SLAs or adherence to Agile mis-used?
Ref: Mesauring Software Quality: A Guide to Employing Metrics in Software Development Processese Copyright © 2020 by IT Revolution