mangroveorg/datawinners

View on GitHub
func_tests/pages/submissionlogpage/submission_log_page.py

Summary

Maintainability
F
3 days
Test Coverage

SubmissionLogPage has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

class SubmissionLogPage(Page):
    def __init__(self, driver):
        Page.__init__(self, driver)
        self.date_range_dict = {CURRENT_MONTH: CURRENT_MONTH_LABEL,
                        LAST_MONTH: LAST_MONTH_LABEL,
Severity: Minor
Found in func_tests/pages/submissionlogpage/submission_log_page.py - About 5 hrs to fix

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

        def filter_by_submission_date(self, type):
            self.driver.find(by_css('#submissionDatePicker')).click()
            self.driver.wait_for_element(UI_TEST_TIMEOUT, self.date_range_dict.get(type), want_visible=True).click()
            if type == DAILY_DATE_RANGE:
                button = self.driver.wait_for_element(UI_TEST_TIMEOUT, BTN_DONE_, want_visible=True)
    Severity: Major
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 1 other location - About 6 hrs to fix
    func_tests/pages/submissionlogpage/submission_log_page.py on lines 182..188

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

    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 filter_by_reporting_date(self, type):
            self.driver.find(by_css('#reportingPeriodPicker')).click()
            self.driver.wait_for_element(UI_TEST_TIMEOUT, self.date_range_dict.get(type), want_visible=True).click()
            if type == DAILY_DATE_RANGE:
                button = self.driver.wait_for_element(UI_TEST_TIMEOUT, BTN_DONE_, want_visible=True)
    Severity: Major
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 1 other location - About 6 hrs to fix
    func_tests/pages/submissionlogpage/submission_log_page.py on lines 198..204

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

    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

            try:
                (self.driver.find(by_xpath(DS_AND_SUBJECT_FILTER_LOCATOR_BY_NAME %datasender))).click()
            except CouldNotLocateElementException:
                (self.driver.find(by_xpath(DS_AND_SUBJECT_FILTER_LOCATOR_BY_ID %datasender))).click()
    Severity: Major
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 1 other location - About 2 hrs to fix
    func_tests/pages/submissionlogpage/submission_log_page.py on lines 164..167

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

    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

            try:
                (self.driver.find(by_xpath(DS_AND_SUBJECT_FILTER_LOCATOR_BY_NAME %subject))).click()
            except CouldNotLocateElementException:
                (self.driver.find(by_xpath(DS_AND_SUBJECT_FILTER_LOCATOR_BY_ID %subject))).click()
    Severity: Major
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 1 other location - About 2 hrs to fix
    func_tests/pages/submissionlogpage/submission_log_page.py on lines 155..158

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

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

        def get_cell_value_anchor(self, row, column):
            return self.driver.find(by_xpath(".//*[@class='submission_table']/tbody/tr[%s]/td[%s]/a" % ((row +1), column))).text
    Severity: Major
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 3 other locations - About 1 hr to fix
    func_tests/pages/alldatasenderspage/all_data_senders_page.py on lines 269..271
    func_tests/pages/allsubjectspage/all_subject_type_page.py on lines 138..140
    func_tests/pages/submissionlogpage/submission_log_page.py on lines 169..171

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

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

        def get_cell_value(self, row, column):
            #row+1 for ignoring extra row for select all msg
            return self.driver.find(by_xpath(".//*[@class='submission_table']/tbody/tr[%s]/td[%s]" % ((row +1), column))).text
    Severity: Major
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 3 other locations - About 1 hr to fix
    func_tests/pages/alldatasenderspage/all_data_senders_page.py on lines 269..271
    func_tests/pages/allsubjectspage/all_subject_type_page.py on lines 138..140
    func_tests/pages/submissionlogpage/submission_log_page.py on lines 95..96

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

    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 search(self, search_text):
            self.driver.find_text_box(by_css("#search_text")).enter_text(search_text)
            self.wait_for_table_data_to_load()
    Severity: Minor
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 1 other location - About 45 mins to fix
    func_tests/pages/allsubjectspage/all_subject_type_page.py on lines 134..136

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

    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

            for col in range(2, header_count + 1):
                row_data.append(self.get_cell_value(row, col))
    Severity: Minor
    Found in func_tests/pages/submissionlogpage/submission_log_page.py and 2 other locations - About 35 mins to fix
    func_tests/pages/dataanalysispage/data_analysis_page.py on lines 18..19
    func_tests/pages/questionnairetabpage/poll_questionnaire_page.py on lines 265..266

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

    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