From fecc8241764d8e3ae6f8d8e01f75761750de5c82 Mon Sep 17 00:00:00 2001 From: ranc58 Date: Thu, 26 Apr 2018 12:00:06 +0300 Subject: [PATCH] issue #110 create module utils. Fix test_are_tabs_used_for_indentation --- fiasko_bro/__init__.py | 2 +- fiasko_bro/pre_validation_checks/encoding.py | 2 +- fiasko_bro/pre_validation_checks/repo_size.py | 2 +- fiasko_bro/repository_info.py | 2 +- fiasko_bro/utils/__init__.py | 8 ++++++++ fiasko_bro/{ => utils}/ast_helpers.py | 0 fiasko_bro/{ => utils}/code_helpers.py | 0 fiasko_bro/{ => utils}/configparser_helpers.py | 0 fiasko_bro/{ => utils}/file_helpers.py | 0 fiasko_bro/{ => utils}/list_helpers.py | 0 fiasko_bro/{ => utils}/url_helpers.py | 0 fiasko_bro/{ => utils}/validator_helpers.py | 0 fiasko_bro/validators/code_inclusion.py | 4 +--- fiasko_bro/validators/comments.py | 3 +-- fiasko_bro/validators/files.py | 2 +- fiasko_bro/validators/imports.py | 3 +-- fiasko_bro/validators/naming.py | 2 +- fiasko_bro/validators/other_languages.py | 3 +-- fiasko_bro/validators/pythonic.py | 4 +--- fiasko_bro/validators/requirements.py | 2 +- fiasko_bro/validators/syntax.py | 4 +--- .../test_are_tabs_used_for_indentation.py | 2 +- 22 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 fiasko_bro/utils/__init__.py rename fiasko_bro/{ => utils}/ast_helpers.py (100%) rename fiasko_bro/{ => utils}/code_helpers.py (100%) rename fiasko_bro/{ => utils}/configparser_helpers.py (100%) rename fiasko_bro/{ => utils}/file_helpers.py (100%) rename fiasko_bro/{ => utils}/list_helpers.py (100%) rename fiasko_bro/{ => utils}/url_helpers.py (100%) rename fiasko_bro/{ => utils}/validator_helpers.py (100%) diff --git a/fiasko_bro/__init__.py b/fiasko_bro/__init__.py index 2bd05ef..808cb2f 100644 --- a/fiasko_bro/__init__.py +++ b/fiasko_bro/__init__.py @@ -1,3 +1,3 @@ from .code_validator import CodeValidator, validate_repo -from .validator_helpers import tokenized_validator +from .utils.validator_helpers import tokenized_validator from .repository_info import LocalRepositoryInfo diff --git a/fiasko_bro/pre_validation_checks/encoding.py b/fiasko_bro/pre_validation_checks/encoding.py index bac3965..a6b1baf 100644 --- a/fiasko_bro/pre_validation_checks/encoding.py +++ b/fiasko_bro/pre_validation_checks/encoding.py @@ -1,7 +1,7 @@ import os from fiasko_bro.config import VALIDATOR_SETTINGS -from ..file_helpers import is_in_utf8 +from ..utils.file_helpers import is_in_utf8 def are_sources_in_utf(path_to_repo, *args, **kwargs): diff --git a/fiasko_bro/pre_validation_checks/repo_size.py b/fiasko_bro/pre_validation_checks/repo_size.py index b99f8ab..84b7cd3 100644 --- a/fiasko_bro/pre_validation_checks/repo_size.py +++ b/fiasko_bro/pre_validation_checks/repo_size.py @@ -1,4 +1,4 @@ -from .. import code_helpers +from ..utils import code_helpers def are_repos_too_large(path_to_repo, max_num_of_py_files, path_to_original_repo=None, *args, **kwargs): diff --git a/fiasko_bro/repository_info.py b/fiasko_bro/repository_info.py index 6d81fb1..7940e90 100644 --- a/fiasko_bro/repository_info.py +++ b/fiasko_bro/repository_info.py @@ -5,7 +5,7 @@ import git from fiasko_bro.config import VALIDATOR_SETTINGS -from . import file_helpers +from .utils import file_helpers class LocalRepositoryInfo: diff --git a/fiasko_bro/utils/__init__.py b/fiasko_bro/utils/__init__.py new file mode 100644 index 0000000..73cd9ce --- /dev/null +++ b/fiasko_bro/utils/__init__.py @@ -0,0 +1,8 @@ +from .ast_helpers import * +from .code_helpers import * +from .configparser_helpers import * +from .configparser_helpers import * +from .file_helpers import * +from .list_helpers import * +from .url_helpers import * +from .validator_helpers import * diff --git a/fiasko_bro/ast_helpers.py b/fiasko_bro/utils/ast_helpers.py similarity index 100% rename from fiasko_bro/ast_helpers.py rename to fiasko_bro/utils/ast_helpers.py diff --git a/fiasko_bro/code_helpers.py b/fiasko_bro/utils/code_helpers.py similarity index 100% rename from fiasko_bro/code_helpers.py rename to fiasko_bro/utils/code_helpers.py diff --git a/fiasko_bro/configparser_helpers.py b/fiasko_bro/utils/configparser_helpers.py similarity index 100% rename from fiasko_bro/configparser_helpers.py rename to fiasko_bro/utils/configparser_helpers.py diff --git a/fiasko_bro/file_helpers.py b/fiasko_bro/utils/file_helpers.py similarity index 100% rename from fiasko_bro/file_helpers.py rename to fiasko_bro/utils/file_helpers.py diff --git a/fiasko_bro/list_helpers.py b/fiasko_bro/utils/list_helpers.py similarity index 100% rename from fiasko_bro/list_helpers.py rename to fiasko_bro/utils/list_helpers.py diff --git a/fiasko_bro/url_helpers.py b/fiasko_bro/utils/url_helpers.py similarity index 100% rename from fiasko_bro/url_helpers.py rename to fiasko_bro/utils/url_helpers.py diff --git a/fiasko_bro/validator_helpers.py b/fiasko_bro/utils/validator_helpers.py similarity index 100% rename from fiasko_bro/validator_helpers.py rename to fiasko_bro/utils/validator_helpers.py diff --git a/fiasko_bro/validators/code_inclusion.py b/fiasko_bro/validators/code_inclusion.py index 4f2a460..0b54d90 100644 --- a/fiasko_bro/validators/code_inclusion.py +++ b/fiasko_bro/validators/code_inclusion.py @@ -1,6 +1,4 @@ -from .. import code_helpers -from .. import url_helpers -from .. import file_helpers +from ..utils import code_helpers, url_helpers, file_helpers def is_mccabe_difficulty_ok(solution_repo, max_complexity, *args, **kwargs): diff --git a/fiasko_bro/validators/comments.py b/fiasko_bro/validators/comments.py index 7bd9413..2bd4396 100644 --- a/fiasko_bro/validators/comments.py +++ b/fiasko_bro/validators/comments.py @@ -1,7 +1,6 @@ import ast -from .. import ast_helpers -from .. import url_helpers +from ..utils import ast_helpers, url_helpers def has_no_extra_dockstrings(solution_repo, whitelists, functions_with_docstrings_percent_limit, *args, **kwargs): diff --git a/fiasko_bro/validators/files.py b/fiasko_bro/validators/files.py index 2615767..5b9a97b 100644 --- a/fiasko_bro/validators/files.py +++ b/fiasko_bro/validators/files.py @@ -1,6 +1,6 @@ import os -from .. import url_helpers +from ..utils import url_helpers def has_no_long_files(solution_repo, max_number_of_lines, *args, **kwargs): diff --git a/fiasko_bro/validators/imports.py b/fiasko_bro/validators/imports.py index ca140d8..4c4e9af 100644 --- a/fiasko_bro/validators/imports.py +++ b/fiasko_bro/validators/imports.py @@ -1,5 +1,4 @@ -from .. import ast_helpers -from .. import url_helpers +from ..utils import ast_helpers, url_helpers def has_no_star_imports(solution_repo, *args, **kwargs): diff --git a/fiasko_bro/validators/naming.py b/fiasko_bro/validators/naming.py index 7e4c259..bbdbadc 100644 --- a/fiasko_bro/validators/naming.py +++ b/fiasko_bro/validators/naming.py @@ -1,6 +1,6 @@ import builtins -from .. import ast_helpers +from ..utils import ast_helpers from ..i18n import _ diff --git a/fiasko_bro/validators/other_languages.py b/fiasko_bro/validators/other_languages.py index 67f0e81..d33e8a8 100644 --- a/fiasko_bro/validators/other_languages.py +++ b/fiasko_bro/validators/other_languages.py @@ -1,7 +1,6 @@ import ast -from .. import ast_helpers -from .. import url_helpers +from ..utils import ast_helpers, url_helpers def has_no_return_with_parenthesis(solution_repo, *args, **kwargs): diff --git a/fiasko_bro/validators/pythonic.py b/fiasko_bro/validators/pythonic.py index c1dadc8..33cc4b2 100644 --- a/fiasko_bro/validators/pythonic.py +++ b/fiasko_bro/validators/pythonic.py @@ -1,9 +1,7 @@ import ast from .. import ast_nodes_validators -from .. import ast_helpers -from .. import code_helpers -from .. import url_helpers +from ..utils import ast_helpers, code_helpers, url_helpers from ..i18n import _ diff --git a/fiasko_bro/validators/requirements.py b/fiasko_bro/validators/requirements.py index 31b18ee..4bb4623 100644 --- a/fiasko_bro/validators/requirements.py +++ b/fiasko_bro/validators/requirements.py @@ -1,4 +1,4 @@ -from .. import list_helpers +from ..utils import list_helpers from ..i18n import _ diff --git a/fiasko_bro/validators/syntax.py b/fiasko_bro/validators/syntax.py index 200c95a..21f6bff 100644 --- a/fiasko_bro/validators/syntax.py +++ b/fiasko_bro/validators/syntax.py @@ -1,8 +1,6 @@ import ast -from .. import ast_helpers -from .. import file_helpers -from .. import url_helpers +from ..utils import ast_helpers, file_helpers, url_helpers def has_no_syntax_errors(solution_repo, *args, **kwargs): diff --git a/tests/test_general_validators/test_are_tabs_used_for_indentation.py b/tests/test_general_validators/test_are_tabs_used_for_indentation.py index 74562b5..9957127 100644 --- a/tests/test_general_validators/test_are_tabs_used_for_indentation.py +++ b/tests/test_general_validators/test_are_tabs_used_for_indentation.py @@ -2,7 +2,7 @@ def test_are_tabs_used_for_indentation_fail_for_py_file(test_repo): - expected_output = 'tabs_used_for_indents', 'css_with_tabs.css' + expected_output = 'tabs_used_for_indents', 'js_with_tabs.js' output = validators.are_tabs_used_for_indentation( solution_repo=test_repo, )