Ejemplo n.º 1
0
class WhatIsGitView(ContentView):

    uid = 'what_is_git_1'
    template = 'xchk_git_content/what_is_git.html'
    title = 'Wat is Git?'
    _accepted_regex_text = r"""
    ^                                           # begin string
    \s*                                         # optional whitespace
    https://(www\.)?git\-scm\.com/book/nl(/v2)? # link
    \s*                                         # optional whitespace
    $                                           # end string
    """
    _incorrect_lang_regex_text = r"""
    ^                                      # begin string
    \s*                                    # optional whitespace
    https://(www\.)?git\-scm\.com/book/    # base link
    ([^n].+|n[^l].*|nl[^/].+)              # anything but 'nl'
    (/v2)?                                 # rest link
    \s*                                    # optional whitespace
    $
    """
    _incorrect_lang_regex = regex.compile(_incorrect_lang_regex_text,
                                          flags=regex.VERBOSE)
    _accepted_regex = regex.compile(_accepted_regex_text, flags=regex.VERBOSE)
    _accepting = RegexCheck(
        _accepted_regex,
        pattern_description='de link voor de Nederlandstalige documentatie')
    strat = Strategy(refusing_check=DisjunctiveCheck([
        Negation(FileExistsCheck()),
        RegexCheck(_incorrect_lang_regex,
                   pattern_description='een andere taal dan het Nederlands'),
        Negation(_accepting)
    ]),
                     accepting_check=TrueCheck())
Ejemplo n.º 2
0
class GitLogView(ContentView):

    uid = 'git_log_1'
    template = 'xchk_git_content/git_log.html'
    title = 'git log'
    long_title = 'Een overzicht van je geschiedenis: git log'
    _accepted_regex_text = r"""
    ^                     # begin string
    \s*                   # optionele whitespace
    [cC]ommit\ [hH]ash    # eerste antwoord
    \s*                   # optionele whitespace
    git\ commit           # tweede antwoord
    \s*                   # optionele whitespace
    [cC]ommit\ [mM]essage # eerste antwoord
    \s*                   # optionele whitespace
    $                     # einde string
    """
    _accepted_regex = regex.compile(_accepted_regex_text,
                                    flags=regex.VERBOSE | regex.DOTALL)
    _accepting = RegexCheck(
        _accepted_regex,
        pattern_description='het gevraagde overzicht van de wijzigingen')
    strat = Strategy(refusing_check=DisjunctiveCheck(
        [Negation(FileExistsCheck()),
         Negation(_accepting)]),
                     accepting_check=_accepting)
Ejemplo n.º 3
0
class GitIgnoreConceptView(ContentView):

    uid = 'gitignore_concept_1'
    template = 'xchk_git_content/gitignore_concept.html'
    title = '.gitignore'
    long_title = 'Bestanden uitsluiten van versiebeheer: .gitignore'
    _accepted_regex_text = r"""
    ^
    \s*
    cache/?
    \n
    \*\.pdf
    \n
    1C\.md
    \s*
    $
    """
    _accepted_regex = regex.compile(_accepted_regex_text, flags=regex.VERBOSE)
    _accepting = RegexCheck(
        _accepted_regex,
        pattern_description='de geschikte inhoud van .gitignore file')
    strat = Strategy(refusing_check=DisjunctiveCheck(
        [Negation(FileExistsCheck()),
         Negation(_accepting)]),
                     accepting_check=_accepting)
Ejemplo n.º 4
0
class KeyElementsView(ContentView):

    uid = 'xchk_xchk_content_key_elements'
    template = 'xchk_xchk_content/key_elements.html'
    title = 'Sleutelementen van xchk'
    pattern = regex.compile(r'^\s*(2|[tT][wW][eE][eE])\s*$')
    conditions = [FileExistsCheck(), RegexCheck(pattern)]
    strat = Strategy(refusing_check=Negation(ConjunctiveCheck(conditions)),
                     accepting_check=TrueCheck())
Ejemplo n.º 5
0
class InstructionsView(ContentView):

    uid = 'xchk_xchk_content_technical_requirements'
    template = 'xchk_xchk_content/technical_requirements.html'
    title = 'Technische vereisten'
    pattern = regex.compile(r'^.*[0-9].*$', flags=regex.DOTALL)
    chk = ConjunctiveCheck([
        FileExistsCheck(),
        Negation(
            RegexCheck(pattern,
                       pattern_description="tekst met minstens één cijfer in"))
    ])
    strat = Strategy(refusing_check=Negation(chk), accepting_check=TrueCheck())
Ejemplo n.º 6
0
class GitStageChangesView(ContentView):

    uid = 'git_stage_changes_1'
    template = 'xchk_git_content/git_stage_changes.html'
    title = 'Fase veranderen'
    long_title = 'Data van fase veranderen'
    _accepted_regex_text = r"""
    ^                                           # begin string
    \s*                                         # optionele whitespace
    de\ kat\ krabt\ de\ krollen\ van\ de\ trap! # verwachte inhoud
    \s*                                         # optionele whitespace
    $                                           # einde string
    """
    _accepted_regex = regex.compile(_accepted_regex_text, flags=regex.VERBOSE)
    _accepting = RegexCheck(_accepted_regex,
                            pattern_description='de gevraagde tekst')
    strat = Strategy(refusing_check=DisjunctiveCheck(
        [Negation(FileExistsCheck()),
         Negation(_accepting)]),
                     accepting_check=_accepting)
Ejemplo n.º 7
0
class GitStagesView(ContentView):

    uid = 'git_stages_1'
    template = 'xchk_git_content/git_stages.html'
    title = 'Fasen van data'
    _accepted_regex_text = r"""
    ^                   # begin string
    \s*                 # optionele whitespace
    [sS]taging\ [aA]rea # eerste antwoord, deels hoofdletterongevoelig
    \s*                 # optionele whitespace
    [nN]een?            # tweede antwoord, deels hoofdletterongevoelig
    \s*                 # optionele whitespace
    $                   # einde string
    """
    _accepted_regex = regex.compile(_accepted_regex_text, flags=regex.VERBOSE)
    _accepting = RegexCheck(_accepted_regex,
                            pattern_description='een modeloplossing')
    strat = Strategy(refusing_check=DisjunctiveCheck(
        [Negation(FileExistsCheck()),
         Negation(_accepting)]),
                     accepting_check=_accepting)
Ejemplo n.º 8
0
class GitPullBasicsView(ContentView):

    uid = 'git_pull_basics_1'
    template = 'xchk_git_content/git_pull.html'
    title = 'git pull'
    long_title = 'Wijzigingen op een remote opnemen in je eigen kopie: git pull'
    _accepted_regex_text = r"""
    ^                       # begin string
    \s*                     # optionele whitespace
    [Ff]ast[\ \-][Ff]orward # de essentie; schrijfwijze kan misschien verschillen in andere versies
    \s*                     # optionele whitespace
    $                       # einde string
    """
    _accepted_regex = regex.compile(_accepted_regex_text,
                                    flags=regex.VERBOSE | regex.DOTALL)
    _accepting = RegexCheck(
        _accepted_regex,
        pattern_description='de regel NA de regel die begint met "Updating"')
    strat = Strategy(refusing_check=DisjunctiveCheck(
        [Negation(FileExistsCheck()),
         Negation(_accepting)]),
                     accepting_check=_accepting)
Ejemplo n.º 9
0
class GitInitView(ContentView):

    uid = 'start_git_init_1'
    template = 'xchk_git_content/start_git_init.html'
    title = 'git init / git clone'
    long_title = 'Een repo maken van een gewone map: git init'
    _accepted_regex_text = r"""
    ^         # begin string
    \s*       # optionele whitespace
    [rR]epo   # letterlijk eerste antwoord
    \s*       # optionele whitespace
    git\ init # tweede antwoord
    \s*       # optionele whitespace
    \.git     # derde antwoord
    \s*       # optionele whitespace
    $         # einde string
    """
    _accepted_regex = regex.compile(_accepted_regex_text, flags=regex.VERBOSE)
    _accepting = RegexCheck(_accepted_regex,
                            pattern_description='een modeloplossing')
    strat = Strategy(refusing_check=DisjunctiveCheck(
        [Negation(FileExistsCheck()),
         Negation(_accepting)]),
                     accepting_check=_accepting)