This rule is not valid for tests files (prefixed by test_ or suffixed by _test.py) because testing requires some camel case methods, such as, tearDown, setUp, and more.
# name used in many testing frameworks. Do not warn on itdeftearDown(self):"""After each test case, reset and remove the dummy tracer"""super(TracerTestCase,self).tearDown()
classTestModel(unittest.TestCase):defsetUp(self):# used in a file model_test.py, skip the rule for setUp and tearDownpassdeftearDown(self):# used in a file model_test.py, skip the rule for setUp and tearDownpassdeftest_violation_category(self):self.assertEqual(ViolationCategory.BEST_PRACTICE.value,1)self.assertEqual(ViolationCategory.DESIGN.value,2)v1=Violation("bla",1,"description",2,ViolationCategory.BEST_PRACTICE,10,"notool")self.assertEqual(v1.get_category_string(),"Best Practices")v1=Violation("bla",1,"description",2,1,10,"notool")self.assertEqual(v1.get_category_string(),"Unknown")
シームレスな統合。 Datadog Code Security をお試しください
Datadog Code Security
このルールを試し、Datadog Code Security でコードを解析する
このルールの使用方法
1
2
rulesets:- python-code-style # Rules to enforce Python code style.