Skip to content

Commit

Permalink
fixed __new__ bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Ben David committed Nov 11, 2020
1 parent cea0548 commit 30d0275
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions flake8_intsights/checkers/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def check_functions(
if isinstance(node.parent, astroid.ClassDef):
function_is_classmethod = False
function_is_staticmethod = False

if node.name == '__new__':
function_is_classmethod = True

for decorator_name in node.decoratornames():
if decorator_name == 'builtins.classmethod':
function_is_classmethod = True
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setuptools.setup(
name='flake8-intsights',
version='0.1.1',
version='0.1.2',
author='Gal Ben David',
author_email='[email protected]',
url='https://github.com/Intsights/flake8-intsights',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def get_linting_errors(
def test_case_1(
self,
):
self.assertEqual(
self.assertCountEqual(
first=self.get_linting_errors(
source_code=texts.naming.naming_test_text_001,
),
second=[
(
58,
65,
18,
'I097 function arguments should be lower case',
'intsights_checker',
Expand Down
7 changes: 7 additions & 0 deletions tests/texts/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ def method_11(cls):
def method_12(self):
pass
def __new__(
cls,
*args,
**kwargs
):
pass
def function_five(Argumemnt):
pass
'''
Expand Down

0 comments on commit 30d0275

Please sign in to comment.