예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #7
0
 def test_get_dependents():
     sentence = 'fix wrong condit when check the statu of mysqladmin that caus the output to be both in the case ' \
                'of success and failur of mysqladmin ping command '
     assert utils.get_head_dependents(sentence) == [
         'fix', 'condit', 'statu', 'output'
     ]
예제 #8
0
 def test_get_dependents_empty():
     assert not utils.get_head_dependents('')