mangroveorg/datawinners

View on GitHub
func_tests/pages/alluserspage/all_users_page.py

Summary

Maintainability
C
1 day
Test Coverage

AllUsersPage has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class AllUsersPage(Page):
    def __init__(self, driver):
        Page.__init__(self, driver)

    def click_check_all_users(self, check=True):
Severity: Minor
Found in func_tests/pages/alluserspage/all_users_page.py - About 2 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            if (checkbox.get_attribute("checked") != "true" and check) or \
                    (checkbox.get_attribute("checked") == "true" and not check):
                checkbox.click()
    Severity: Major
    Found in func_tests/pages/alluserspage/all_users_page.py and 1 other location - About 2 hrs to fix
    func_tests/pages/addsubjecttypepage/add_subject_type_page.py on lines 82..84

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def select_delete_action(self, confirm=False, cancel=False):
            action_to_be_performed = DELETE
            self.perform_user_action(action_to_be_performed)
            if confirm:
                self.confirm_delete()
    Severity: Major
    Found in func_tests/pages/alluserspage/all_users_page.py and 1 other location - About 1 hr to fix
    func_tests/pages/addsubjecttypepage/add_subject_type_page.py on lines 107..113

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def perform_user_action(self, action_to_be_performed):
            self.click_action_button()
            option = self.driver.find_visible_element(by_id(action_to_be_performed))
            option.click()
    Severity: Major
    Found in func_tests/pages/alluserspage/all_users_page.py and 1 other location - About 1 hr to fix
    func_tests/pages/addsubjecttypepage/add_subject_type_page.py on lines 121..124

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 38.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def check_nth_user(self, number):
            self.driver.find(by_css(CHECK_NTH_USER_LOCATOR % str(number))).click()
    Severity: Minor
    Found in func_tests/pages/alluserspage/all_users_page.py and 1 other location - About 50 mins to fix
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 64..65

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 36.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def get_error_message(self):
            if self.driver.is_element_present(ERROR_CONTAINER):
                return self.driver.find(ERROR_CONTAINER).text
            return False
    Severity: Major
    Found in func_tests/pages/alluserspage/all_users_page.py and 2 other locations - About 40 mins to fix
    func_tests/pages/addsubjecttypepage/add_subject_type_page.py on lines 94..97
    func_tests/pages/alluserspage/all_users_page.py on lines 56..59

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def get_message(self):
            if self.driver.is_element_present(MESSAGES_CONTAINER):
                return self.driver.find(MESSAGES_CONTAINER).text
            return False
    Severity: Major
    Found in func_tests/pages/alluserspage/all_users_page.py and 2 other locations - About 40 mins to fix
    func_tests/pages/addsubjecttypepage/add_subject_type_page.py on lines 94..97
    func_tests/pages/alluserspage/all_users_page.py on lines 45..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def select_user_with_username(self, username):
            self.driver.find(
                by_xpath("//*[@id='users_list']//tr/td[contains(text(), '%s')]/../td[1]/input" % username)).click()
    Severity: Minor
    Found in func_tests/pages/alluserspage/all_users_page.py and 2 other locations - About 30 mins to fix
    func_tests/pages/projectdatasenderspage/project_data_senders_page.py on lines 178..179
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 67..68

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status