Example #1
0
    def fixes_configuration_data(self):
        """
        Return True if the commit fixes configuration data.

        Returns
        -------
        bool
            True if the commit fixes configuration data. False, otherwise.

        """

        for sentence in self.sentences:
            sentence = ' '.join(sentence)
            sentence_dep = ' '.join(utils.get_head_dependents(sentence))

            if rules.has_defect_pattern(sentence) \
                    and (rules.has_storage_configuration_pattern(sentence_dep)
                         or rules.has_file_configuration_pattern(sentence_dep)
                         or rules.has_network_configuration_pattern(sentence_dep)
                         or rules.has_user_configuration_pattern(sentence_dep)
                         or rules.has_cache_configuration_pattern(sentence_dep)
                         or self.is_data_changed()):
                return True

        return False
Example #2
0
    def fixes_conditional(self):
        """
        Return True if the commit fixes a conditional.

        Returns
        -------
        bool
            True if the commit fixes a conditional. False, otherwise.

        """
        for sentence in self.sentences:
            sentence = ' '.join(sentence)
            sentence_dep = ' '.join(utils.get_head_dependents(sentence))
            if rules.has_defect_pattern(
                    sentence) and rules.has_conditional_pattern(sentence_dep):
                return True

        return False
Example #3
0
    def fixes_syntax(self):
        """
        Return True if the commit fixes a syntax issue.

        Returns
        -------
        bool
            True if the commit fixes syntnax. False, otherwise.

        """

        for sentence in self.sentences:
            sentence = ' '.join(sentence)
            sentence_dep = ' '.join(utils.get_head_dependents(sentence))
            if rules.has_defect_pattern(sentence) and rules.has_syntax_pattern(
                    sentence_dep):
                return True

        return False
Example #4
0
    def fixes_service(self):
        """
        Return True if the commit fixes a service issue.

        Returns
        -------
        bool
            True if the commit fixes a service. False, otherwise.

        """

        for sentence in self.sentences:
            sentence = ' '.join(sentence)
            sentence_dep = ' '.join(utils.get_head_dependents(sentence))
            if rules.has_defect_pattern(sentence) and (
                    rules.has_service_pattern(sentence_dep)
                    or self.is_service_changed()):
                return True

        return False
Example #5
0
    def fixes_documentation(self):
        """
        Return True if the commit fixes the documentation.

        Returns
        -------
        bool
            True if the commit fixes the documentation. False, otherwise.

        """

        for sentence in self.sentences:
            sentence = ' '.join(sentence)
            sentence_dep = ' '.join(utils.get_head_dependents(sentence))
            if rules.has_defect_pattern(sentence) and (
                    rules.has_documentation_pattern(sentence_dep)
                    or self.is_comment_changed()):
                return True

        return False
Example #6
0
    def fixes_dependency(self):
        """
        Return True if the commit fixes a dependency.
        For example, if an import or include is changed.

        Returns
        -------
        bool
            True if the commit fixes a dependency. False, otherwise.

        """

        for sentence in self.sentences:
            sentence = ' '.join(sentence)
            sentence_dep = ' '.join(utils.get_head_dependents(sentence))
            if rules.has_defect_pattern(sentence) and (
                    rules.has_dependency_pattern(sentence_dep)
                    or self.is_include_changed()):
                return True

        return False
 def test_has_defect_pattern_true():
     assert rules.has_defect_pattern('fix wrong package dependency for Debian/Ubuntu')
 def test_has_defect_pattern_false():
     assert not rules.has_defect_pattern('refactored code')