A non-transitory computer-readable storage medium including computer executable instructions, wherein the instructions, when executed by a computer, cause the computer to perform a method for automatically detecting code smells in a source code in any of a plurality of object-oriented programming languages and performing language-specific code correction, the method comprising:
- selecting and retrieving a source code file having the source code;
- maintaining, in memory, representations of linguistic structures of a Domain Specific Language (DSL) using a formal grammar, wherein the DSL is a language-independent formal language to solve a class of problems in a domain of knowledge;
- applying, by the processing circuitry, smell detection rules to the source code in the source code files to detect potential code smells, wherein each smell detection rule is for detecting a code smell type, wherein the processing circuitry maintains an extensible set of smell specifications templates;
- applying the DSL to specify specific corrective actions for each detected code smell and generating, by the processing circuitry, corrected source code based on the corrective actions;
- and
- outputting a file with a correction report for the corrected source code to the memory.