Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues #110 #111 #116

Merged
merged 3 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fiasko_bro/__init__.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion fiasko_bro/pre_validation_checks/encoding.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
12 changes: 12 additions & 0 deletions fiasko_bro/pre_validation_checks/files_len.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from ..utils import url_helpers


def has_no_long_files(solution_repo, max_number_of_lines, *args, **kwargs):
for file_path, file_content, _ in solution_repo.get_ast_trees(
with_filenames=True,
with_file_content=True
):
number_of_lines = file_content.count('\n')
if number_of_lines > max_number_of_lines:
file_name = url_helpers.get_filename_from_path(file_path)
return 'file_too_long', file_name
2 changes: 1 addition & 1 deletion fiasko_bro/pre_validation_checks/repo_size.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion fiasko_bro/repository_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import git

from fiasko_bro.config import VALIDATOR_SETTINGS
from . import file_helpers
from .utils import file_helpers


class LocalRepositoryInfo:
Expand Down
8 changes: 8 additions & 0 deletions fiasko_bro/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -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 *
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions fiasko_bro/validators/code_inclusion.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
3 changes: 1 addition & 2 deletions fiasko_bro/validators/comments.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion fiasko_bro/validators/files.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
3 changes: 1 addition & 2 deletions fiasko_bro/validators/imports.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion fiasko_bro/validators/naming.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import builtins

from .. import ast_helpers
from ..utils import ast_helpers
from ..i18n import _


Expand Down
3 changes: 1 addition & 2 deletions fiasko_bro/validators/other_languages.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
4 changes: 1 addition & 3 deletions fiasko_bro/validators/pythonic.py
Original file line number Diff line number Diff line change
@@ -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 _


Expand Down
2 changes: 1 addition & 1 deletion fiasko_bro/validators/requirements.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .. import list_helpers
from ..utils import list_helpers
from ..i18n import _


Expand Down
4 changes: 1 addition & 3 deletions fiasko_bro/validators/syntax.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down