Ejemplo n.º 1
0
def test_more_than_one_element_with_the_same_key_only_first_one_will_be_considered(tmp_path, datadir):
    """Test more than one element with the same key: only the first one will be considered.

    E.g.: two steps with the same name.
    """
    filename = ".github/workflows/something.yaml"
    ProjectMock(tmp_path).save_file(filename, datadir / "same-key-actual.yaml").style(
        datadir / "same-key-desired.toml"
    ).api_check_then_fix(
        Fuss(
            True,
            filename,
            368,
            " has missing values:",
            """
            jobs:
              whatever:
                steps:
                  - name: Same key
                    uses: actions/replacing-duplicated-element@v2
            """,
        )
    ).assert_file_contents(
        filename, datadir / "same-key-expected.yaml"
    ).api_check().assert_violations()
Ejemplo n.º 2
0
def test_invalid_configuration_comma_separated_values(tmp_path):
    """Test an invalid configuration for comma_separated_values."""
    ProjectMock(tmp_path).style(f"""
        ["{SETUP_CFG}".flake8]
        max-line-length = 85
        max-complexity = 12
        ignore = "D100,D101,D102,D103,D104,D105,D106,D107,D202,E203,W503"
        select = "E241,C,E,F,W,B,B9"

        [nitpick.files."{SETUP_CFG}"]
        comma_separated_values = ["flake8.ignore", "flake8.exclude"]
        """).api_check().assert_violations(
        Fuss(
            False,
            SETUP_CFG,
            321,
            " was not found. Create it with this content:",
            """
            [flake8]
            max-line-length = 85
            max-complexity = 12
            ignore = D100,D101,D102,D103,D104,D105,D106,D107,D202,E203,W503
            select = E241,C,E,F,W,B,B9
            """,
        ))
Ejemplo n.º 3
0
def test_minimum_version(mocked_version, offline, request):
    """Stamp a style file with a minimum required version, to indicate new features or breaking changes."""
    assert_conditions(mocked_version == "0.5.3")
    ProjectMock(request).named_style(
        "parent",
        """
        [nitpick.styles]
        include = "child.toml"
        ["pyproject.toml".tool.black]
        line-length = 100
        """,
    ).named_style(
        "child",
        """
        [nitpick]
        minimum_version = "1.0"
        """,
    ).pyproject_toml("""
        [tool.nitpick]
        style = "parent"
        [tool.black]
        line-length = 100
        """).flake8(offline=offline).assert_single_error(
        "NIP203 The style file you're using requires nitpick>=1.0 (you have 0.5.3). Please upgrade"
    )
Ejemplo n.º 4
0
def test_include_remote_style_from_local_style(tmp_path):
    """Test include of remote style when there is only a local style."""
    remote_style = "https://raw.githubusercontent.com/user/repo/branch/path/to/nitpick-style"
    url_with_extension = f"{remote_style}{TOML_EXTENSION}"
    body = """
        ["tox.ini".section]
        key = "value"
    """
    responses.add(responses.GET, url_with_extension, dedent(body), status=200)

    project = ProjectMock(tmp_path).style(f"""
        [nitpick.styles]
        include = [
            "{remote_style}"
        ]
        """)
    project.assert_file_contents(TOX_INI, None).api_check_then_fix(
        Fuss(True, TOX_INI, 321,
             " was not found. Create it with this content:",
             "[section]\nkey = value")).assert_file_contents(
                 TOX_INI,
                 """
        [section]
        key = value
        """,
                 PYPROJECT_TOML,
                 None,
             )
Ejemplo n.º 5
0
def test_suggest_initial_contents(request):
    """Suggest initial contents for missing pre-commit config file."""
    ProjectMock(request).load_styles("isort", "black").pyproject_toml("""
        [tool.nitpick]
        style = ["isort", "black"]
        """).flake8().assert_errors_contain("""
        NIP331 File .pre-commit-config.yaml was not found. Create it with this content:\x1b[32m
        repos:
          - repo: https://github.com/asottile/seed-isort-config
            rev: v1.9.3
            hooks:
              - id: seed-isort-config
          - repo: https://github.com/pre-commit/mirrors-isort
            rev: v4.3.21
            hooks:
              - id: isort
          - repo: https://github.com/python/black
            rev: 19.10b0
            hooks:
              - id: black
                args: [--safe, --quiet]
          - repo: https://github.com/asottile/blacken-docs
            rev: v1.3.0
            hooks:
              - id: blacken-docs
                additional_dependencies: [black==19.10b0]\x1b[0m
        """)
Ejemplo n.º 6
0
def test_different_missing_keys(request):
    """Test different and missing keys."""
    ProjectMock(request).setup_cfg(
        """
        [mypy]
        ignore_missing_imports = true
        [isort]
        line_length = 30
        [flake8]
        xxx = "aaa"
        """
    ).style(
        """
        ["setup.cfg".mypy]
        ignore_missing_imports = true

        ["setup.cfg".isort]
        line_length = 110

        ["setup.cfg".flake8]
        max-line-length = 112
        """
    ).lint().assert_errors_contain(
        """
        NIP323 File setup.cfg: [isort]line_length is 30 but it should be like this:\x1b[92m
        [isort]
        line_length = 110\x1b[0m
        """
    ).assert_errors_contain(
        """
        NIP324 File setup.cfg: section [flake8] has some missing key/value pairs. Use this:\x1b[92m
        [flake8]
        max-line-length = 112\x1b[0m
        """
    )
Ejemplo n.º 7
0
def test_missing_sections(request):
    """Test missing sections."""
    ProjectMock(request).setup_cfg(
        """
        [mypy]
        ignore_missing_imports = true
        """
    ).style(
        """
        ["setup.cfg".mypy]
        ignore_missing_imports = true

        ["setup.cfg".isort]
        line_length = 120

        ["setup.cfg".flake8]
        max-line-length = 120
        """
    ).lint().assert_single_error(
        """
        NIP321 File setup.cfg has some missing sections. Use this:\x1b[92m
        [flake8]
        max-line-length = 120

        [isort]
        line_length = 120\x1b[0m
        """
    )
Ejemplo n.º 8
0
def test_repo_should_be_added_not_replaced(tmp_path, datadir):
    """Test a pre-commit repo being added to the list and not replacing an existing repo in the same position."""
    ProjectMock(tmp_path).save_file(
        PRE_COMMIT_CONFIG_YAML, datadir / "uk-actual.yaml").style(
            datadir / "uk-default.toml").api_check_then_fix(
                Fuss(
                    True,
                    PRE_COMMIT_CONFIG_YAML,
                    YamlPlugin.violation_base_code +
                    SharedViolations.MISSING_VALUES.code,
                    " has missing values:",
                    """
            repos:
              - repo: https://github.com/myint/autoflake
                hooks:
                  - id: autoflake
                    args:
                      - --in-place
                      - --remove-all-unused-imports
                      - --remove-unused-variables
                      - --remove-duplicate-keys
                      - --ignore-init-module-imports
            """,
                ), ).assert_file_contents(PRE_COMMIT_CONFIG_YAML,
                                          datadir / "uk-default-expected.yaml"
                                          ).api_check().assert_violations()
Ejemplo n.º 9
0
def project_remote(request, tmp_path):
    """Project with a remote style (loaded from a URL)."""
    from tests.helpers import ProjectMock, tomlstring

    remote_url = "https://example.com/remote-style.toml"
    remote_style = """
        ["pyproject.toml".tool.black]
        line-length = 100
    """
    # https://docs.pytest.org/en/stable/fixture.html#using-markers-to-pass-data-to-fixtures
    marker = request.node.get_closest_marker("tool_nitpick")
    tool_nitpick = marker.args[0] if marker else ""

    with RequestsMock() as mocked_response:
        mocked_response.add(mocked_response.GET,
                            remote_url,
                            dedent(remote_style),
                            status=200)

        project = ProjectMock(tmp_path)
        project.pyproject_toml(f"""
            [tool.nitpick]
            style = {tomlstring(remote_url)}
            {tool_nitpick}

            [tool.black]
            line-length = 100
            """).remote(mocked_response, remote_url)
        yield project
Ejemplo n.º 10
0
def test_repo_with_different_key_value_pairs(tmp_path, datadir):
    """Test a nested dict with different key/value pairs, e.g.: different args or dependencies."""
    ProjectMock(tmp_path).save_file(
        PRE_COMMIT_CONFIG_YAML, datadir / "hook-args.yaml").style(
            datadir / "hook-args-change.toml").api_check_then_fix(
                Fuss(
                    True,
                    PRE_COMMIT_CONFIG_YAML,
                    368,
                    " has missing values:",
                    """
            repos:
              - repo: https://github.com/psf/black
                hooks:
                  - id: black
                    args:
                      - --safe
                      - --custom
                      - --loud
              - repo: https://github.com/asottile/blacken-docs
                hooks:
                  - id: blacken-docs
                    additional_dependencies:
                      - black==22.1
            """,
                )).assert_file_contents(
                    PRE_COMMIT_CONFIG_YAML, datadir /
                    "hook-args-change.yaml").api_check().assert_violations()
Ejemplo n.º 11
0
def test_overriding_list_key_with_empty_string_restores_default_behaviour(
        tmp_path, datadir):
    """Test overriding the default list key with nothing.

    The default behaviour will be restored, and the new element will be appended at the end of the list.
    """
    ProjectMock(tmp_path).save_file(
        PRE_COMMIT_CONFIG_YAML, datadir / "uk-actual.yaml").style(
            datadir / "uk-empty.toml").api_check_then_fix(
                Fuss(
                    True,
                    PRE_COMMIT_CONFIG_YAML,
                    368,
                    " has missing values:",
                    """
            repos:
              - repo: https://github.com/myint/autoflake
                hooks:
                  - id: autoflake
                    args:
                      - --in-place
                      - --remove-all-unused-imports
                      - --remove-unused-variables
                      - --remove-duplicate-keys
                      - --ignore-init-module-imports
            """,
                ), ).assert_file_contents(
                    PRE_COMMIT_CONFIG_YAML, datadir /
                    "uk-empty-expected.yaml").api_check().assert_violations()
Ejemplo n.º 12
0
def test_wildcard_expression_matches_multiple_keys(tmp_path, datadir):
    """Test wildcard expressions that match multiple keys. E.g.: any "jobs.*.steps"."""
    filename = ".github/workflows/anything.yaml"
    ProjectMock(tmp_path).save_file(filename, datadir / "wildcard-actual.yaml").style(
        datadir / "wildcard-desired.toml"
    ).api_check_then_fix(
        Fuss(
            True,
            filename,
            368,
            " has missing values:",
            """
            jobs:
              build:
                steps:
                  - name: Checkout
                    uses: actions/checkout@v2
              test:
                steps:
                  - name: Checkout
                    uses: actions/checkout@v2
              release:
                steps:
                  - name: Checkout
                    uses: actions/checkout@v2
            """,
        ),
    ).assert_file_contents(
        filename, datadir / "wildcard-expected.yaml"
    ).api_check().assert_violations()
Ejemplo n.º 13
0
def test_list_of_dicts_search_missing_element_by_key_and_change_add_element_individually(tmp_path, datadir):
    """Test list of dicts: search missing element by key and change/add element individually.

    In GitHub Workflows: steps are searched by name and they should exist.
    """
    filename = ".github/workflows/any-language.yaml"
    ProjectMock(tmp_path).save_file(filename, datadir / "dict-search-by-key-actual.yaml").style(
        datadir / "dict-search-by-key-desired.toml"
    ).api_check_then_fix(
        Fuss(
            True,
            filename,
            368,
            " has missing values:",
            """
            jobs:
              build:
                steps:
                  - name: Checkout
                    uses: actions/checkout@v2
                  - name: Set up Python ${{ matrix.python-version }}
                    uses: actions/setup-python@v2
                    with:
                      python-version: ${{ matrix.python-version }}
                  - name: Install tox
                    run: python -m pip install tox
            """,
        ),
    ).assert_file_contents(
        filename, datadir / "dict-search-by-key-expected.yaml"
    ).api_check().assert_violations()
Ejemplo n.º 14
0
def test_list_of_scalars_only_add_elements_that_do_not_exist(tmp_path, datadir):
    """Test list of scalars: only add elements that do not exist.

    Only check if the element is present but don't enforce the whole list to be the same.
    """
    filename = ".github/workflows/python.yaml"
    ProjectMock(tmp_path).save_file(filename, datadir / "scalar-add-elements-that-do-not-exist-actual.yaml").style(
        datadir / "scalar-add-elements-that-do-not-exist-desired.toml"
    ).api_check_then_fix(
        Fuss(
            True,
            filename,
            368,
            " has missing values:",
            """
            jobs:
              build:
                strategy:
                  matrix:
                    os:
                      - ubuntu-latest
                    python-version:
                      - '3.7'
                      - '3.10'
                      - '3.11'
            """,
        ),
    ).assert_file_contents(
        filename, datadir / "scalar-add-elements-that-do-not-exist-expected.yaml"
    ).api_check().assert_violations()
Ejemplo n.º 15
0
def test_suggest_initial_contents(tmp_path, datadir):
    """Suggest initial contents for missing pre-commit config file."""
    warnings.simplefilter("ignore")  # "repos.yaml" key
    ProjectMock(tmp_path).named_style(
        "isort", datadir / "1-isort.toml").named_style(
            "black", datadir / "1-black.toml").pyproject_toml("""
        [tool.nitpick]
        style = ["isort", "black"]
        """).api_check_then_fix(
                Fuss(
                    True,
                    PRE_COMMIT_CONFIG_YAML,
                    361,
                    " was not found. Create it with this content:",
                    """
            repos: []
            """,
                ),
                partial_names=[PRE_COMMIT_CONFIG_YAML],
            ).assert_file_contents(
                PRE_COMMIT_CONFIG_YAML,
                """
        repos: []
        """,
            )
Ejemplo n.º 16
0
def test_when_no_config_file_the_default_style_is_requested(tmp_path, caplog):
    """There is a root dir (setup.py), but no config file."""
    project = ProjectMock(tmp_path, pyproject_toml=False,
                          setup_py=True).api_check(offline=True)
    assert project.nitpick_instance.project.read_configuration(
    ) == Configuration(None, [], "")
    assert "Config file: none found" in caplog.text
Ejemplo n.º 17
0
def test_suggest_initial_contents(request):
    """Suggest contents when setup.cfg does not exist."""
    ProjectMock(request).style("""
        [nitpick.files.present]
        "setup.cfg" = "Do something here"

        ["setup.cfg".mypy]
        ignore_missing_imports = true

        ["setup.cfg".isort]
        line_length = 120

        ["setup.cfg".flake8]
        max-line-length = 120
        """).flake8().assert_errors_contain(
        """
        NIP321 File setup.cfg was not found. Create it with this content:\x1b[32m
        [flake8]
        max-line-length = 120

        [isort]
        line_length = 120

        [mypy]
        ignore_missing_imports = True\x1b[0m
        """,
        2,
    ).assert_errors_contain(
        "NIP103 File setup.cfg should exist: Do something here")
Ejemplo n.º 18
0
def test_style_missing_id_in_hook(request):
    """Test style file is missing id in hook."""
    ProjectMock(request).style(
        '''
        [["pre-commit-config.yaml".repos]]
        repo = "another"
        hooks = """
        - name: isort
          entry: isort -sp setup.cfg
        """
        '''
    ).pre_commit(
        """
        repos:
        - repo: another
          hooks:
          - id: isort
        """
    ).lint().assert_single_error(
        """
        NIP336 File .pre-commit-config.yaml: style file is missing 'id' in hook:
            name: isort
            entry: isort -sp setup.cfg
        """
    )
Ejemplo n.º 19
0
def test_suggest_initial_contents(request):
    """Suggest contents when setup.cfg does not exist."""
    ProjectMock(request).style(
        """
        [nitpick.files."setup.cfg"]
        "missing_message" = "Do something here"

        ["setup.cfg".mypy]
        ignore_missing_imports = true

        ["setup.cfg".isort]
        line_length = 120

        ["setup.cfg".flake8]
        max-line-length = 120
        """
    ).lint().assert_single_error(
        """
        NIP321 File setup.cfg was not found. Do something here. Create it with this content:\x1b[92m
        [flake8]
        max-line-length = 120

        [isort]
        line_length = 120

        [mypy]
        ignore_missing_imports = True\x1b[0m
        """
    )
Ejemplo n.º 20
0
def test_missing_hook_with_id(request):
    """Test missing hook with specific id."""
    ProjectMock(request).style(
        '''
        [["pre-commit-config.yaml".repos]]
        repo = "other"
        hooks = """
        - id: black
          name: black
          entry: black
        """
        '''
    ).pre_commit(
        """
        repos:
        - repo: other
          hooks:
          - id: isort
        """
    ).lint().assert_single_error(
        """
        NIP337 File .pre-commit-config.yaml: missing hook with id 'black':
          - id: black
            name: black
            entry: black
        """
    )
Ejemplo n.º 21
0
def test_comma_separated_keys_on_style_file(request):
    """Comma separated keys on the style file."""
    project = (
        ProjectMock(request)
        .style(
            """
            [nitpick.files."setup.cfg"]
            comma_separated_values = ["food.eat"]

            ["setup.cfg".food]
            eat = "salt,ham,eggs"
            """
        )
        .setup_cfg(
            """
            [food]
            eat = spam,eggs,cheese
            """
        )
        .lint()
    )
    project.assert_single_error(
        """
        NIP322 File setup.cfg has missing values in the 'eat' key. Include those values:\x1b[92m
        [food]
        eat = (...),ham,salt\x1b[0m
        """
    )
Ejemplo n.º 22
0
def test_root_values_on_existing_file(request):
    """Test values on the root of the config file when there is a file."""
    ProjectMock(request).style(
        """
        ["pre-commit-config.yaml"]
        fail_fast = true
        blabla = "what"
        something = true
        another_thing = "yep"
        """
    ).pre_commit(
        """
        repos:
        - hooks:
          - id: whatever
        something: false
        another_thing: "nope"
        """
    ).lint().assert_errors_contain_unordered(
        """
        NIP338 File .pre-commit-config.yaml has missing values:\x1b[92m
        blabla: what
        fail_fast: true\x1b[0m
        """
    ).assert_errors_contain(
        """
        NIP339 File .pre-commit-config.yaml has different values. Use this:\x1b[92m
        another_thing: yep
        something: true\x1b[0m
        """
    )
Ejemplo n.º 23
0
def test_invalid_nitpick_files(offline, tmp_path):
    """Invalid [nitpick.files] section."""
    ProjectMock(tmp_path).named_style(
        "some_style",
        """
        [xxx]
        wrong = "section"
        """,
    ).named_style(
        "wrong_files",
        """
        [nitpick.files.whatever]
        wrong = "section"
        """,
    ).pyproject_toml("""
        [tool.nitpick]
        style = ["some_style", "wrong_files"]
        """).flake8(offline=offline).assert_errors_contain(f"""
        NIP001 File some_style.toml has an incorrect style. Invalid config:{SUGGESTION_BEGIN}
        xxx: Unknown file. See {READ_THE_DOCS_URL}plugins.html.{SUGGESTION_END}
        """).assert_errors_contain(
        f"""
        NIP001 File wrong_files.toml has an incorrect style. Invalid config:{SUGGESTION_BEGIN}
        nitpick.files.whatever: Unknown file. See {READ_THE_DOCS_URL}nitpick_section.html#nitpick-files.{SUGGESTION_END}
        """,
        2,
    )
Ejemplo n.º 24
0
def test_missing_repo_key(tmp_path):
    """Test missing repo key on the style file."""
    ProjectMock(tmp_path).style("""
        [[".pre-commit-config.yaml".repos]]
        grepo = "glocal"
        """).pre_commit("""
        repos:
        - hooks:
          - id: whatever
        """).api_check_then_fix(
        Fuss(
            True,
            PRE_COMMIT_CONFIG_YAML,
            368,
            " has missing values:",
            """
            repos:
              - grepo: glocal
            """,
        ), ).assert_file_contents(
            PRE_COMMIT_CONFIG_YAML,
            """
        repos:
          - hooks:
              - id: whatever
          - grepo: glocal
        """,
        )
Ejemplo n.º 25
0
def test_comma_separated_keys_on_style_file(tmp_path):
    """Comma separated keys on the style file."""
    ProjectMock(tmp_path).style(f"""
        [nitpick.files."{SETUP_CFG}"]
        comma_separated_values = ["food.eat", "food.drink"]

        ["{SETUP_CFG}".food]
        eat = "salt,ham,eggs"
        drink = "water,bier,wine"
        """).setup_cfg("""
        [food]
        eat = spam,eggs,cheese
        drink =   wine , bier , water
        """).api_check_then_fix(
        Fuss(
            True,
            SETUP_CFG,
            Violations.MISSING_VALUES_IN_LIST.code,
            " has missing values in the 'eat' key. Include those values:",
            """
            [food]
            eat = (...),ham,salt
            """,
        )).assert_file_contents(
            SETUP_CFG,
            """
        [food]
        eat = spam,eggs,cheese,ham,salt
        drink =   wine , bier , water
        """,
        )
Ejemplo n.º 26
0
def test_style_missing_id_in_hook(tmp_path):
    """Test style file is missing id in hook. Read the warning on :py:class:`nitpick.plugins.yaml.YamlPlugin`."""
    ProjectMock(tmp_path).style(f'''
        [[".pre-commit-config.yaml".repos]]
        repo = "another"
        hooks = """
        - name: isort
          entry: isort -sp {SETUP_CFG}
        """
        ''').pre_commit("""
        repos:
        - repo: another
          hooks:
          - id: isort
        """).api_check_then_fix(
        Fuss(
            True,
            PRE_COMMIT_CONFIG_YAML,
            368,
            " has missing values:",
            'repos:\n  - repo: another\n    hooks: "- name: isort\\n  entry: isort -sp setup.cfg\\n"',
        )).assert_file_contents(
            PRE_COMMIT_CONFIG_YAML,
            r"""
        repos:
          - repo: another
            hooks:
              - id: isort
          - repo: another
            hooks: "- name: isort\n  entry: isort -sp setup.cfg\n"
        """,
        )
Ejemplo n.º 27
0
def test_simulate_parsing_error_when_saving(update_file, tmp_path):
    """Simulate a parsing error when saving an INI file."""
    update_file.side_effect = ParsingError(
        source="simulating a captured error")

    original_file = """
        [flake8]
        existing = value
        """
    ProjectMock(tmp_path).style(f"""
        ["{SETUP_CFG}".flake8]
        new = "value"
        """).setup_cfg(original_file).api_fix().assert_violations(
        Fuss(
            True,
            SETUP_CFG,
            324,
            ": section [flake8] has some missing key/value pairs. Use this:",
            """
            [flake8]
            new = value
            """,
        ),
        Fuss(
            False,
            SETUP_CFG,
            Violations.PARSING_ERROR.code,
            ": parsing error (ParsingError): Source contains parsing errors: 'simulating a captured error'",
        ),
    ).assert_file_contents(SETUP_CFG, original_file)
Ejemplo n.º 28
0
def test_missing_hook_with_id(tmp_path):
    """Test missing hook with specific id."""
    ProjectMock(tmp_path).style('''
        [[".pre-commit-config.yaml".repos]]
        repo = "other"
        hooks = """
        - id: black
          name: black
          entry: black
        """
        ''').pre_commit("""
        repos:
        - repo: other
          hooks:
          - id: isort
        """).api_check_then_fix(
        Fuss(
            True,
            PRE_COMMIT_CONFIG_YAML,
            368,
            " has missing values:",
            """
            repos:
              - repo: other
                hooks: "- id: black\\n  name: black\\n  entry: black\\n"
            """,
        ))
Ejemplo n.º 29
0
def test_invalid_nitpick_files(offline, request):
    """Invalid [nitpick.files] section."""
    ProjectMock(request).named_style(
        "some_style",
        """
        [xxx]
        wrong = "section"
        """,
    ).named_style(
        "wrong_files",
        """
        [nitpick.files.whatever]
        wrong = "section"
        """,
    ).pyproject_toml("""
        [tool.nitpick]
        style = ["some_style", "wrong_files"]
        """).flake8(offline=offline).assert_errors_contain("""
        NIP001 File some_style.toml has an incorrect style. Invalid config:\x1b[32m
        xxx: Unknown file. See https://nitpick.rtfd.io/en/latest/config_files.html.\x1b[0m
        """).assert_errors_contain(
        """
        NIP001 File wrong_files.toml has an incorrect style. Invalid config:\x1b[32m
        nitpick.files.whatever: Unknown file. See {}nitpick_section.html#nitpick-files.\x1b[0m
        """.format(READ_THE_DOCS_URL),
        2,
    )
Ejemplo n.º 30
0
def test_text_configuration(tmp_path):
    """Test configuration for text files."""
    # pylint: disable=line-too-long
    ProjectMock(tmp_path).style(
        """
        [["abc.txt".contains]]
        invalid = "key"
        line = ["it", "should", "be", "a", "string"]

        ["def.txt".contains]
        should_be = "inside an array"

        ["ghi.txt".whatever]
        wrong = "everything"
        """
    ).flake8().assert_errors_contain(
        f"""
        NIP001 File nitpick-style.toml has an incorrect style. Invalid config:{SUGGESTION_BEGIN}
        "abc.txt".contains.0.invalid: Unknown configuration. See {READ_THE_DOCS_URL}plugins.html#text-files.
        "abc.txt".contains.0.line: Not a valid string.
        "def.txt".contains: Not a valid list.
        "ghi.txt".whatever: Unknown configuration. See {READ_THE_DOCS_URL}plugins.html#text-files.{SUGGESTION_END}
        """,
        1,
    )