From 274fbd6d1b1810d80ac3080bf1c5a995cbb1d1df Mon Sep 17 00:00:00 2001 From: Matus Valo Date: Sun, 27 Mar 2022 00:33:43 +0100 Subject: [PATCH] Added example for attribute-defined-outside-init Co-authored-by: Vladyslav Krylasov --- doc/data/messages/a/attribute-defined-outside-init/bad.py | 3 +++ doc/data/messages/a/attribute-defined-outside-init/good.py | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 doc/data/messages/a/attribute-defined-outside-init/bad.py create mode 100644 doc/data/messages/a/attribute-defined-outside-init/good.py diff --git a/doc/data/messages/a/attribute-defined-outside-init/bad.py b/doc/data/messages/a/attribute-defined-outside-init/bad.py new file mode 100644 index 0000000000..e62884d497 --- /dev/null +++ b/doc/data/messages/a/attribute-defined-outside-init/bad.py @@ -0,0 +1,3 @@ +class Student: + def register(self): + self.is_registered = True # [attribute-defined-outside-init] diff --git a/doc/data/messages/a/attribute-defined-outside-init/good.py b/doc/data/messages/a/attribute-defined-outside-init/good.py new file mode 100644 index 0000000000..cc7d7acb18 --- /dev/null +++ b/doc/data/messages/a/attribute-defined-outside-init/good.py @@ -0,0 +1,6 @@ +class Student: + def __init__(self): + self.is_registered = False + + def register(self): + self.is_registered = True