Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit fe98bf0

Browse files
committed
lint: Disable line length lint check
When using markdown tables in qna.yaml files, for example, in a knowledge context as copied from a source knowledge markdown file, the markdown table rows can be quite wide. Often much wider than the current 120 char line length limit. Since a markdown table row cannot be split without breaking the table, we need to disable line length checks to support the use of markdown tables in qna.yaml. Signed-off-by: BJ Hargrave <[email protected]>
1 parent 139a429 commit fe98bf0

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/instructlab/schema/taxonomy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
DEFAULT_TAXONOMY_FOLDERS: list[str] = ["compositional_skills", "knowledge"]
3131
"""Taxonomy folders which are also the schema names"""
3232

33-
DEFAULT_YAMLLINT_CONFIG: str = "{extends: relaxed, rules: {line-length: {max: 120}}}"
33+
DEFAULT_YAMLLINT_CONFIG: str = "{extends: relaxed, rules: {line-length: disable}}"
3434
"""Default yamllint configuration"""
3535

3636

tests/test_parse.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,14 @@ def test_invalid(self, caplog: pytest.LogCaptureFixture, testdata: pathlib.Path)
2525
parser = TaxonomyParser(schema_version=0, message_format=TaxonomyMessageFormat.LOGGING)
2626
taxonomy = parser.parse(rel_path)
2727

28-
assert_that(taxonomy.warnings).is_greater_than_or_equal_to(1)
28+
assert_that(taxonomy.warnings).is_zero()
2929
assert_that(taxonomy.errors).is_greater_than_or_equal_to(2)
3030
assert_that(taxonomy.path.as_posix()).is_equal_to(test_yaml)
3131
assert_that(taxonomy.rel_path).is_equal_to(rel_path)
3232
assert_that(caplog.records).extracting(
3333
"message",
3434
filter=self.message_filter(f"{re.escape(test_yaml)}:"),
3535
).is_length(len(caplog.records))
36-
assert_that(caplog.records).extracting(
37-
"levelno",
38-
filter=self.message_filter(r"line too long"),
39-
).contains_only(logging.WARNING)
4036
assert_that(caplog.records).extracting(
4137
"levelno",
4238
filter=self.message_filter(r"Unevaluated properties.*createdby"),
@@ -47,9 +43,15 @@ def test_invalid(self, caplog: pytest.LogCaptureFixture, testdata: pathlib.Path)
4743
).contains_only(logging.ERROR)
4844

4945
def test_invalid_yamlint_strict(self, caplog: pytest.LogCaptureFixture, testdata: pathlib.Path) -> None:
46+
yamllint_config = "{extends: relaxed, rules: {line-length: {max: 120}}}"
5047
test_yaml = "compositional_skills/invalid_yaml/qna.yaml"
5148
rel_path = testdata.joinpath(test_yaml)
52-
parser = TaxonomyParser(schema_version=0, yamllint_strict=True, message_format=TaxonomyMessageFormat.LOGGING)
49+
parser = TaxonomyParser(
50+
schema_version=0,
51+
message_format=TaxonomyMessageFormat.LOGGING,
52+
yamllint_config=yamllint_config,
53+
yamllint_strict=True,
54+
)
5355
taxonomy = parser.parse(rel_path)
5456

5557
assert_that(taxonomy.warnings).is_zero()
@@ -295,7 +297,7 @@ def test_version_1_as_version_2(self, caplog: pytest.LogCaptureFixture, testdata
295297
parser = TaxonomyParser(schema_version=2, message_format=TaxonomyMessageFormat.LOGGING)
296298
taxonomy = parser.parse(rel_path)
297299

298-
assert_that(taxonomy.warnings).is_greater_than_or_equal_to(1)
300+
assert_that(taxonomy.warnings).is_zero()
299301
assert_that(taxonomy.errors).is_greater_than_or_equal_to(1)
300302
assert_that(taxonomy.path.as_posix()).is_equal_to(test_yaml)
301303
assert_that(taxonomy.rel_path).is_equal_to(rel_path)
@@ -304,10 +306,6 @@ def test_version_1_as_version_2(self, caplog: pytest.LogCaptureFixture, testdata
304306
"message",
305307
filter=self.message_filter(f"{re.escape(test_yaml)}:"),
306308
).is_length(len(caplog.records))
307-
assert_that(caplog.records).extracting(
308-
"levelno",
309-
filter=self.message_filter(r"line too long"),
310-
).contains_only(logging.WARNING)
311309
assert_that(caplog.records).extracting(
312310
"levelno",
313311
filter=self.message_filter(r"version.*required property"),
@@ -321,7 +319,7 @@ def test_format_github(self, capsys: pytest.CaptureFixture[str], testdata: pathl
321319
parser = TaxonomyParser(schema_version=0, message_format=TaxonomyMessageFormat.GITHUB)
322320
taxonomy = parser.parse(rel_path)
323321

324-
assert_that(taxonomy.warnings).is_greater_than_or_equal_to(1)
322+
assert_that(taxonomy.warnings).is_zero()
325323
assert_that(taxonomy.errors).is_greater_than_or_equal_to(2)
326324
assert_that(taxonomy.path.as_posix()).is_equal_to(test_yaml)
327325
assert_that(taxonomy.rel_path).is_equal_to(rel_path)
@@ -340,7 +338,7 @@ def test_format_standard(self, capsys: pytest.CaptureFixture[str], testdata: pat
340338
parser = TaxonomyParser(schema_version=0, message_format=TaxonomyMessageFormat.STANDARD)
341339
taxonomy = parser.parse(rel_path)
342340

343-
assert_that(taxonomy.warnings).is_greater_than_or_equal_to(1)
341+
assert_that(taxonomy.warnings).is_zero()
344342
assert_that(taxonomy.errors).is_greater_than_or_equal_to(2)
345343
assert_that(taxonomy.path.as_posix()).is_equal_to(test_yaml)
346344
assert_that(taxonomy.rel_path).is_equal_to(rel_path)
@@ -359,7 +357,7 @@ def test_format_auto(self, capsys: pytest.CaptureFixture[str], testdata: pathlib
359357
parser = TaxonomyParser(schema_version=0)
360358
taxonomy = parser.parse(rel_path)
361359

362-
assert_that(taxonomy.warnings).is_greater_than_or_equal_to(1)
360+
assert_that(taxonomy.warnings).is_zero()
363361
assert_that(taxonomy.errors).is_greater_than_or_equal_to(2)
364362
assert_that(taxonomy.path.as_posix()).is_equal_to(test_yaml)
365363
assert_that(taxonomy.rel_path).is_equal_to(rel_path)

0 commit comments

Comments
 (0)