my-class-definition

Try in Playground
react-perfUnknownInformational

0

No tags

No CWE or CVE

Ast Rule: class definition


my-class-definition

How to write a rule
function visit(node, filename, code) {
	if(!node?.name?.value) return;
	
	if(node.name.value === "MyClass") {
		const error = buildError(
			node.name.start.line, 
			node.name.start.col,
			node.name.end.line,
			node.name.end.col,
			`Don't use MyClass`,
			"INFORMATIONAL",
			"BEST_PRACTICE"
		);
		addError(error)
	}
		
}

python.py

Expected test result: has error

class MyClass:
  def __init__(self):
    pass


  def my_method(self, argument):
    pass
Add comment

Log in to add a comment


    Be the first one to leave a comment!

Codiga Logo
Codiga Hub
  • Rulesets
  • Playground
  • Snippets
  • Cookbooks
soc-2 icon

We are SOC-2 Compliance Certified

G2 high performer medal

Codiga – All rights reserved 2022.