Welcome to the community!
This is not possible out of the box. Why?
- Quality Gate conditions are set on project-level measures.
- There are no project-level measures on method-level values
- There’s no way to set up
x && y conditions
That said, this might be accomplishable with some ingenuity and tolerance:
- Write a custom rule (I’ll assume Code Smell) that raises an issue when both conditions are met
- Add the rule to you profile as a Blocker
- Add a Quality Gate condition on Blocker Code Smells. Note that the condition will fail on any Blocker Code Smells, not just on violations of your rule. That’s the “tolerance” part.
If you decide to pursue this, feel free to come back to us with new ‘Plugin Development’ threads when you have specific development questions. Assuming you’re talking about a language with an open source analyzer, the existing rules on these metrics will give you a good head start on implementation.