Anti-patterns occur when software design principles are not followed in the software design and coding process. Although there may be no errors or bugs in the software implementation, the quality of the software is reduced. To improve the quality of the software, its anti-patterns should be identified and corrected. Various software engineering criteria are defined and they are used to detect anti-patterns. Choosing the correct and limited combination of criteria as a detection rule is the main purpose of new automatic anti-pattern detection methods. Selection of base examples in these methods for their training is a challenge, which is highly dependent on software experts. In our method, the anti-patterns identified in open-source programs presented as a standard are used for the base examples to reduce the influence of experts’ tastes in detection. The second challenge in all metric-based methods is the complexity of choosing correct and limited criteria in detection rules which in our method by separating the rule tree for every anti-pattern, considered criteria are limited as much as possible. Therefore, we present the SADSE method, which is a new approach to create anti-pattern detection rules using standard base examples and reduce the complexity of searching for suitable software metrics. to identify the detection rules, a new fitness function is defined in the genetic programming, and the rule tree is created to identify each anti-pattern separately to reduce the complexity of selecting software criteria. The analysis of our method by SERC Benchmark shows that its precision and recall on average for all considered anti-patterns are 97% and 96.9%, respectively.