mangroveorg/datawinners

View on GitHub
func_tests/pages/projectsubjectspage/project_subjects_page.py

Summary

Maintainability
D
1 day
Test Coverage

ProjectSubjectsPage has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

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

    def click_edit_form_link_and_continue(self):
Severity: Minor
Found in func_tests/pages/projectsubjectspage/project_subjects_page.py - About 4 hrs to fix

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

        def is_edit_disabled(self):
            class_name = self.driver.find(by_xpath(".//a[contains(@class,'edit')]/..")).get_attribute("class")
            return class_name.find('disabled') > 0
    func_tests/pages/alldatasenderspage/all_data_senders_page.py on lines 209..211
    func_tests/pages/projectdatasenderspage/project_data_senders_page.py on lines 131..133
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 44..46
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 48..50

    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 44.

    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 5 locations. Consider refactoring.
    Open

        def is_delete_action_displayed(self):
            class_name = self.driver.find(by_xpath(".//a[contains(@lass,'delete')]/..")).get_attribute("class");
            return class_name.find('disabled') > 0
    func_tests/pages/alldatasenderspage/all_data_senders_page.py on lines 209..211
    func_tests/pages/projectdatasenderspage/project_data_senders_page.py on lines 131..133
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 40..42
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 44..46

    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 44.

    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 5 locations. Consider refactoring.
    Open

        def is_delete_disabled(self):
            class_name = self.driver.find(by_xpath(".//a[contains(@class,'delete')]/..")).get_attribute("class")
            return class_name.find('disabled') > 0
    func_tests/pages/alldatasenderspage/all_data_senders_page.py on lines 209..211
    func_tests/pages/projectdatasenderspage/project_data_senders_page.py on lines 131..133
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 40..42
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 48..50

    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 44.

    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 wait_for_subject_table_to_load(self):
            WebDriverWait(self.driver, 1).until(
                lambda driver: driver.find(by_xpath(".//*[@id='subjects_table']/tbody/tr[2]/td[1]/input")).is_displayed())
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 74..76

    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 42.

    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 wait_for_empty_table_to_load(self):
            WebDriverWait(self.driver, 1).until(
                lambda driver: driver.find(by_id('subjects_table')).is_displayed())
    func_tests/pages/projectsubjectspage/project_subjects_page.py on lines 70..72

    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 42.

    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 get_number_of_selected_subjects(self):
            return len([input_element for input_element in self.get_inputs_webelement() if
                        input_element.get_attribute("checked") == "true"])
    func_tests/pages/projectdatasenderspage/project_data_senders_page.py on lines 139..140

    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 39.

    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 select_subject_by_uid(self, uid):
            self.driver.find(by_css(SUBJECT_CB_LOCATOR % str(uid))).click()
    Severity: Minor
    Found in func_tests/pages/projectsubjectspage/project_subjects_page.py and 1 other location - About 50 mins to fix
    func_tests/pages/alluserspage/all_users_page.py on lines 42..43

    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 select_subject_by_row(self, row_number):
            self.driver.find(by_xpath(".//*[@id='subjects_table']/tbody/tr[%d]/td[1]/input" % row_number)).click()
    Severity: Minor
    Found in func_tests/pages/projectsubjectspage/project_subjects_page.py and 2 other locations - About 30 mins to fix
    func_tests/pages/alluserspage/all_users_page.py on lines 83..85
    func_tests/pages/projectdatasenderspage/project_data_senders_page.py on lines 178..179

    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

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

        def get_inputs_webelement(self):
            return self.driver.find(by_id("subjects_table_wrapper")).find_elements(by="css selector",
    Severity: Minor
    Found in func_tests/pages/projectsubjectspage/project_subjects_page.py and 1 other location - About 30 mins to fix
    func_tests/pages/projectdatasenderspage/project_data_senders_page.py on lines 145..146

    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