def built_is_refactor(commit_text):
    removal_re = build_separated_terms(removal)

    return (match(commit_text, build_refactor_regex())
            + match(commit_text, removal_re)
            + match(commit_text, build_refactor_goals_regex())
            - match(commit_text, build_non_code_perfective_regex())
            - match(commit_text
                    , build_documentation_entities_context(build_refactor_regex(use_conventional_commits=False)))
            - match(commit_text
                    , build_non_positive_linguistic(build_refactor_regex(use_conventional_commits=False)))
            - match(commit_text, build_non_positive_linguistic(build_separated_terms(removal)))
            - match(commit_text, build_non_positive_linguistic(build_refactor_goals_regex()))
            ) > 0
def build_documentation_entities_context(positive_re):

    return '(?:%s)' % "|".join([
        # TODO - take care of documentation entities spereatly
         '(?:%s)[\s\S]{0,10}(?:%s)' % (build_separated_terms(documentation_entities, just_before=True)
                                        ,positive_re)
    ])
def build_refactor_goals_regex():
    goals_regerx = "(?:(?:%s)(?:%s|%s[\s\S]{0,50}%s)(?:%s)%s)" % (build_separated_terms(software_goals_modification
                                                                                       , just_before=True)
                                                                  , term_seperator
                                                                  , term_seperator
                                                                  , term_seperator
                                                                  , "|".join(software_goals)
                                                                  , term_seperator)
    return goals_regerx
def build_non_code_perfective_regex():

    non_perfective_entities = ['warning(?:s)?'
                               , 'format(?:ing)?'
                               , 'indentation(?:s)?'
                              ]
    # TODO - applied to perfective entities too here, which is a bug.
    modification_action = ['clean(?:-| )?up(?:s)?']
    non_perfective_context = [
                            'fix(?:es|ed|ing)?'
                            ,'(?:get|got|getting) rid'
                            , 'support(?:s|ed|ing)?'
                            ]
    modifiers = modification_activity + non_perfective_context
    activity_regerx = "((?:%s)(?:\s|%s[\s\S]{0,50}%s)(?:%s))" % (build_separated_terms(modifiers, just_before=True)
                                                                                , term_seperator
                                                                                , term_seperator
                                                                                , "|".join(prefective_entities
                                                                                           + non_perfective_entities))
    doc_header_regex =  '(?:^|^[\s\S]{0,25}%s)(?:%s)[\s\S]{0,25}(?:%s)' % (term_seperator
                                                       , "|".join(perfective_header_action)
                                                       , build_separated_terms(documentation_entities))


    no_prefective_action = "|".join([
        'convert(?:ed|s|ing)?(?:%s|%s[\s\S]{0,50}%s)support(?:s|ed|ing)?' % (
            term_seperator,term_seperator, term_seperator)
        , '(?:make|made|making|makes)(?:%s|%s[\s\S]{0,50}%s)work' % (term_seperator, term_seperator, term_seperator)
        , '(?:make|made|making|makes)(?:%s|%s[\s\S]{0,50}%s)sense' % (term_seperator, term_seperator, term_seperator)
        , 'improv(?:e|es|ed|ing) handling'
        , 'need(?:s|ing)?\srefactor(?:ing)?'
        , '(?:%s)(?:%s|%s[\s\S]{0,50}%s)(?:%s)' %(build_separated_terms(non_perfective_entities,just_before=True)
                                                   ,term_seperator
                                                   , term_seperator
                                                   , term_seperator
                                                   , "|".join(modification_action)
                                                   )
        , doc_header_regex

    ])
    non_perfective_context = '(?:%s|%s)' % (no_prefective_action
                                         , activity_regerx)

    return non_perfective_context
def positive_refactor_to_bq():
    print( "# Refactor :build_refactor_regex()")
    #print( ",")
    print( regex_to_big_query(build_refactor_regex()))
    print( "# Refactor :build_separated_terms(removal)")
    print( "+")
    print( regex_to_big_query(build_separated_terms(removal)))

    print( "# Refactor :build_refactor_goals_regex()")
    print( "+")
    print( regex_to_big_query(build_refactor_goals_regex()))
def build_refactor_regex(use_conventional_commits=True):
    header_regex =  '(?:^|^[\s\S]{0,25}%s)(?:%s)%s' % (term_seperator
                                                       , "|".join(perfective_header_action)
                                                       , term_seperator)

    activity_regerx = "(?:(?:%s)(?:%s|%s[\s\S]{0,50}%s)(?:%s)%s)" % (build_separated_terms(modification_activity
                                                                                          , just_before=True)
                                                                     , term_seperator
                                                                     , term_seperator
                                                                     , term_seperator
                                                                     , "|".join(refactor_entities)
                                                                     , term_seperator)
    if use_conventional_commits:
        agg_re = "(%s)|(%s)|(%s)|(%s)" % (build_separated_terms(refactor_context)
                          , activity_regerx
                          , header_regex
                          , build_cc_refactor_regex())
    else:
        agg_re = "(%s)|(%s)|(%s)" % (build_separated_terms(refactor_context)
                          , activity_regerx
                          , header_regex)
    return agg_re
Exemple #7
0
def build_bug_fix_regex(use_conventional_commits=True):
    header_regex = '(?:^|^[\s\S]{0,25}%s)(?:%s)%s' % (
        term_seperator, "|".join(corrective_header_entities), term_seperator)
    # strict_header = "^(?:%s)%s"  % ( "|".join([ "do not" ,"don't"])
    #                                                    , term_seperator)

    bug_fix_re = build_separated_terms(bug_terms)

    if use_conventional_commits:
        agg_re = "((%s)|(%s)|(%s))" % (bug_fix_re, header_regex,
                                       build_cc_corrective_regex())
    else:
        agg_re = "((%s)|(%s))" % (bug_fix_re, header_regex)

    return agg_re
Exemple #8
0
def build_valid_find_regex():
    fix_re = "(" + "|".join(fixing_verbs + [MERGE_PREFIX]) + ")"
    prefix = term_seperator + fix_re + '[\s\S]{1,40}' + "(" + "|".join(
        valid_fix_object) + ")" + term_seperator

    suffix = term_seperator + "(" + "|".join \
        (valid_fix_object) + ")" + term_seperator + '[\s\S]{0,40}'  + fix_re + term_seperator

    # TODO - check seperation
    #sepertion = '(?:%s|%s[\s\S]{0,40}%s)' % (term_seperator, term_seperator, term_seperator)
    #suffix = "(" + "|".join \
    #    (valid_fix_object) + ")" + sepertion + fix_re + term_seperator

    #other_valid_re = "(%s)" % "|".join(valid_terms)
    other_valid_re = build_separated_terms(valid_terms)
    return "((%s)|(%s)|(%s))" % (prefix, suffix, other_valid_re)
Exemple #9
0
    'break\sout',
    'error(?: |-)?check(ing)?',
    'error(?: |-)?handling',
    'error message(?:s)?',
    'error metric(?:s)?',
    'error report(s|ing)?',
    'fixed(?: |-)?point',
    'fix(?:ed) ticket(?:s)?',
    #'format(ing)?',
    '(?:fix(?:ed|es)?|bug)(?: )?(?: |-|=|:)(?: )?[a-z]{0,3}(?:-)?\d+' +
    term_seperator,
    '(?:fix(?:ed|es)?|bug)(?:-|=|:)\d+',
    '(if|would)[\s\S]{0,40}go wrong',
    'line(?:s)? break(?:s)?',
    'typo(s)?\sfix(es)?',
    'fix(ed|es|ing)?' + build_separated_terms(software_entities) + 'name(s)?',
    build_separated_terms(static_analyzers) + 'fix(es|ed)?',
    'fix(es|ed)?' + build_separated_terms(static_analyzers),
    '^### Bug Fix',  # tends to be a title, later stating if the commit is a bug fix
    'edit the jira link to the correct issue',  # Another occurring title
    'page(?:s)? break(?:s)?',
    'fix changes merge',
    '(understand|understood)\scorrectly',
    'on error',
] + code_review_fixes

fixing_verbs = [
    'correct(?:ing|s|ed)', 'fix(ed|s|es|ing)?', 'repair(?:ing|s|ed)?',
    'revert(?:ing|s|ed)?', 'resolv(?:ing|e|es|ed)', 'revok(?:ing|e|es|ed)',
    'und(?:oing|id)'
]
Exemple #10
0
  -     HeaderGenerator: Logic for generating the header file
  -     SourceGenerator: Logic for generating the source file
  -     KcfgParser: Logic for parsing the kcfg file and extracting the information from the Xml file
  -     CommonStructs: a header that contains the structs that are currently used everywhere.
  -     KConfigParameters: (was CfgConfig - ConfigConfig, wat) - Has information passed via the kcfgc file
  -     kcfg_compiler - will be renamed to main - start the other classes and generates the files.

This code here currently has the begining of this separation, with the CodeGenerator and the HeaderGenerator in a ~good~ state, but unfinished.

Test Plan:
- Run the test cases,
- Compare the diffs generated by the testcases and fix in the code the errors / differences
- Run and compare real kde source with the new and old generators to look for errors

Reviewers: #frameworks, ervin, bport, dfaure

Reviewed By: dfaure

Subscribers: bport, ngraham, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D26202
"

""".lower()
    print("is typo", is_typo(text))
    print("typo in text", re.findall(build_positive_regex(), text))

print(build_separated_terms(positive_terms))
def build_perfective_regex():
    non_code = build_separated_terms (prefective_entities)

    perfective = "(%s)" %  non_code

    return perfective
Exemple #12
0
def build_core_abstraction_regex():

    return build_separated_terms(core_abstraction_terms)
feedback_action = ['fix(?:ed|s|es|ing)?', 'fix(?:-| )?up(?:s)?', 'resolv(?:e|ed|es|ing)', 'correct(?:ed|s|es|ing)?']

perfective_header_action = [
    #'polish(?:ed|es|ing)?'
    #, 'clean(?:ing|s|ed)?(?:-| )?up(?:s)?'
     'clean(?:ing|s|ed)?(?:-| )?up(?:s)?'
    , 'cleaner'
    , 'deprecat(?:e|es|ed|ing)'
    , 'extract(?:ed|s|ing)?',
    're(?:-|)?organiz(?:e|es|ed|ing)', 're(?:-|)?structur(?:e|es|ed|ing)', 'tid(?:y|ying|ied) up'
    , 'improv(?:e|ed|es|ing|ement|ements)' , 're(?:-|)?organiz(?:e|es|ed|ing)', 're(?:-|)?structur(?:e|es|ed|ing)'
    , '(helper|utility|auxiliary) function(?:s)?'
    , '(?:move|moved|moves|moving) to'
    , 'separat(?:e|es|ed|ing)'
    , 'split(?:s|ing)?', '->'
    , build_separated_terms(static_analyzers) + 'fix(es|ed)?'
    , 'fix(es|ed)?' + build_separated_terms(static_analyzers)

    #, '(private|public|protected|static)'
]

# TODO - rewrited, move into/out???, deduplicate, remove legacy, redo, PR, feedback

# TODO - clean , style, prettier, "->", refine, "Removed commented code", "More startup improvements.", recode
# ""Remove another old function", "improved redis error message", utility functions, never used
# Checkstyle


# TODO - perfective, not refactor - ident, spacing, tabs, "tabs -> spaces", cosmetic, ""*** empty log message ***"
# examples ""DOC: remove mention of TimeSeries in docs"
def build_excluded_regex():
    #return "(%s)" % ("|".join(excluded_terms))
    return build_separated_terms(excluded_terms)
def build_positive_regex():

    return build_separated_terms(positive_terms)
Exemple #16
0
def build_excluded_abstraction_regex():

    return build_separated_terms(excluded_abstraction_terms)
Exemple #17
0
def build_positive_sentiment_regex():

    return build_separated_terms(positive_sentiment)
def build_core_refactor_regex():

    return '(%s)' % build_separated_terms(core_refactor_terms)
Exemple #19
0
def build_negeted_bug_fix_regex():
    bug_fix_re = build_bug_fix_regex(use_conventional_commits=False)
    negation_re = build_separated_terms(negation_terms)

    return "%s[\s\S]{0,20}%s" % (negation_re, bug_fix_re)
def non_positive_linguistic_removal_to_bq():
    print("# Refactor :build_non_positive_linguistic(build_separated_terms(removal))")
    print(regex_to_big_query(build_non_positive_linguistic(build_separated_terms(removal))))
Exemple #21
0
def build_core_bug_regex():

    return '(%s)' % build_separated_terms(core_bug_terms)
Exemple #22
0
def build_negative_sentiment_excluded_regex():

    return build_separated_terms(excluded_negative_sentiment)
def build_excluded_regex():

    return build_separated_terms(excluded_terms)
def build_positive_regex():

    #return "(%s)" % ("|".join(positive_terms))

    return build_separated_terms(positive_terms)