instance_id string | repo string | language string | domain string | image_name string | original_image_name string | image_digest string | image_id string | workdir string | problem_statement string | patch string | injection_patch string | test_patch string | FAIL_TO_PASS list | PASS_TO_PASS list | correct_file_sha256 string | buggy_file_sha256 string | target_file string | split string | base_commit string | requires_instance_preparation bool | requires_new_image bool | test_cmd string | test_files list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sweas_6b931b7f61b2c4949e23f2ad | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | Dashboard generation fails with `NameError: name 'gtype' is not defined`
### Description
Trying to generate a dashboard from a definition file now fails before producing any output. I first noticed it while running the files in `examples/`, but a minimal dashboard definition does the same thing.
### Steps to Reprodu... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 245a6e1..4094edf 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -51,10 +51,16 @@ def loader(path):
:param str path: Path to a *.<type>.py file that defines a variable called <type>.
"""
+ gtype = path.split(".")[-2]
+
if sys.ver... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 4094edf..245a6e1 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -51,16 +51,10 @@ def loader(path):
:param str path: Path to a *.<type>.py file that defines a variable called <type>.
"""
- gtype = path.split(".")[-2]
-
if sys.ver... | [
"grafanalib/tests/test_examples.py::test_examples"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 9219542817deb0a1ff2ef725aba1bb1fc835cf36eff3476c076bf2dcafcafd5f | e56a89f88a38b51bb258888034c1aedd900c236a8d4cb7061f5ca93163f10b11 | grafanalib/_gen.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_dfde9429d0951109b607a318 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | # `AzureMonitorMetricsTarget` no longer accepts `aggregation`
### Description
After updating grafanalib, existing Azure Monitor metric targets that pass an `aggregation` value fail during construction. For example, `aggregation="Total"` is a common Azure Monitor metric option and used to serialize fine. This looks lik... | diff --git a/grafanalib/azuremonitor.py b/grafanalib/azuremonitor.py
index 94cf40d..7cb324e 100644
--- a/grafanalib/azuremonitor.py
+++ b/grafanalib/azuremonitor.py
@@ -1,6 +1,7 @@
"""Helpers to create Azure Monitor specific Grafana queries."""
import attr
+from attr.validators import instance_of
@attr.s
@@ -2... | diff --git a/grafanalib/azuremonitor.py b/grafanalib/azuremonitor.py
index 7cb324e..94cf40d 100644
--- a/grafanalib/azuremonitor.py
+++ b/grafanalib/azuremonitor.py
@@ -1,7 +1,6 @@
"""Helpers to create Azure Monitor specific Grafana queries."""
import attr
-from attr.validators import instance_of
@attr.s
@@ -2... | [
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_metrics_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_cloudwatch.py::test_cloudwatc... | 4fc8e732f56f49158d6b893402c37ea4be14b267ad1d834bb7172acd656b890c | f4e27f18c36e689e58f04ee1395d6f7b9515471cd98c3570da028918f5940d7c | grafanalib/azuremonitor.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_824c8a1af092d46a15f61a4e | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | Serializing `CloudwatchMetricsTarget` raises AttributeError for missing `account`
### Description
After updating, any dashboard that includes a `CloudwatchMetricsTarget` can no longer be serialized. Creating the target works fine, but writing the dashboard out fails with an `AttributeError` about a missing `account` ... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index e030724..9aadae4 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -21,6 +21,8 @@ class CloudwatchMetricsTarget(Target):
:param dimensions: Cloudwatch dimensions dict
:param expression: Cloudwatch Metric math expressi... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index 9aadae4..e030724 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -21,8 +21,6 @@ class CloudwatchMetricsTarget(Target):
:param dimensions: Cloudwatch dimensions dict
:param expression: Cloudwatch Metric math expressi... | [
"grafanalib/tests/test_cloudwatch.py::test_serialization_cloudwatch_metrics_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | f1cf3db6fa1a9e36dc86e8d6c2314f737963e5fea7cf2822add3448886b37d6f | b4c2b9aecea7e3b6804ded01bc285ef2ed4efb32b4e66caeeedc94d82348a440 | grafanalib/cloudwatch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_f1f8efed014045ae2a4f9250 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | ### CloudWatch targets no longer include `hide` in serialized JSON
The `hide` field on CloudWatch targets appears to have been dropped. Grafana uses this property to control whether a target is displayed on a visualization, and it affects both `CloudwatchMetricsTarget` and `CloudwatchLogsInsightsTarget`.
### Expected... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index 0a1255a..9aadae4 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -31,6 +31,7 @@ class CloudwatchMetricsTarget(Target):
:param region: Cloudwatch region
:param statistics: Cloudwatch mathematic statistics (to be depr... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index 9aadae4..0a1255a 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -31,7 +31,6 @@ class CloudwatchMetricsTarget(Target):
:param region: Cloudwatch region
:param statistics: Cloudwatch mathematic statistics (to be depr... | [
"grafanalib/tests/test_cloudwatch.py::test_cloudwatch_logs_insights_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | f1cf3db6fa1a9e36dc86e8d6c2314f737963e5fea7cf2822add3448886b37d6f | aa4519f2c0713ad3b8b6beaf876ab4ccc690270195576cd7895798ecb767e68b | grafanalib/cloudwatch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_d7f58dfc91e765a06fddc492 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | # Cloudwatch targets no longer emit `queryMode` in generated JSON
### Description
When generating a dashboard using `CloudwatchLogsInsightsTarget`, the resulting JSON no longer contains the `queryMode` field. Grafana expects this to be set to `"Logs"` for Logs Insights queries. The metrics target also no longer accep... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index 461e6cb..9aadae4 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -33,6 +33,7 @@ class CloudwatchMetricsTarget(Target):
:param statistic: Cloudwatch mathematic statistic
:param hide: controls if given metric is displ... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index 9aadae4..461e6cb 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -33,7 +33,6 @@ class CloudwatchMetricsTarget(Target):
:param statistic: Cloudwatch mathematic statistic
:param hide: controls if given metric is displ... | [
"grafanalib/tests/test_cloudwatch.py::test_cloudwatch_logs_insights_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | f1cf3db6fa1a9e36dc86e8d6c2314f737963e5fea7cf2822add3448886b37d6f | ba2d5cdda1443941700f509bd712cdbf56a9f3674e8195bd1a81f35a34f4c87e | grafanalib/cloudwatch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_ab588f661c6634cf8b382f66 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | **RateMetricAgg no longer accepts `mode` parameter**
### Description
After upgrading to the latest version, creating a `RateMetricAgg` with the `mode` argument raises a `TypeError`. This used to work and was a documented way to set the aggregation mode (e.g., `"sum"` or `"value_count"`). Our dashboards rely on this to... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index 1c38f58..bf4cb29 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -520,6 +520,7 @@ class RateMetricAgg(object):
"month"
"quarter"
"year"
+ :param mode: sum or count the values
:pa... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index bf4cb29..1c38f58 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -520,7 +520,6 @@ class RateMetricAgg(object):
"month"
"quarter"
"year"
- :param mode: sum or count the values
:pa... | [
"grafanalib/tests/test_elasticsearch.py::test_rate_metric_agg"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 729f0c7119eb5c76e4b0605413890511e3bf434c0ab511f309bd7d3cf1c5a457 | ac5bedb0f8c6ffbd4fac18ca51b1dea0df5d8c960df201ba64b866f9c8801a6a | grafanalib/elasticsearch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_aeaaf84504aac40730ffe7e6 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | **`RateMetricAgg` serializes the wrong `mode` value**
When creating a `RateMetricAgg` with an explicit `mode`, the generated JSON does not preserve it. For example:
```python
from grafanalib.elasticsearch import RateMetricAgg
t = RateMetricAgg(field="some-field", mode="sum")
print(t.to_json_data())
```
Expected the... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index 2401883..bf4cb29 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -528,7 +528,7 @@ class RateMetricAgg(object):
id = attr.ib(default=0, validator=instance_of(int))
hide = attr.ib(default=False, validator=... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index bf4cb29..2401883 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -528,7 +528,7 @@ class RateMetricAgg(object):
id = attr.ib(default=0, validator=instance_of(int))
hide = attr.ib(default=False, validator=... | [
"grafanalib/tests/test_elasticsearch.py::test_rate_metric_agg"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 729f0c7119eb5c76e4b0605413890511e3bf434c0ab511f309bd7d3cf1c5a457 | 7369d0b1f3ec77fc55259e536ff30cf5f2fd7ed34d56558e95bee2a5304c3e05 | grafanalib/elasticsearch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_53778f1b0803b3e66fcf5726 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | **HumioTarget serialization fails with `AttributeError: 'HumioTarget' object has no attribute 'refId'`**
### Description
Creating a `HumioTarget` and serializing a dashboard that uses it raises an `AttributeError` because the target no longer has a `refId` attribute, but its `to_json_data()` method still tries to acc... | diff --git a/grafanalib/humio.py b/grafanalib/humio.py
index 4dbc1c9..6bff77a 100644
--- a/grafanalib/humio.py
+++ b/grafanalib/humio.py
@@ -2,6 +2,7 @@
import attr
+
@attr.s
class HumioTarget(object):
"""
@@ -18,6 +19,7 @@ class HumioTarget(object):
humioQuery = attr.ib(default="")
humioReposit... | diff --git a/grafanalib/humio.py b/grafanalib/humio.py
index 6bff77a..4dbc1c9 100644
--- a/grafanalib/humio.py
+++ b/grafanalib/humio.py
@@ -2,7 +2,6 @@
import attr
-
@attr.s
class HumioTarget(object):
"""
@@ -19,7 +18,6 @@ class HumioTarget(object):
humioQuery = attr.ib(default="")
humioReposit... | [
"grafanalib/tests/test_humio.py::test_serialization_humio_metrics_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | ecc544d10a314667f120534958f585478c44a40a2a2314c33fade2dbbecf076a | 486f787ef35a25dd715aade8da8ed24bfd7f021c09a9cdf554661071ac7b6c48 | grafanalib/humio.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_259986bb041fe88a0e43e807 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | Serializing a `HumioTarget` raises `AttributeError`
When adding a `HumioTarget` to a dashboard and writing it out, serialization fails instead of producing the Humio target JSON.
### Steps to Reproduce
```python
import grafanalib.core as G
import grafanalib.humio as H
from grafanalib import _gen
from io import Strin... | diff --git a/grafanalib/humio.py b/grafanalib/humio.py
index 6ff07f2..6bff77a 100644
--- a/grafanalib/humio.py
+++ b/grafanalib/humio.py
@@ -1,9 +1,9 @@
"""Helpers to create Humio-specific Grafana queries."""
-import attr as attrs
+import attr
-@attrs.define
+@attr.s
class HumioTarget(object):
"""
Gen... | diff --git a/grafanalib/humio.py b/grafanalib/humio.py
index 6bff77a..6ff07f2 100644
--- a/grafanalib/humio.py
+++ b/grafanalib/humio.py
@@ -1,9 +1,9 @@
"""Helpers to create Humio-specific Grafana queries."""
-import attr
+import attr as attrs
-@attr.s
+@attrs.define
class HumioTarget(object):
"""
Gen... | [
"grafanalib/tests/test_humio.py::test_serialization_humio_metrics_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | ecc544d10a314667f120534958f585478c44a40a2a2314c33fade2dbbecf076a | 1bd3f7a64f1970abe3a403e0831a27a88e098b7da7bb58b45b247d81a97cb44d | grafanalib/humio.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_c94d4bb7201184a422bf3047 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | # `HumioTarget` no longer allows empty/default construction
### Description
After the recent changes, `HumioTarget` no longer accepts being constructed without explicitly passing every field. Previously the fields defaulted to empty strings, so `HumioTarget()` could be used directly in dashboard targets.
### Expecte... | diff --git a/grafanalib/humio.py b/grafanalib/humio.py
index 1cf37ef..6bff77a 100644
--- a/grafanalib/humio.py
+++ b/grafanalib/humio.py
@@ -1,7 +1,10 @@
"""Helpers to create Humio-specific Grafana queries."""
+import attr
+
+
+@attr.s
class HumioTarget(object):
- """Generates Humio target JSON structure."""
... | diff --git a/grafanalib/humio.py b/grafanalib/humio.py
index 6bff77a..1cf37ef 100644
--- a/grafanalib/humio.py
+++ b/grafanalib/humio.py
@@ -1,10 +1,7 @@
"""Helpers to create Humio-specific Grafana queries."""
-import attr
-
-
-@attr.s
class HumioTarget(object):
+ """Generates Humio target JSON structure."""
... | [
"grafanalib/tests/test_humio.py::test_serialization_humio_metrics_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | ecc544d10a314667f120534958f585478c44a40a2a2314c33fade2dbbecf076a | 7e33ccdebf2714dca8c145b0f118acb22f4fac30cd466543e5d1efa23b4c34a4 | grafanalib/humio.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_cd9f79b6a9416cd3814a280a | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | # `generate-dashboard` crashes while loading dashboard definitions
When trying to generate JSON from a dashboard definition file, `grafanalib` fails while loading the definition.
### Expected behavior
The dashboard definition should load and the generated JSON should be printed, as before.
### Actual behavior
The ... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index c84bd29..4094edf 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -2,6 +2,8 @@
import argparse
import json
+import os
+import sys
DASHBOARD_SUFFIX = '.dashboard.py'
@@ -51,10 +53,20 @@ def loader(path):
"""
gtype = path.split(".")[... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 4094edf..c84bd29 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -2,8 +2,6 @@
import argparse
import json
-import os
-import sys
DASHBOARD_SUFFIX = '.dashboard.py'
@@ -53,20 +51,10 @@ def loader(path):
"""
gtype = path.split(".")[... | [
"grafanalib/tests/test_examples.py::test_examples"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 9219542817deb0a1ff2ef725aba1bb1fc835cf36eff3476c076bf2dcafcafd5f | 6ab67fd001e68437769e36dec2956caa42144cc727d9f0a927ab60a603dde751 | grafanalib/_gen.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_6b46a127632e8a15ea4699e8 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | # AzureDataExplorerTarget raises `TypeError` when instantiated
Creating an `AzureDataExplorerTarget` now raises an exception, which makes it impossible to build an Azure Data Explorer graph:
```python
TypeError: __init__() should return None, not 'dict'
```
### Expected behavior
`AzureDataExplorerTarget()` should c... | diff --git a/grafanalib/azuredataexplorer.py b/grafanalib/azuredataexplorer.py
index 238fc73..9589d25 100644
--- a/grafanalib/azuredataexplorer.py
+++ b/grafanalib/azuredataexplorer.py
@@ -1,8 +1,13 @@
"""Helpers to create Azure Data Explorer specific Grafana queries."""
-"""
-Azure Data Explorer target JSON structu... | diff --git a/grafanalib/azuredataexplorer.py b/grafanalib/azuredataexplorer.py
index 9589d25..238fc73 100644
--- a/grafanalib/azuredataexplorer.py
+++ b/grafanalib/azuredataexplorer.py
@@ -1,13 +1,8 @@
"""Helpers to create Azure Data Explorer specific Grafana queries."""
-import attr
-
-TIME_SERIES_RESULT_FORMAT = '... | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target"
] | [
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_metrics_target",
"grafanalib/tests/test_cloudwatch.py::test_cloudwatch_logs_insights_t... | 7e77876dd53d25ec08a8f5dce1351c66ada4abfb4dc08af290684d256e2fb567 | c481aabf31214a057740c43a20b3237cf586967dc74f5e89658fb0e10ddd4673 | grafanalib/azuredataexplorer.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_9284d1d5fcc9aea1a59d39b5 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | ElasticsearchTarget no longer has `auto_bucket_agg_ids`
### Description
It looks like the `auto_bucket_agg_ids()` helper on `ElasticsearchTarget` has disappeared. Dashboards that rely on it to fill in IDs for bucket aggregations now fail when they are generated.
### Steps to Reproduce
Use an Elasticsearch target with... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index ef95afe..bf4cb29 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -1,6 +1,7 @@
"""Helpers to create Elasticsearch-specific Grafana queries."""
import attr
+import itertools
from attr.validators import in_, ins... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index bf4cb29..ef95afe 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -1,7 +1,6 @@
"""Helpers to create Elasticsearch-specific Grafana queries."""
import attr
-import itertools
from attr.validators import in_, ins... | [
"grafanalib/tests/test_examples.py::test_examples"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 729f0c7119eb5c76e4b0605413890511e3bf434c0ab511f309bd7d3cf1c5a457 | b0d064ca08d89a1d48bfeb4c5db226e4545cb6e93496e3185a83b0c4f416993c | grafanalib/elasticsearch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_835260377cfe2087a860ca9f | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | RateMetricAgg with a non-empty script raises TypeError during serialization
### Description
When a `RateMetricAgg` is created with a non-empty `script` string, calling `to_json_data()` raises a `TypeError` instead of serializing the script into the panel settings.
### Expected behavior
The generated JSON should inclu... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index e581564..bf4cb29 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -529,7 +529,7 @@ class RateMetricAgg(object):
hide = attr.ib(default=False, validator=instance_of(bool))
unit = attr.ib(default="", valida... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index bf4cb29..e581564 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -529,7 +529,7 @@ class RateMetricAgg(object):
hide = attr.ib(default=False, validator=instance_of(bool))
unit = attr.ib(default="", valida... | [
"grafanalib/tests/test_elasticsearch.py::test_rate_metric_agg"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 729f0c7119eb5c76e4b0605413890511e3bf434c0ab511f309bd7d3cf1c5a457 | 4c5e7877125e0ecba0a11c32b761112bbfb9ff716f209a27f9670296bfa568cc | grafanalib/elasticsearch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_f681f9fd01049c18f9a5f433 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | ### Description
When serializing Cloudwatch targets, the `region` (and for the metrics target, `matchExact`) fields are no longer included in the generated JSON. This means dashboards generated with grafanalib are missing these settings.
### Expected behavior
`to_json_data()` should include `"region": "default"` for... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index 0e38259..9aadae4 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -31,34 +31,36 @@ class CloudwatchMetricsTarget(Target):
:param region: Cloudwatch region
:param statistics: Cloudwatch mathematic statistics (to be de... | diff --git a/grafanalib/cloudwatch.py b/grafanalib/cloudwatch.py
index 9aadae4..0e38259 100644
--- a/grafanalib/cloudwatch.py
+++ b/grafanalib/cloudwatch.py
@@ -31,36 +31,34 @@ class CloudwatchMetricsTarget(Target):
:param region: Cloudwatch region
:param statistics: Cloudwatch mathematic statistics (to be de... | [
"grafanalib/tests/test_cloudwatch.py::test_cloudwatch_logs_insights_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | f1cf3db6fa1a9e36dc86e8d6c2314f737963e5fea7cf2822add3448886b37d6f | 2b92266e11a1843724b4ebb44e9a1079c44b61e2773e33bbb4b6cef3f3820ca8 | grafanalib/cloudwatch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_0a198bc5df70c079c36b8cad | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | `generate_dashboard` raises a NameError before producing dashboard JSON
Generating a dashboard from a valid Python definition now stops immediately:
```text
NameError: name 'argparse' is not defined
```
For example:
```python
from pathlib import Path
from tempfile import TemporaryDirectory
from grafanalib import _g... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 7ffadc0..4094edf 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -1,5 +1,6 @@
"""Generate JSON Grafana dashboards."""
+import argparse
import json
import os
import sys
@@ -102,7 +103,13 @@ def get_alertgroup_json_path(path):
def alertgrou... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 4094edf..7ffadc0 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -1,6 +1,5 @@
"""Generate JSON Grafana dashboards."""
-import argparse
import json
import os
import sys
@@ -103,13 +102,7 @@ def get_alertgroup_json_path(path):
def alertgrou... | [
"grafanalib/tests/test_examples.py::test_examples"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 9219542817deb0a1ff2ef725aba1bb1fc835cf36eff3476c076bf2dcafcafd5f | a8df0b36d50f4dfb9cd1830f9c99ec9fe201038d57a1088a85b198492bccf74d | grafanalib/_gen.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_43c714ce85b896d1a96f899a | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | ### Description
When trying to generate an alertgroup from a Python script using `grafanalib._gen`, I get an `AttributeError`. The function `generate_alertgroup` seems to be missing.
### Steps to Reproduce
```python
from grafanalib import _gen
# Any alertgroup example file
_gen.generate_alertgroup(['examples/example.... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 08041f5..4094edf 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -127,6 +127,30 @@ def generate_alertgroups(args):
return 0
+def generate_alertgroup(args):
+ parser = argparse.ArgumentParser(prog='generate-alertgroup')
+ parser.add_ar... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 4094edf..08041f5 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -127,30 +127,6 @@ def generate_alertgroups(args):
return 0
-def generate_alertgroup(args):
- parser = argparse.ArgumentParser(prog='generate-alertgroup')
- parser.add_ar... | [
"grafanalib/tests/test_examples.py::test_examples"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 9219542817deb0a1ff2ef725aba1bb1fc835cf36eff3476c076bf2dcafcafd5f | 725e7a387c8fd61226fa9316de6c7ded8e90f0a53af04cf4d797cda0053a6191 | grafanalib/_gen.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_b8f299d4e4732809838cc110 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | `generate-alertgroup` fails with a `NameError`
### Description
Trying to generate an alertgroup using the CLI fails with a `NameError`. It looks like the `--output`/`-o` handling for alertgroups references something that isn't defined. I also noticed that passing an output file that doesn't end with `.alertgroup.py` ... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index d1067b9..4094edf 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -4,6 +4,11 @@ import argparse
import json
import os
import sys
+
+
+DASHBOARD_SUFFIX = '.dashboard.py'
+ALERTGROUP_SUFFIX = '.alertgroup.py'
+
"""
Common generation functionality
... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 4094edf..d1067b9 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -4,11 +4,6 @@ import argparse
import json
import os
import sys
-
-
-DASHBOARD_SUFFIX = '.dashboard.py'
-ALERTGROUP_SUFFIX = '.alertgroup.py'
-
"""
Common generation functionality
... | [
"grafanalib/tests/test_examples.py::test_examples"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 9219542817deb0a1ff2ef725aba1bb1fc835cf36eff3476c076bf2dcafcafd5f | 8cff92c42ca518ddc7542aceb4a178b7f34f1a7c6ad12cc6063be2d7b614abdd | grafanalib/_gen.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_a11129a2cd0bd73d5c747ed6 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | ## Azure Monitor Logs target is missing
### Description
After updating `grafanalib`, I can no longer build dashboards that use Azure Monitor Logs. The `AzureLogsTarget` class that used to be available from `grafanalib.azuremonitor` appears to be gone.
### Expected behavior
I should be able to create an `AzureLogsTa... | diff --git a/grafanalib/azuremonitor.py b/grafanalib/azuremonitor.py
index e02183e..7cb324e 100644
--- a/grafanalib/azuremonitor.py
+++ b/grafanalib/azuremonitor.py
@@ -24,7 +24,7 @@ class AzureMonitorMetricsTarget(object):
"""
aggregation = attr.ib(default="Total")
- dimensionFilters = attr.ib(default=[... | diff --git a/grafanalib/azuremonitor.py b/grafanalib/azuremonitor.py
index 7cb324e..e02183e 100644
--- a/grafanalib/azuremonitor.py
+++ b/grafanalib/azuremonitor.py
@@ -24,7 +24,7 @@ class AzureMonitorMetricsTarget(object):
"""
aggregation = attr.ib(default="Total")
- dimensionFilters = attr.ib(factory=l... | [
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_metrics_target",
"grafanalib/tests/test_cloudwatch.py::test_cloudwatch_logs_insights_target",
"grafanalib/tests/test_cloudwatch.py::test_serializa... | 4fc8e732f56f49158d6b893402c37ea4be14b267ad1d834bb7172acd656b890c | 730834751c667523790f36247345b2ccd139052d9399ec0e522b02bfbf8d03d4 | grafanalib/azuremonitor.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_8dbd5dc82ae95af941a41a21 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | `write_dashboard` explodes with `NameError: name 'json' is not defined`
### Description
Generating/serializing any dashboard no longer works. Calling `write_dashboard` (or using the CLI to generate a dashboard) raises a `NameError` instead of producing JSON.
### Steps to Reproduce
```python
import grafanalib.core a... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index d3deb7c..4094edf 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -1,6 +1,7 @@
"""Generate JSON Grafana dashboards."""
import argparse
+import json
import os
import sys
@@ -13,6 +14,16 @@ Common generation functionality
"""
+class Dashbo... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 4094edf..d3deb7c 100644
--- a/grafanalib/_gen.py
+++ b/grafanalib/_gen.py
@@ -1,7 +1,6 @@
"""Generate JSON Grafana dashboards."""
import argparse
-import json
import os
import sys
@@ -14,16 +13,6 @@ Common generation functionality
"""
-class Dashbo... | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | [
"grafanalib/tests/test_cloudwatch.py::test_cloudwatch_logs_insights_target",
"grafanalib/tests/test_core.py::TestDashboardLink::test_initialisation",
"grafanalib/tests/test_core.py::TestDashboardLink::test_validators",
"grafanalib/tests/test_core.py::test_Discrete",
"grafanalib/tests/test_core.py::test_Disc... | 9219542817deb0a1ff2ef725aba1bb1fc835cf36eff3476c076bf2dcafcafd5f | 3015562de237e54a1f772fdec53177c8199102a36b8bdd50d1416877d92ae02d | grafanalib/_gen.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_ca1970627a66e45e29f5c9de | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | `DateHistogramGroupBy` no longer accepts `interval` and `TermsGroupBy` rejects `order`/`orderBy`
Creating a date histogram group-by with an explicit interval now raises an error:
```python
from grafanalib.elasticsearch import DateHistogramGroupBy
group_by = DateHistogramGroupBy(interval="10m")
print(group_by.to_json... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index 2dbbdd4..bf4cb29 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -5,6 +5,10 @@ import itertools
from attr.validators import in_, instance_of
from grafanalib.core import AlertCondition
+DATE_HISTOGRAM_DEFAULT_F... | diff --git a/grafanalib/elasticsearch.py b/grafanalib/elasticsearch.py
index bf4cb29..2dbbdd4 100644
--- a/grafanalib/elasticsearch.py
+++ b/grafanalib/elasticsearch.py
@@ -5,10 +5,6 @@ import itertools
from attr.validators import in_, instance_of
from grafanalib.core import AlertCondition
-DATE_HISTOGRAM_DEFAULT_F... | [
"grafanalib/tests/test_examples.py::test_examples"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 729f0c7119eb5c76e4b0605413890511e3bf434c0ab511f309bd7d3cf1c5a457 | ba82a1119ed120021f214423399e70b7c7778e71ae920bb1494b2dacf00e6265 | grafanalib/elasticsearch.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_22b6d8359f7788c69e2e18e9 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | **ZabbixTriggersPanel fails with default `triggerSeverity`**
Constructing a `ZabbixTriggersPanel` with the default settings raises an `AttributeError` before the panel can be serialized.
```python
from grafanalib import zabbix as Z
panel = Z.ZabbixTriggersPanel(
id=1,
title="Zabbix Triggers",
dataSource=... | diff --git a/grafanalib/zabbix.py b/grafanalib/zabbix.py
index 961f28e..4aea049 100644
--- a/grafanalib/zabbix.py
+++ b/grafanalib/zabbix.py
@@ -704,6 +704,22 @@ def zabbixTextTarget(application, group, host, item, text,
)
+@attr.s
+class ZabbixColor(object):
+ color = attr.ib(validator=is_color_code)
+ ... | diff --git a/grafanalib/zabbix.py b/grafanalib/zabbix.py
index 4aea049..961f28e 100644
--- a/grafanalib/zabbix.py
+++ b/grafanalib/zabbix.py
@@ -704,22 +704,6 @@ def zabbixTextTarget(application, group, host, item, text,
)
-@attr.s
-class ZabbixColor(object):
- color = attr.ib(validator=is_color_code)
- ... | [
"grafanalib/tests/test_zabbix.py::test_serialization_zabbix_trigger_panel"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 7b54a7ef0b29955b74b1c369fcca115dfee1e476a51555d222658b8db44fc8af | 7415e23d49de74addb6f6c172aae320be704fa32a08d45b885af7b49d5167668 | grafanalib/zabbix.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_f909d6519ed33fff24f8a3cd | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | `ZabbixTriggersPanel` fails with `NameError: name 'ZabbixColor' is not defined`
Trying to create a Zabbix triggers panel fails before I can generate any dashboard JSON. Minimal repro:
```python
import grafanalib.zabbix as Z
panel = Z.ZabbixTriggersPanel(
id=1,
title="Zabbix Triggers",
dataSource="Zabbix ... | diff --git a/grafanalib/zabbix.py b/grafanalib/zabbix.py
index 6784cc6..4aea049 100644
--- a/grafanalib/zabbix.py
+++ b/grafanalib/zabbix.py
@@ -704,6 +704,22 @@ def zabbixTextTarget(application, group, host, item, text,
)
+@attr.s
+class ZabbixColor(object):
+ color = attr.ib(validator=is_color_code)
+ ... | diff --git a/grafanalib/zabbix.py b/grafanalib/zabbix.py
index 4aea049..6784cc6 100644
--- a/grafanalib/zabbix.py
+++ b/grafanalib/zabbix.py
@@ -704,22 +704,6 @@ def zabbixTextTarget(application, group, host, item, text,
)
-@attr.s
-class ZabbixColor(object):
- color = attr.ib(validator=is_color_code)
- ... | [
"grafanalib/tests/test_zabbix.py::test_serialization_zabbix_trigger_panel"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 7b54a7ef0b29955b74b1c369fcca115dfee1e476a51555d222658b8db44fc8af | 3edbf60ffaca07b2ed27f837c0dd6dbc09bd08304d36909c8275707b488348d6 | grafanalib/zabbix.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_eb410e0b0a972082bf17d22b | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
Running `yamllint` at all (from the CLI or via `python -m yamllint`) crashes immediately, before linting anything. This happens for every invocation, even `yamllint --version`.
### Expected behavior
The CLI should run the linter normally.
### Actual behavior
The command exits with a traceback:
```... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 0498b74..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -144,7 +144,8 @@ def find_project_config_filepath(path='.'):
def run(argv=None):
- parser = argparse.ArgumentParser(prog=APP_NAME)
+ parser = argparse.ArgumentParser(prog=APP_NAME,
+ ... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..0498b74 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -144,8 +144,7 @@ def find_project_config_filepath(path='.'):
def run(argv=None):
- parser = argparse.ArgumentParser(prog=APP_NAME,
- description=APP_DES... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_github_actions_detection",
"tests/test_cl... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | ea5069ec1de71da0fd940691ef9c9d812dd7401cc031fd966135c2c8a12e6699 | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_4e3805c8294caf95d71803ea | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `--config-data` with inline YAML containing `:` is now parsed as an `extends` value
### Description
Passing inline YAML to `-d`/`--config-data` no longer works unless the value has no colon. Since almost any real config contains a colon, commands like this now fail:
```bash
yamllint -d 'rules: {trailing-spaces: d... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 195b670..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -12,7 +12,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import glob
import argparse
imp... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..195b670 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -12,6 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import glob
import argparse
imp... | [
"tests/test_cli.py::CommandLineTestCase::test_run_list_files",
"tests/test_cli.py::CommandLineTestCase::test_run_non_universal_newline",
"tests/test_cli.py::CommandLineTestCase::test_run_with_bad_config",
"tests/test_cli.py::CommandLineTestCase::test_run_with_empty_config",
"tests/test_cli.py::CommandLineTe... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | d8af9f205576ea7d957c1f36d72509bc8b12a85f7a76e54db80257e92aea4b43 | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_99e5bcfed8afac2aec513545 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `yamllint` crashes with a NameError during ordinary linting
Running yamllint on a YAML file raises `NameError: name 'os' is not defined` before producing lint results. The version command still works.
```sh
printf 'key: value\n' > warn.yaml
yamllint warn.yaml
```
Instead of reporting the usual missing-document-start... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 749b486..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -15,6 +15,7 @@
import argparse
import locale
+import os
import platform
import sys
@@ -176,7 +177,16 @@ def run(argv=None):
args = parser.parse_args(argv)
- user_global_config ... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..749b486 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -15,7 +15,6 @@
import argparse
import locale
-import os
import platform
import sys
@@ -177,16 +176,7 @@ def run(argv=None):
args = parser.parse_args(argv)
- if 'YAMLLINT_CONFIG... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_find_files_recursively",
"tests/test_cli.... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 9b5e2460634f88e899493367871fbb5860ed5df06b848cf84f1fcb36e1c1808c | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_f204ded0bcaa292b6a7052a8 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `yamllint -c` ignores the supplied config file and reads the user global config instead
### Description
When passing a config file with `-c/--config-file`, yamllint appears to ignore it and tries to load the user's global config (`~/.config/yamllint/config`) instead. On a machine where that global config does not exi... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 5dc9d9d..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,6 +130,19 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
+def find_project_config_filepath(path='.'):
+ for filename in ('.yamllint', '.yamllint.yaml... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..5dc9d9d 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,19 +130,6 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
-def find_project_config_filepath(path='.'):
- for filename in ('.yamllint', '.yamllint.yaml... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_run_with_config_file",
"tests/test_cli.py... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 8d845e39b23c6d78d11dfca09c8d87f82629586d4a1a103c346ff3626a6ea8f3 | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_e8a6e4b006f0b44277ef1b0e | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
It looks like `yamllint` silently ignores the first file or directory passed on the command line. When only a single path is given, nothing is linted at all: no output and exit status `0`, even for a file full of obvious errors.
### Expected behavior
The file should be linted and the problems reporte... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index d1c5c0f..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import argparse
+import locale
import os
import platform
import sys
@@ -24,7 +25,7 @@ from yamllint.li... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..d1c5c0f 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -14,7 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import argparse
-import locale
import os
import platform
import sys
@@ -25,7 +24,7 @@ from yamllint.li... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_find_files_recursively",
"tests/test_cli.... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 2b1adf23ccbc37b9d3d0dcbfba394605da168d60ef6f47b84d8a0c42f5557a2c | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_de9f44802ee3fb5c41583b03 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Running `yamllint` fails with `FileNotFoundError` whenever there is no config file in the current directory
### Description
Running `yamllint` on a normal file in a directory that does not contain a yamllint
config file now crashes before doing any linting. It looks like the presence of a
config file in the current w... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 3c6ca5b..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,6 +130,19 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
+def find_project_config_filepath(path='.'):
+ for filename in ('.yamllint', '.yamllint.yaml... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..3c6ca5b 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,19 +130,6 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
-def find_project_config_filepath(path='.'):
- for filename in ('.yamllint', '.yamllint.yaml... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_github_actions_detection",
"tests/test_cl... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 6378ab0375eef9d4fa7eecc9e8f2a42dc1dc5407a927a33651a290b1f22f5f6a | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_9d23367fe8ce3e02e073e218 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | # OpenTSDBTarget serialization fails with `AttributeError`
### Description
I’m trying to generate a dashboard containing an OpenTSDB target, but serializing it crashes. It looks like `OpenTSDBTarget.to_json_data()` is trying to access an attribute that isn’t available.
### Expected behavior
The dashboard should ser... | diff --git a/grafanalib/opentsdb.py b/grafanalib/opentsdb.py
index 26a2d12..955b7dc 100644
--- a/grafanalib/opentsdb.py
+++ b/grafanalib/opentsdb.py
@@ -1,6 +1,7 @@
"""Support for OpenTSDB."""
import attr
+from attr.validators import instance_of
from grafanalib.validators import is_in
# OpenTSDB aggregators
@@ ... | diff --git a/grafanalib/opentsdb.py b/grafanalib/opentsdb.py
index 955b7dc..26a2d12 100644
--- a/grafanalib/opentsdb.py
+++ b/grafanalib/opentsdb.py
@@ -1,7 +1,6 @@
"""Support for OpenTSDB."""
import attr
-from attr.validators import instance_of
from grafanalib.validators import is_in
# OpenTSDB aggregators
@@ ... | [
"grafanalib/tests/test_opentsdb.py::test_serialization_opentsdb_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 265dfc5fd881ac59d803a415881955792e67d5b6e99dfe039a1335c27ab08b0c | f38a6d3e59df8badd15873c7a06f9bf205175aa59ec336059d4bb801a963bada | grafanalib/opentsdb.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_f3dcdaaab96efaae18bff977 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | yamllint's error message for invalid rule config is misleading
When a yamllint config sets a rule to something that isn't valid, the message that gets raised claims the value "should be a dict":
```python
>>> from yamllint.config import YamlLintConfig
>>> YamlLintConfig('rules:\n colons: invalid\n')
Traceback (most ... | diff --git a/yamllint/config.py b/yamllint/config.py
index 30514cc..9ce6254 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -149,7 +149,7 @@ class YamlLintConfig:
def validate_rule_conf(rule, conf):
- if conf is False: # disable, or 'disable'
+ if conf is False: # disable
return False
... | diff --git a/yamllint/config.py b/yamllint/config.py
index 9ce6254..30514cc 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -149,7 +149,7 @@ class YamlLintConfig:
def validate_rule_conf(rule, conf):
- if conf is False: # disable
+ if conf is False: # disable, or 'disable'
return False
... | [
"tests/test_config.py::SimpleConfigTestCase::test_invalid_rule"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 9b9023e6fcf01f07ae7446ab3dd6ef1f28a86d97ba98ebbf661e9656ce014bb4 | ce35a932f385771f2cd901728d407fecd4586ecd303f3e3a64aa396cb9e68cb7 | yamllint/config.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_3cc6e9cc3a04465e6ef8d1bd | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `yamllint -c` fails to find config file and directory config discovery broken
### Description
Two configuration behaviors appear to be broken:
1. Passing a config file with `-c/--config-file` no longer works. Even when the file exists, yamllint fails with a `FileNotFoundError` that mentions a path starting with `exte... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index d53e10c..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,6 +130,19 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
+def find_project_config_filepath(path='.'):
+ for filename in ('.yamllint', '.yamllint.yaml... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..d53e10c 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,19 +130,6 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
-def find_project_config_filepath(path='.'):
- for filename in ('.yamllint', '.yamllint.yaml... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_run_with_config_file"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 67c56b617d4e864eed60b29a1d628b00c142416daab00d26bed537c7b6a46640 | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_a8880b235bcf5392d93be081 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **Project `.yamllint` config file is silently ignored**
### Description
yamllint no longer picks up the project configuration file (`.yamllint`,
`.yamllint.yaml` or `.yamllint.yml`) located in the current directory (or any
of its parents). Running the CLI from inside a project that has a local config
now just uses th... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 720d7b3..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,6 +130,19 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
+def find_project_config_filepath(path='.'):
+ for filename in ('.yamllint', '.yamllint.yaml... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..720d7b3 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,19 +130,6 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
-def find_project_config_filepath(path='.'):
- for filename in ('.yamllint', '.yamllint.yaml... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_config.py::IgnoreConfigTestCase::test_run_with_ignore_from_file",
"tests/te... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 6a1d5ce924b1fbe24caa7c6cb64309fd1f19b5d48f8e8cef8e0383c8e24ded67 | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_4f6e5d2d5f074e414c1552d9 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### yamllint ignores project config in parent directories
When running yamllint from a subdirectory, it no longer discovers a project-level `.yamllint` file in a parent directory. It looks like only `.yamllint` in the current working directory is used now; `.yamllint.yaml` and `.yamllint.yml` are also ignored.
### St... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 5a80d37..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,6 +130,19 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
+def find_project_config_filepath(path='.'):
+ for filename in ('.yamllint', '.yamllint.yaml... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..5a80d37 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -130,19 +130,6 @@ def show_problems(problems, file, args_format, no_warn):
return max_level
-def find_project_config_filepath(path='.'):
- for filename in ('.yamllint', '.yamllint.yaml... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 055642517f19636960d7c70ef27be565178c1c035b84705df08b535da1f0249d | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_1580cdeb2f5b594a5f441f7b | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `yamllint` raises a TypeError while reporting file or stdin results
Linting a file fails instead of printing the normal diagnostics:
```sh
printf 'key: value \n' > example.yaml
yamllint example.yaml
```
The command raises:
```text
TypeError: show_problems() got an unexpected keyword argument 'no_warn'
```
Reading... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 18226e7..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -88,7 +88,7 @@ class Format:
return line
-def show_problems(problems, file, args_format, stdout):
+def show_problems(problems, file, args_format, no_warn):
max_level = 0
fir... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..18226e7 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -88,7 +88,7 @@ class Format:
return line
-def show_problems(problems, file, args_format, no_warn):
+def show_problems(problems, file, args_format, stdout):
max_level = 0
fir... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_github_actions_detection",
"tests/test_cl... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | c285ec11476f0769a69e8c6a2378daf49128ff9db961bb3f6a9ccac4fa6107e4 | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_a13d46568cd3a9a0c0f559d9 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **`ignore` / `ignore-from-file` crash with `NameError`, and `yaml-files` is silently ignored**
### Description
After the latest changes, using any of the ignore-related configuration options causes yamllint to crash instead of ignoring files. Separately, the `yaml-files` option no longer seems to have any effect at a... | diff --git a/yamllint/config.py b/yamllint/config.py
index 1913863..9ce6254 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -16,6 +16,7 @@
import fileinput
import os.path
+import pathspec
import yaml
import yamllint.rules
@@ -31,6 +32,8 @@ class YamlLintConfig:
self.ignore = None
+ ... | diff --git a/yamllint/config.py b/yamllint/config.py
index 9ce6254..1913863 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -16,7 +16,6 @@
import fileinput
import os.path
-import pathspec
import yaml
import yamllint.rules
@@ -32,8 +31,6 @@ class YamlLintConfig:
self.ignore = None
- ... | [
"tests/test_cli.py::CommandLineTestCase::test_find_files_recursively",
"tests/test_cli.py::CommandLineTestCase::test_run_list_files",
"tests/test_config.py::ExtendedConfigTestCase::test_extended_ignore_list",
"tests/test_config.py::ExtendedConfigTestCase::test_extended_ignore_str",
"tests/test_config.py::Ig... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 9b9023e6fcf01f07ae7446ab3dd6ef1f28a86d97ba98ebbf661e9656ce014bb4 | e93c259a3538f0712fa8a4fdeb83aafcba1ad43fda4509d859d214103617d89a | yamllint/config.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_182105d67fbbfc4f275c8ea0 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | User-global configuration is ignored
In a directory with no project configuration, yamllint no longer applies a user-global config selected through `YAMLLINT_CONFIG_FILE`, `XDG_CONFIG_HOME/yamllint/config`, or the default `~/.config/yamllint/config` location. For example, from a directory without a project config:
``... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 659920c..9a39bd8 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import argparse
+import locale
import os
import platform
import sys
@@ -176,6 +177,16 @@ def run(argv=... | diff --git a/yamllint/cli.py b/yamllint/cli.py
index 9a39bd8..659920c 100644
--- a/yamllint/cli.py
+++ b/yamllint/cli.py
@@ -14,7 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import argparse
-import locale
import os
import platform
import sys
@@ -177,16 +176,6 @@ def run(argv=... | [
"tests/test_cli.py::CommandLineTestCase::test_run_with_locale",
"tests/test_cli.py::CommandLineTestCase::test_run_with_user_global_config_file",
"tests/test_cli.py::CommandLineTestCase::test_run_with_user_xdg_config_home_in_env",
"tests/test_cli.py::CommandLineTestCase::test_run_with_user_yamllint_config_file... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 44a0bac82812d4360a31ba287e755a620510fb8dc2b109766c4d356002066810 | 93ec77edba252181edb7e6aeb43a217047d2f470a4170487a7255baedd7f5750 | yamllint/cli.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_74f0a123c8dfa9b48fd8afb6 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `yaml-files` is ignored and `.yamllint` is excluded from default directory linting
Custom `yaml-files` patterns no longer affect file selection, and invalid values are accepted. The `.yamllint` file itself is also skipped by default. In a fresh directory:
```sh
printf 'extends: default\n' > .yamllint
printf 'key: val... | diff --git a/yamllint/config.py b/yamllint/config.py
index a6eddca..9ce6254 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -32,8 +32,8 @@ class YamlLintConfig:
self.ignore = None
- self.yaml_files = pathspec.PathSpec.from_lines('gitwildmatch',
- ... | diff --git a/yamllint/config.py b/yamllint/config.py
index 9ce6254..a6eddca 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -32,8 +32,8 @@ class YamlLintConfig:
self.ignore = None
- self.yaml_files = pathspec.PathSpec.from_lines(
- 'gitwildmatch', ['*.yaml', '*.yml', '.yamllin... | [
"tests/test_cli.py::CommandLineTestCase::test_find_files_recursively",
"tests/test_cli.py::CommandLineTestCase::test_run_list_files",
"tests/test_config.py::IgnoreConfigTestCase::test_run_with_ignore_from_file",
"tests/test_config.py::IgnoreConfigTestCase::test_run_with_ignore_list",
"tests/test_config.py::... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 9b9023e6fcf01f07ae7446ab3dd6ef1f28a86d97ba98ebbf661e9656ce014bb4 | aaeb17358499902b34e348e4a5a3c5dcc6ec645615c2edd8f7935902a59817e3 | yamllint/config.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_7d6edcbb51988c1282b5e8d0 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
Setting the top-level `locale` option in a config no longer has any effect, and invalid values for it are silently accepted.
### Steps to Reproduce
Create `en.yaml`:
```yaml
a: true
A: true
```
Run yamllint with an explicit locale:
```console
$ yamllint -d 'locale: en_US.UTF-8
rules: {key-ordering: ... | diff --git a/yamllint/config.py b/yamllint/config.py
index b12aede..9ce6254 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -132,6 +132,12 @@ class YamlLintConfig:
self.yaml_files = pathspec.PathSpec.from_lines('gitwildmatch',
conf['ya... | diff --git a/yamllint/config.py b/yamllint/config.py
index 9ce6254..b12aede 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -132,12 +132,6 @@ class YamlLintConfig:
self.yaml_files = pathspec.PathSpec.from_lines('gitwildmatch',
conf['ya... | [
"tests/test_cli.py::CommandLineTestCase::test_run_with_locale",
"tests/test_config.py::SimpleConfigTestCase::test_invalid_locale"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 9b9023e6fcf01f07ae7446ab3dd6ef1f28a86d97ba98ebbf661e9656ce014bb4 | 69289f21e8d73a11e0bc1632b1c22bdedee28092f36fa3ab34fafe63cda41892 | yamllint/config.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_e80e1485eb2343c305fb1786 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `ignore-from-file` rejects a single filename string
A plain filename string is no longer accepted for `ignore-from-file`, although the equivalent one-element list is accepted when the referenced file exists. Create the referenced ignore file:
```sh
printf '*.template.yaml\n' > .gitignore
```
Then load the config:
`... | diff --git a/yamllint/config.py b/yamllint/config.py
index edd4b6b..9ce6254 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -15,7 +15,6 @@
import fileinput
import os.path
-import re
import pathspec
import yaml
@@ -98,13 +97,18 @@ class YamlLintConfig:
except Exception as e:
... | diff --git a/yamllint/config.py b/yamllint/config.py
index 9ce6254..edd4b6b 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -15,6 +15,7 @@
import fileinput
import os.path
+import re
import pathspec
import yaml
@@ -97,18 +98,13 @@ class YamlLintConfig:
except Exception as e:
... | [
"tests/test_config.py::IgnoreConfigTestCase::test_ignore_from_file_not_exist",
"tests/test_config.py::IgnoreConfigTestCase::test_run_with_ignore_from_file"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 9b9023e6fcf01f07ae7446ab3dd6ef1f28a86d97ba98ebbf661e9656ce014bb4 | 8a66a17ab822b02df23141763d8bd5806a28dbd02ee47b80bf4b49a27592f105 | yamllint/config.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_6cb2d304ab28b4f12e08c461 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `ignore-from-file` lists fail and invalid values lose configuration validation
A valid list of filenames no longer works for top-level `ignore-from-file`. With an existing `.gitignore`, this config causes linting to fail:
```yaml
extends: default
ignore-from-file:
- .gitignore
```
The error is:
```text
TypeError:... | diff --git a/yamllint/config.py b/yamllint/config.py
index 0a6dc95..9ce6254 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -102,7 +102,13 @@ class YamlLintConfig:
'invalid config: ignore and ignore-from-file keys cannot be '
'used together')
elif 'ignore-from-file... | diff --git a/yamllint/config.py b/yamllint/config.py
index 9ce6254..0a6dc95 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -102,13 +102,7 @@ class YamlLintConfig:
'invalid config: ignore and ignore-from-file keys cannot be '
'used together')
elif 'ignore-from-file... | [
"tests/test_config.py::IgnoreConfigTestCase::test_ignore_from_file_incorrect_type",
"tests/test_config.py::IgnoreConfigTestCase::test_run_with_ignored_from_file",
"tests/test_config.py::SimpleConfigTestCase::test_invalid_rule_ignore_from_file"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 9b9023e6fcf01f07ae7446ab3dd6ef1f28a86d97ba98ebbf661e9656ce014bb4 | b2bfe3a3852e68bc2ddf1103fecdb24c73af2ef768941124013902fbe8d0376e | yamllint/config.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_39c3591ad9268983c5b0d96f | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Loading an extended configuration raises a NameError
Resolving a configuration that uses `extends`, including the bundled default, raises an exception before linting can begin.
```python
from yamllint.config import YamlLintConfig
YamlLintConfig('extends: default\n')
```
The call raises:
```text
NameError: name 'os... | diff --git a/yamllint/config.py b/yamllint/config.py
index 438cac4..9ce6254 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -13,6 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import fileinput
+import... | diff --git a/yamllint/config.py b/yamllint/config.py
index 9ce6254..438cac4 100644
--- a/yamllint/config.py
+++ b/yamllint/config.py
@@ -13,8 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import fileinput
-import... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows_imbrication",
"tests/... | 9b9023e6fcf01f07ae7446ab3dd6ef1f28a86d97ba98ebbf661e9656ce014bb4 | 2f58cd1aa468aaca7542e994c767916e65c7a397df9499cf852af1d70c3473b9 | yamllint/config.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_9b9f43a7e4a64b7c3aa0849d | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `yamllint` fails with TypeError for normal CLI and Python API inputs
The CLI crashes instead of linting an ordinary YAML document:
```sh
printf -- '---\nkey: value\n' > example.yaml
yamllint example.yaml
```
It raises:
```text
TypeError: run() takes 2 positional arguments but 3 were given
```
The public Python API... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index 971828c..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -214,7 +214,17 @@ def _run(buffer, conf, filepath):
yield syntax_error
-def run(buffer, conf):
+def run(input, conf, filepath=None):
+ """Lints a YAML source.
+
+ Re... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..971828c 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -214,17 +214,7 @@ def _run(buffer, conf, filepath):
yield syntax_error
-def run(input, conf, filepath=None):
- """Lints a YAML source.
-
- Returns a generator of Lin... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows_imbrication",
"tests/... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | e193d5552823e39a115566f01779b38c72e062298e66b188f3486b066ab4449f | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_eb1250e5dac736f09c043fa4 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
Syntax errors reported by yamllint no longer carry the `(syntax)` label in their output. Other problems continue to show the offending rule name in parentheses (e.g. `(trailing-spaces)`), but syntax errors now appear bare, which is inconsistent and makes it harder to parse/filter output.
### Expected b... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index f0b96de..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -15,7 +15,6 @@
import io
import re
-import sys
import yaml
@@ -180,7 +179,7 @@ def get_syntax_error(buffer):
except yaml.error.MarkedYAMLError as e:
problem = Li... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..f0b96de 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -15,6 +15,7 @@
import io
import re
+import sys
import yaml
@@ -179,7 +180,7 @@ def get_syntax_error(buffer):
except yaml.error.MarkedYAMLError as e:
problem = Li... | [
"tests/test_cli.py::CommandLineTestCase::test_run_read_from_stdin"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | b5511cb298d0cd4b4f8ed63d2c81bba7e8a2c0e3a22cf5114f58ed9fdd7f960d | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_517e7a6b7bb394d35391aff5 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `linter.run` no longer accepts `bytes` input
### Description
Passing a `bytes` object to `yamllint.linter.run` used to work fine, but now it raises a `TypeError`. Since a lot of code (and the CLI itself, for that matter) reads YAML from files in binary mode, this is quite a regression.
### Expected behavior
Bytes c... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index c0f08b0..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import io
import re
... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..c0f08b0 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import io
import re
... | [
"tests/test_linter.py::LinterTestCase::test_run_on_bytes",
"tests/test_linter.py::LinterTestCase::test_run_on_non_ascii_chars"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | 69c120f775194ff712b4a716394f447c376b36b2fb3e3b9661f7586d3afe94c3 | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_d29c7eaf7a31938661f84fc4 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Title: yamllint crashes instead of reporting lint problems
When yamllint finds any issue in a YAML file, it now crashes while trying to print the problem. It seems to happen for every rule I tried. Reproduce with:
```console
$ printf -- '---\nfoo: bar \n' > /tmp/trailing.yaml
$ yamllint -d '{rules: {trailing-spaces... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a5acd70..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -34,27 +34,35 @@ ENABLE_RULE_PATTERN = re.compile(r'^# yamllint enable( rule:\S+)*\s*$')
class LintProblem:
- """Represents a linting problem found by yamllint.
-
- .. versi... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..a5acd70 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -34,35 +34,27 @@ ENABLE_RULE_PATTERN = re.compile(r'^# yamllint enable( rule:\S+)*\s*$')
class LintProblem:
- """Represents a linting problem found by yamllint."""
+ """Repr... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/t... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_brackets.py::ColonTestCase::test_disabled",
"tests/rules/test_colons.py::ColonTestCase::test_after_do_not_confound_with_trailing_space",
"tests/rules/test_colons.py::C... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | a22bfabc5e8bb9b6a5c3b20e04d9c9576ad60607510aa16a674d3d64fbf9c210 | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_8165320fa361781264181f94 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
Running `yamllint` on any YAML file that contains a comment now crashes with an `AttributeError` instead of reporting lint problems. It seems to happen regardless of rules configuration — as soon as a `#` comment is present, the linter blows up while walking over the file.
### Expected behavior
`yaml... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index 8b4c7a8..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -17,6 +17,7 @@ import io
import re
import yaml
+
from yamllint import parser
PROBLEM_LEVELS = {
@@ -82,7 +83,7 @@ def get_cosmetic_problems(buffer, conf, filepath):
... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..8b4c7a8 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -17,7 +17,6 @@ import io
import re
import yaml
-
from yamllint import parser
PROBLEM_LEVELS = {
@@ -83,7 +82,7 @@ def get_cosmetic_problems(buffer, conf, filepath):
... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_brackets.py::ColonTestCase::test_forbid",
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_disabled",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comm... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | 4e3b5012d56ca0969033e697fc76e8df3dd66df5270648ff6ddbb224132c7c82 | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_25a40062b492eed87298d74e | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **yamllint crashes with `KeyError: 2` instead of reporting a syntax error**
### Description
When the YAML being linted contains a syntax error, yamllint doesn't print the usual `[error] syntax error: ...` line anymore. Instead it crashes with a `KeyError`. I ran into this piping a file into `yamllint -`, but I suspec... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index 2a537f3..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -21,7 +21,10 @@ import yaml
from yamllint import parser
PROBLEM_LEVELS = {
+ 0: None,
1: 'warning',
+ 2: 'error',
+ None: 0,
'warning': 1,
'error': 2,
}
@@... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..2a537f3 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -21,10 +21,7 @@ import yaml
from yamllint import parser
PROBLEM_LEVELS = {
- 0: None,
1: 'warning',
- 2: 'error',
- None: 0,
'warning': 1,
'error': 2,
}
@@... | [
"tests/test_cli.py::CommandLineTestCase::test_run_read_from_stdin"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | 011afd7e6882d68d17d8a28af84d0aa89b504b3653247b693e8488cad9d95521 | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_b409f771c0ab12b6308d528e | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **Title:** yamllint crashes on any YAML file with `AttributeError: module 'yamllint.parser' has no attribute 'token_generator'`
Running `yamllint` on any YAML file now fails immediately with an `AttributeError` instead of linting the file:
```
$ cat > test.yaml <<'EOF'
---
foo: bar
EOF
$ yamllint test.yaml
Traceback ... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index b0bd06d..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -129,7 +129,7 @@ def get_cosmetic_problems(buffer, conf, filepath):
disabled_for_line = DisableLineDirective()
disabled_for_next_line = DisableLineDirective()
- for elem... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..b0bd06d 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -129,7 +129,7 @@ def get_cosmetic_problems(buffer, conf, filepath):
disabled_for_line = DisableLineDirective()
disabled_for_next_line = DisableLineDirective()
- for elem... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows_imbrication",
"tests/... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | ff8621cfd75a9fad5c6ca55df89e64d416fc79388c1c783434b49823b4f7c1c3 | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_92f013edcd00b3b13032b123 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Syntax errors are duplicated and lost their `(syntax)` marker
When a syntax error occurs at the same position as another lint problem, yamllint now prints the syntax error more than once and also prints the other problem. The `(syntax)` marker is missing from syntax error messages too.
### Steps to Reproduce
Create ... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index d2b2ab1..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -179,7 +179,7 @@ def get_syntax_error(buffer):
except yaml.error.MarkedYAMLError as e:
problem = LintProblem(e.problem_mark.line + 1,
e.pro... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..d2b2ab1 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -179,7 +179,7 @@ def get_syntax_error(buffer):
except yaml.error.MarkedYAMLError as e:
problem = LintProblem(e.problem_mark.line + 1,
e.pro... | [
"tests/rules/test_document_start.py::DocumentStartTestCase::test_multiple_documents",
"tests/rules/test_indentation.py::IndentationTestCase::test_nested_collections",
"tests/rules/test_indentation.py::IndentationTestCase::test_return",
"tests/rules/test_indentation.py::IndentationTestCase::test_under_indented... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | f1e6d106b66cbce295cf9c7621049ae6829e4099e74a07d7a5734e163b80df8b | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_e2a2a7be8c2629faecf1edf9 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Title: `indentation` rule emits spurious errors and `anchors` rule crashes with `KeyError: 'anchors'`
### Description
When linting nested YAML, yamllint reports a huge number of false `wrong indentation` problems on perfectly valid YAML. Some files also crash outright with `KeyError: 'anchors'` or `TypeError: '<' not... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index 2ec0183..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -15,6 +15,7 @@
import io
import re
+
import yaml
from yamllint import parser
@@ -72,6 +73,10 @@ def get_cosmetic_problems(buffer, conf, filepath):
comment_rules = [r for r... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..2ec0183 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -15,7 +15,6 @@
import io
import re
-
import yaml
from yamllint import parser
@@ -73,10 +72,6 @@ def get_cosmetic_problems(buffer, conf, filepath):
comment_rules = [r for r... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_dos_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_first_line",
"tests/rules/test_comments.py::CommentsTestCase::test_last_lin... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | 820bade769f34142b601ecf7ee84a9dfbbeab507b592c17181656e067dd769db | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_750922df4b82009f99b9365e | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Comments rule misclassifies inline comments
When linting comments, comments seem to be classified incorrectly. Inline comments are no longer checked for `min-spaces-from-content`, and comments on the first line are reported as if they were inline.
### Steps to reproduce
With this config:
```yaml
# .yamllint
rul... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 33d590d..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -64,9 +64,10 @@ class Comment:
def is_inline(self):
return (
- self.token_before.end_mark.line == self.line_no - 1 and
- self.token_before.end_mar... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..33d590d 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -64,10 +64,9 @@ class Comment:
def is_inline(self):
return (
- not isinstance(self.token_before, yaml.StreamStartToken) and
- self.line_no == self... | [
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_first_line",
"tests/rules/test_comments.py::CommentsTestCase::test_ignore_shebang",
"tests/rules/test_comments.py::CommentsTestCase::test_last_line",
"tests/rules/test_comments.py::CommentsTest... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | 37441a029ddb3b013790d0667beb613438e0e0dff8dfe950a842f1bf36d32335 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_33840f500a6df5eedd8dd175 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### yamllint crashes when explicitly linting a file matched by `ignore`
### Description
When a YAML file is excluded using the `ignore` configuration, running `yamllint` directly on that file crashes instead of skipping it. Linting a directory that contains the same ignored file works as expected.
### Expected behavi... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index 47d1c62..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -6,7 +6,6 @@
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
-# This program is distributed in the hope that it will be use... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..47d1c62 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -6,6 +6,7 @@
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
+# This program is distributed in the hope that it will be use... | [
"tests/test_config.py::IgnoreConfigTestCase::test_run_with_ignore_on_ignored_file"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | 69c31d23fabdaf9ac8b1e065de588999d29ffa129a77385730f5f9d0c26a100d | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_7c07218e8fae6d54163c38e6 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Running `yamllint` on any file that triggers a lint problem crashes with `AttributeError`
### Description
Running the `yamllint` command-line tool on a file that produces at least one lint problem crashes with an `AttributeError`. Files that are completely clean lint fine, so this only shows up once there's something... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index f7fa87b..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -17,6 +17,7 @@ import io
import re
import yaml
+
from yamllint import parser
PROBLEM_LEVELS = {
@@ -43,6 +44,7 @@ class LintProblem:
self.desc = desc
#: Ident... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..f7fa87b 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -17,7 +17,6 @@ import io
import re
import yaml
-
from yamllint import parser
PROBLEM_LEVELS = {
@@ -44,7 +43,6 @@ class LintProblem:
self.desc = desc
#: Ident... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_github_actions_detection",
"tests/test_cl... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | 7ee3fe3f2e7d942f4ca6d6ebbd25d09140d8bb3d09d37e450538fc4761520a79 | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_88061178e97635329015aa1d | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `comments` rule reports standalone comments as inline
Standalone comments are being reported as if they were inline comments. A comment on the first line of a file now gets a `too few spaces before comment` error even though there is no content before it. For example, with `test.yaml`:
```yaml
# This is a header comm... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f23e30f..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -64,7 +64,10 @@ class Comment:
def is_inline(self):
return (
- self.line_no == self.token_before.end_mark.line + 1
+ not isinstance(self.token_bef... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..f23e30f 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -64,10 +64,7 @@ class Comment:
def is_inline(self):
return (
- not isinstance(self.token_before, yaml.StreamStartToken) and
- self.line_no == self... | [
"tests/rules/test_comments.py::CommentsTestCase::test_first_line",
"tests/rules/test_comments.py::CommentsTestCase::test_ignore_shebang",
"tests/rules/test_comments.py::CommentsTestCase::test_last_line",
"tests/rules/test_comments.py::CommentsTestCase::test_multi_line_scalar",
"tests/rules/test_comments.py:... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | ad7b2e6068d50e5c47dbea4fa2517068f811c807750fa83851c205e7af2fff9b | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_831617dfb1efd95baf382b3d | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
Linting a file that starts with a comment now crashes with an `UnboundLocalError`. A single first-line comment is enough to trigger it.
### Expected behavior
yamllint should parse the file and report lint problems (or nothing if the file is clean).
### Actual behavior
It raises:
```
Traceback (most re... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 5c52396..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -56,6 +56,12 @@ class Comment:
return self.buffer[self.pointer:end]
return self.buffer[self.pointer:]
+ def __eq__(self, other):
+ return (isinstance(... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..5c52396 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -56,12 +56,6 @@ class Comment:
return self.buffer[self.pointer:end]
return self.buffer[self.pointer:]
- def __eq__(self, other):
- return (isinstance(... | [
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_disabled",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment",
"tests/rules/test_comments.py::CommentsTestCase::test_first_line",
"tests/rules/test_comments.py::CommentsTestCa... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | 48cb5fbc1d71c913e6ca283ecc687471fd81ed7684eebf8e549711d3f4f020c3 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_42080f2a7b51a648641d474b | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | # `yamllint` crashes with `NameError` on every file
### Description
After pulling the latest changes, running `yamllint` on **any** YAML file (even an empty one) crashes immediately instead of reporting lint problems.
### Expected behavior
The linter runs normally and prints any style problems, or nothing if the fi... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index d1e549b..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import io
+import re
import yaml
@@ -28,6 +29,8 @@ PROBLEM_LEVELS = {
'error': 2,
... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..d1e549b 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -14,7 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import io
-import re
import yaml
@@ -29,8 +28,6 @@ PROBLEM_LEVELS = {
'error': 2,
... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows_imbrication",
"tests/... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | ca2503087f20ae7c4f6f7f7c1ca421f99b1dfb87b2a93e9d327cf662ee06770b | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_2308c04c74ac7e2715b24050 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
Running `yamllint` on any YAML file currently crashes with an `AttributeError` instead of linting the file. With token rules enabled, the linter fails before it can report anything.
### Expected behavior
`yamllint` should lint the file normally and report rule violations (or exit quietly if there are... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 0fa39aa..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -34,6 +34,7 @@ class Token:
self.curr = curr
self.prev = prev
self.next = next
+ self.nextnext = nextnext
class Comment:
@@ -126,7 +127,8 @@ def ... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..0fa39aa 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -34,7 +34,6 @@ class Token:
self.curr = curr
self.prev = prev
self.next = next
- self.nextnext = nextnext
class Comment:
@@ -127,8 +126,7 @@ def ... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/test_cli.py::CommandLineTestCase::test_find_files_recursively",
"tests/test_cli.py::CommandLineTestCase::test_run_list_files",
"tests/test_cli.py::CommandLineTestCase::test_run_non_existing_file",
"tests/test_cli.py::CommandLineTestC... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | 40ad48c79ee9c476b5fc474262af1f32a8a342a6c79d049cf4df00117c9dbd54 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_bc0e87d42d4576b11ce29282 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **yamllint crashes with `TypeError: 'BaseLoader' object is not iterable` on every file**
### Description
After updating to the latest version, yamllint no longer works. Running it on any YAML input immediately raises a `TypeError` instead of linting the file. The same happens when using the Python API.
### Expected ... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 6fd19af..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -122,7 +122,11 @@ def comments_between_tokens(token1, token2):
def token_or_comment_generator(buffer):
yaml_loader = yaml.BaseLoader(buffer)
- for curr in yaml_loader:
+ ... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..6fd19af 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -122,11 +122,7 @@ def comments_between_tokens(token1, token2):
def token_or_comment_generator(buffer):
yaml_loader = yaml.BaseLoader(buffer)
- try:
- prev = None
- ... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/test_cli.py::CommandLineTestCase::test_find_files_recursively",
"tests/test_cli.py::CommandLineTestCase::test_run_list_files",
"tests/test_cli.py::CommandLineTestCase::test_run_non_existing_file",
"tests/test_cli.py::CommandLineTestC... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | 20fc41d8aa628356d862468cfd58765bff5348be0594cf7bf5c2f58eb720fd90 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_c4e62ed77f231dc917567f68 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | # `comments-indentation` reports one problem per line for consecutive misindented comments
When several consecutive comment lines share the same (incorrect) indentation, the `comments-indentation` rule now emits a problem for *every* line in the block instead of a single one for the comment group. This makes the outpu... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 7e2c90b..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -39,14 +39,14 @@ class Token:
class Comment:
def __init__(self, line_no, column_no, buffer, pointer,
- token_before=None, token_after=None):
+ t... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..7e2c90b 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -39,14 +39,14 @@ class Token:
class Comment:
def __init__(self, line_no, column_no, buffer, pointer,
- token_before=None, token_after=None, comment_before=None)... | [
"tests/rules/test_comments_indentation.py::CommentsIndentationTestCase::test_enabled"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | d02cc63d74dbe574745ee7039ecc189fd12d79c4be5902da50cc27214cfc68d3 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_d1d8988305b04892df75911d | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `comments-indentation` crashes on any YAML file containing comments
### Description
Running `yamllint` on a YAML file with comments now crashes instead of returning lint results. This appears to happen with the default configuration since `comments-indentation` is enabled by default.
### Expected behavior
`yamll... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 5ae3c7a..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -39,13 +39,14 @@ class Token:
class Comment:
def __init__(self, line_no, column_no, buffer, pointer,
- token_before=None, token_after=None):
+ t... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..5ae3c7a 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -39,14 +39,13 @@ class Token:
class Comment:
def __init__(self, line_no, column_no, buffer, pointer,
- token_before=None, token_after=None, comment_before=None)... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_brackets.py::ColonTestCase::test_forbid",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | a912dbef5e5ac0a44be9d5a062881d693fee0879b874e62515060f28a0554405 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_b700986ee5b4e9a5bdcbff22 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `truthy` rule no longer recognized, causing yamllint to fail with an invalid config error
### Description
After updating, yamllint fails on even a simple YAML file with:
```
yamllint.config.YamlLintConfigError: invalid config: no such rule: "truthy"
```
This happens with an explicit `truthy` configuration as well:
... | diff --git a/yamllint/rules/__init__.py b/yamllint/rules/__init__.py
index 70a9a9b..815d4bc 100644
--- a/yamllint/rules/__init__.py
+++ b/yamllint/rules/__init__.py
@@ -36,6 +36,7 @@ from yamllint.rules import (
octal_values,
quoted_strings,
trailing_spaces,
+ truthy,
)
_RULES = {
@@ -61,6 +62,7 @... | diff --git a/yamllint/rules/__init__.py b/yamllint/rules/__init__.py
index 815d4bc..70a9a9b 100644
--- a/yamllint/rules/__init__.py
+++ b/yamllint/rules/__init__.py
@@ -36,7 +36,6 @@ from yamllint.rules import (
octal_values,
quoted_strings,
trailing_spaces,
- truthy,
)
_RULES = {
@@ -62,7 +61,6 @... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows_imbrication",
"tests/... | 9189366e6c5b7edf1cb7dc386482a1583cf23de9b35bc29ab4b220de1cf644af | fffca2ca9ea4be6969162d2433c138ba316dfb48f0f6328839a18c693c0a5eda | yamllint/rules/__init__.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_c6f23a677c089fdc0f1c0d64 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **yamllint crashes with `AttributeError` on any YAML document containing a comment**
### Description
Running yamllint on a file that contains a `#` comment crashes with an `AttributeError` instead of linting the file.
### Expected behavior
The file is linted and the usual problems are reported (or nothing, if the f... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index e7cfcb3..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -38,15 +38,15 @@ class Token:
class Comment:
- def __init__(self, line_no, column_no, buffer, pointer, token_before):
+ def __init__(self, line_no, column_no, buffer, pointe... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..e7cfcb3 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -38,15 +38,15 @@ class Token:
class Comment:
- def __init__(self, line_no, column_no, buffer, pointer,
- token_before=None, token_after=None, comment_before=Non... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_brackets.py::ColonTestCase::test_forbid",
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_disabled",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comm... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | f6f39bfe42dbafee795a14b9e7cfbf5406524945d1570fd538aadc26a73ff454 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_5747e887532a4ddc438d84e5 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | # Newline handling is broken — every file reports "wrong new line character"
### Description
After updating to the latest version, yamllint now reports spurious new-line errors on files that are perfectly valid YAML. It looks like the line terminator is being included in the line content, so lines can be flagged as ha... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 5e0d961..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -13,12 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-
-RE_ANSI_ES... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..5e0d961 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -13,6 +13,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import re
+
+RE_ANSI_ES... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_comments_indentation.py::CommentsIndentationTestCase::test_no_newline_at_end",
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_empty_lines.py::EmptyLinesTestCase::test_disabled",
"tests/rules/test_empty_lines.py::EmptyLinesTestCase::test_empty_document",... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | cb25921be3e31def078a31d4c05c6f67dcd80052a51a643bc368929132bd63ae | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_097ac73c9b2809c65a714d08 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Description
When linting a YAML file from the command line or passing a file stream through the Python API, `yamllint` now crashes with an internal `AssertionError` instead of reporting lint problems.
### Expected behavior
Linting a file should print the usual report and exit with the appropriate status code:
`... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index 90d98a7..a2faa06 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -22,6 +22,9 @@ from yamllint import parser
PROBLEM_LEVELS = {
0: None,
+ 1: 'warning',
+ 2: 'error',
+ None: 0,
'warning': 1,
'error': 2,
}
@@ -41,6 +44,7 @... | diff --git a/yamllint/linter.py b/yamllint/linter.py
index a2faa06..90d98a7 100644
--- a/yamllint/linter.py
+++ b/yamllint/linter.py
@@ -22,9 +22,6 @@ from yamllint import parser
PROBLEM_LEVELS = {
0: None,
- 1: 'warning',
- 2: 'error',
- None: 0,
'warning': 1,
'error': 2,
}
@@ -44,7 +41,6 @... | [
"tests/test_cli.py::CommandLineConfigTestCase::test_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_multiple_parent_config_file",
"tests/test_cli.py::CommandLineConfigTestCase::test_parent_config_file",
"tests/test_cli.py::CommandLineTestCase::test_github_actions_detection",
"tests/test_cl... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | b2944efb491fc2e843395736f90cc185b4df3ded3c5f6e4ce7daa18f9a672adb | dc27048ceaeeced920c76597c1704f499414ef7003ad0c5022c0c80c8b3c5487 | yamllint/linter.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_8a9e431c6d5a4dc6b1306997 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | # yamllint crashes while parsing any YAML: `AttributeError: 'NoneType' object has no attribute 'start_mark'`
### Description
Running yamllint on a regular YAML file now crashes while tokenizing the document.
### Expected behavior
Valid YAML should be linted normally, e.g. no output or the usual lint report.
### Ac... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index 024002a..f0ee3a6 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -87,6 +87,38 @@ def line_generator(buffer):
yield Line(line_no, buffer, start=cur, end=len(buffer))
+def comments_between_tokens(token1, token2):
+ """Find all comments bet... | diff --git a/yamllint/parser.py b/yamllint/parser.py
index f0ee3a6..024002a 100644
--- a/yamllint/parser.py
+++ b/yamllint/parser.py
@@ -87,38 +87,6 @@ def line_generator(buffer):
yield Line(line_no, buffer, start=cur, end=len(buffer))
-def comments_between_tokens(token1, token2):
- """Find all comments bet... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/test_cli.py::CommandLineTestCase::test_find_files_recursively",
"tests/test_cli.py::CommandLineTestCase::test_run_list_files",
"tests/test_cli.py::CommandLineTestCase::test_run_non_existing_file",
"tests/test_cli.py::CommandLineTestC... | bf463800fd6b074c74632ebe228e8b3c406b1878b2fab876177765ea67629bcc | f02d6ce0b6e60bd9bd8be2beb558d2269e40d1cb22f809c459399a9439b4f7f7 | yamllint/parser.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_291f84159e3cba5bc484c86d | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `anchors` rule crashes with `KeyError` when `forbid-unused-anchors` is enabled
### Description
When the `anchors` rule is configured with `forbid-unused-anchors: true`, linting a file that contains an alias referring to an anchor from an earlier document causes yamllint to crash. I would expect the linter to repor... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index da57248..d968461 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -149,7 +149,6 @@ def check(conf, token, prev, next, nextnext, context):
# - end of document sign '...'
# - start of a new document sig... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index d968461..da57248 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -149,6 +149,7 @@ def check(conf, token, prev, next, nextnext, context):
# - end of document sign '...'
# - start of a new document sig... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_braces.... | 4b5a9c3f142a518fd50dec78b42ee28dd0f94916e8be08aa67a75489148384e9 | 912d435c8ae97145ed15c832a378db3ef66ea7ff7d6aa951c1646ce54e6f894f | yamllint/rules/anchors.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_a99874ee9a3b8f2367517326 | weaveworks/grafanalib | python | devops_infra | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed@sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | swebench/swesmith.x86_64.weaveworks_1776_grafanalib.5c3b17ed | sha256:a5cf1839d25a0567a65b0907dc7b40574764173f1cf084fa5a5665c02a56236a | sha256:543336df755bcf897679a5569e4c977a2624edd497d4c579268b1aeb4040cc93 | /testbed | Title: `OpenTSDBFilter` no longer accepts `groupBy`
I'm trying to generate an OpenTSDB dashboard with a wildcard filter that groups by tag. With the current version, creating the filter raises a `TypeError`:
```python
from grafanalib.opentsdb import OpenTSDBFilter
OpenTSDBFilter(
value="*",
tag="instance",
... | diff --git a/grafanalib/opentsdb.py b/grafanalib/opentsdb.py
index 2e65bf0..955b7dc 100644
--- a/grafanalib/opentsdb.py
+++ b/grafanalib/opentsdb.py
@@ -1,6 +1,7 @@
"""Support for OpenTSDB."""
import attr
+from attr.validators import instance_of
from grafanalib.validators import is_in
# OpenTSDB aggregators
@@ ... | diff --git a/grafanalib/opentsdb.py b/grafanalib/opentsdb.py
index 955b7dc..2e65bf0 100644
--- a/grafanalib/opentsdb.py
+++ b/grafanalib/opentsdb.py
@@ -1,7 +1,6 @@
"""Support for OpenTSDB."""
import attr
-from attr.validators import instance_of
from grafanalib.validators import is_in
# OpenTSDB aggregators
@@ ... | [
"grafanalib/tests/test_opentsdb.py::test_serialization_opentsdb_target"
] | [
"grafanalib/tests/test_azuredataexplorer.py::test_serialization_azuredataexplorer_metrics_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_graph_target",
"grafanalib/tests/test_azuremonitor.py::test_serialization_azure_logs_target",
"grafanalib/tests/test_azuremonitor.py::test_seriali... | 265dfc5fd881ac59d803a415881955792e67d5b6e99dfe039a1335c27ab08b0c | a5f7fbdb8505148db7393999b5f9841e4d6f488163a1bbc5dbd24351183d34b9 | grafanalib/opentsdb.py | train | 837ba8e8fa6f1e4fb1f726ff923e10823e0ccfe4 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_2425523e49e9012ebdfb9d3e | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **All rules reported as missing: `invalid config: no such rule: "anchors"`**
When loading rule configurations, any config that enables a rule fails with an error saying the rule does not exist. It happens even for a single built-in rule like `braces` or `anchors`.
### Expected behavior
The config should be accepted ... | diff --git a/yamllint/rules/__init__.py b/yamllint/rules/__init__.py
index 99d5f8e..815d4bc 100644
--- a/yamllint/rules/__init__.py
+++ b/yamllint/rules/__init__.py
@@ -13,29 +13,31 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licen... | diff --git a/yamllint/rules/__init__.py b/yamllint/rules/__init__.py
index 815d4bc..99d5f8e 100644
--- a/yamllint/rules/__init__.py
+++ b/yamllint/rules/__init__.py
@@ -13,31 +13,29 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licen... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows_imbrication",
"tests/... | 9189366e6c5b7edf1cb7dc386482a1583cf23de9b35bc29ab4b220de1cf644af | 384031f4666962169ef82b2db26060431e5fb14a704f8af8a7278c78e91d887f | yamllint/rules/__init__.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_e639fded961995a78de87f4d | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `anchors: forbid-unused-anchors` reports used anchors as unused
With the `anchors` rule configured to forbid unused anchors, anchors that are referenced by aliases are still reported as unused. Even a minimal document with an anchor and a matching alias gets flagged. For example, with this `.yamllint`:
```yaml
---
ru... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index 9489266..d968461 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -156,8 +156,11 @@ def check(conf, token, prev, next, nextnext, context):
yaml.DocumentEndToken)):
for anchor, inf... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index d968461..9489266 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -156,11 +156,8 @@ def check(conf, token, prev, next, nextnext, context):
yaml.DocumentEndToken)):
for anchor, inf... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_braces.... | 4b5a9c3f142a518fd50dec78b42ee28dd0f94916e8be08aa67a75489148384e9 | 9569ba272d1a37c8966c294dcc5f8f073465c4b6db9e2a8974c47eb8fd420279 | yamllint/rules/anchors.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_df4b573fa6222a5a3d516738 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### `anchors`: `forbid-unused-anchors` reports used anchors as unused
### Description
With `forbid-unused-anchors: true`, an anchor that is used later in the document gets reported as unused as soon as an earlier alias is reached. It looks like the rule checks for unused anchors too early when there are multiple anch... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index 6a1198c..d968461 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -143,14 +143,17 @@ def check(conf, token, prev, next, nextnext, context):
f'found duplicated anchor "{token.value}"')
if conf['forbid-un... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index d968461..6a1198c 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -143,17 +143,14 @@ def check(conf, token, prev, next, nextnext, context):
f'found duplicated anchor "{token.value}"')
if conf['forbid-un... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_braces.... | 4b5a9c3f142a518fd50dec78b42ee28dd0f94916e8be08aa67a75489148384e9 | 55a75ee155adafa334fd225b37462339a732457990d00adeb8564a3ed96e9f9c | yamllint/rules/anchors.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_43c6f4e0b71b0006533050a5 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **anchors rule reports every alias as undeclared and misses duplicated/unused anchors**
### Description
The `anchors` rule no longer seems to remember anchors. A simple anchor/alias pair is reported as an undeclared alias, even when the anchor is right next to the alias. Duplicated anchors and unused anchors are also... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index e89de85..d968461 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -122,7 +122,11 @@ def check(conf, token, prev, next, nextnext, context):
if (conf['forbid-undeclared-aliases'] or
conf['forbid-duplicated-... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index d968461..e89de85 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -122,11 +122,7 @@ def check(conf, token, prev, next, nextnext, context):
if (conf['forbid-undeclared-aliases'] or
conf['forbid-duplicated-... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/rules/test_colons.py::ColonTestCase::test_with_alias_as_key",
"te... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces_empty... | 4b5a9c3f142a518fd50dec78b42ee28dd0f94916e8be08aa67a75489148384e9 | dda58857b20692c29e0f977295d66a79bea359005f7555d64d5c850150e1cd08 | yamllint/rules/anchors.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_4c7a5eb70ae6178fca0f3a6d | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **Title:** `anchors` rule: `forbid-unused-anchors` silently ignores unused anchors unless document ends with `...`
### Description
With `forbid-unused-anchors: true`, unused anchors are no longer reported unless the document is explicitly terminated with `...`. Documents that end at a `---` separator or at the end of... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index f97eed2..d968461 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -122,7 +122,10 @@ def check(conf, token, prev, next, nextnext, context):
if (conf['forbid-undeclared-aliases'] or
conf['forbid-duplicated-... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index d968461..f97eed2 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -122,10 +122,7 @@ def check(conf, token, prev, next, nextnext, context):
if (conf['forbid-undeclared-aliases'] or
conf['forbid-duplicated-... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_braces.... | 4b5a9c3f142a518fd50dec78b42ee28dd0f94916e8be08aa67a75489148384e9 | 1b7bafcce142bb6f7c81a3f58fe76c49d322a3675d4d250357dccef868ccc510 | yamllint/rules/anchors.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_5b9f2e1c57518f112dcec2c3 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Anchors rule: `forbid-unused-anchors` silently reports nothing
### Description
The `anchors` rule's `forbid-unused-anchors` option doesn't report anything anymore. With only that option enabled, a file full of anchors that are never aliased comes back clean, even though the anchors are clearly unused.
### Expected b... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index 55d8bef..d968461 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -119,13 +119,14 @@ DEFAULT = {'forbid-undeclared-aliases': True,
def check(conf, token, prev, next, nextnext, context):
- if (isinstance(token, (yam... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index d968461..55d8bef 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -119,14 +119,13 @@ DEFAULT = {'forbid-undeclared-aliases': True,
def check(conf, token, prev, next, nextnext, context):
- if (conf['forbid-undeclare... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_braces.... | 4b5a9c3f142a518fd50dec78b42ee28dd0f94916e8be08aa67a75489148384e9 | 50f2888fb7900dfa4299c33745c186bc6b8e5e69d19873d24ef53a5318c4c890 | yamllint/rules/anchors.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_3a9bac4dfb26ee229ba7f202 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## yamllint crashes with `TypeError: isinstance() arg 2 must be a type` with anchors enabled
### Description
With the default configuration or an explicitly enabled `anchors` rule, `yamllint` crashes with a `TypeError` before it starts linting.
### Steps to Reproduce
Create a trivial YAML file:
```yaml
# test.yaml... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index e30eeed..d968461 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -110,16 +110,18 @@ from yamllint.linter import LintProblem
ID = 'anchors'
TYPE = 'token'
-CONF = {'forbid-undeclared-aliases': True,
- 'forbid-du... | diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py
index d968461..e30eeed 100644
--- a/yamllint/rules/anchors.py
+++ b/yamllint/rules/anchors.py
@@ -110,18 +110,16 @@ from yamllint.linter import LintProblem
ID = 'anchors'
TYPE = 'token'
-CONF = {'forbid-undeclared-aliases': bool,
- 'forbid-du... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation... | 4b5a9c3f142a518fd50dec78b42ee28dd0f94916e8be08aa67a75489148384e9 | ca1d3fc05973d521fbe4777e0f3428ee20c72287fef025e76eeaa390a8c38ab8 | yamllint/rules/anchors.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_ff121463fa81cf2c9703aed0 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `braces` rule crashes on flow mappings with `NameError`
With the `braces` rule enabled, linting a YAML file containing a flow mapping now fails with a traceback instead of producing normal lint results. For example:
```yaml
foo: {bar: baz}
```
Running `yamllint` on the file above gives:
```text
Traceback (most rece... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index f073259..19f870a 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -135,6 +135,7 @@ braces (``{`` and ``}``).
import yaml
from yamllint.linter import LintProblem
+from yamllint.rules.common import spaces_after, spaces_befor... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index 19f870a..f073259 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -135,7 +135,6 @@ braces (``{`` and ``}``).
import yaml
from yamllint.linter import LintProblem
-from yamllint.rules.common import spaces_after, spaces_befor... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_brackets.py::ColonTestCase::test_disabled",
"tests/rules/test_brackets.py::ColonTestCase::test_forbid",
"tests/rules/test_brackets.py::ColonTestCase::test_max_spaces",
"tests/rules/test_brackets.py::ColonTestCase::test_max_spaces_... | 02322e076b6ecb0341faaa3359092d10dcbd50ec3aacf51ec47e3041e949c8d1 | ed34f4e65dc17b6e17436e52d60e753bbbf926d84369607fff1eabbc45d1deff | yamllint/rules/braces.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_359d6c72a5ca6e50452062b0 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `brackets: forbid: non-empty` no longer accepted in config
### Description
The `brackets` rule used to accept `non-empty` as a value for the `forbid`
option, so that only non-empty flow sequences were reported while empty ones
were allowed. This is still documented, but setting it now makes yamllint bail
out befor... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index 04de299..f1c08d5 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -140,7 +140,7 @@ from yamllint.rules.common import spaces_after, spaces_before
ID = 'brackets'
TYPE = 'token'
-CONF = {'forbid': bool,
+CONF = {'for... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index f1c08d5..04de299 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -140,7 +140,7 @@ from yamllint.rules.common import spaces_after, spaces_before
ID = 'brackets'
TYPE = 'token'
-CONF = {'forbid': (bool, 'non-empty')... | [
"tests/rules/test_brackets.py::ColonTestCase::test_forbid"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 7a2d01f1d02d3f5a9fe7c8f832d931d0a68a718d3dcc93ae3ad31d0c1d36601e | 4b1ae5a0cca7c5d72a1b03933964e7d5043391e6861f12da6d4375e10200aca1 | yamllint/rules/brackets.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_116d1f9adb05e878b41c3151 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **yamllint crashes with `TypeError: check() takes 5 positional arguments but 6 were given` on any file**
### Description
After pulling the latest changes, running `yamllint` on *any* YAML file crashes with a `TypeError`. It doesn't seem to matter what the file contains — even an empty file blows up. I first noticed i... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index f7d24ad..19f870a 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -151,7 +151,7 @@ DEFAULT = {'forbid': False,
'max-spaces-inside-empty': -1}
-def check(conf, token, prev, next, context):
+def check(conf, token... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index 19f870a..f7d24ad 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -151,7 +151,7 @@ DEFAULT = {'forbid': False,
'max-spaces-inside-empty': -1}
-def check(conf, token, prev, next, nextnext, context):
+def check(c... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_empty_values.py::EmptyValuesTestCase::test_disabled",
"tests/rules/test_empty_values.py::EmptyValuesTestCase::test_in_block_mappings_empty_flow_mapping",
"tests/r... | 02322e076b6ecb0341faaa3359092d10dcbd50ec3aacf51ec47e3041e949c8d1 | 7d7ca10cb0cf5b19d0931b649f629191a747466b87361da594f126e0591b755d | yamllint/rules/braces.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_0ab0c276ab91917de57e25d9 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `braces: {forbid: non-empty}` no longer accepted, linter fails to start
### Description
I have been using the `braces` rule with `forbid: non-empty` so that empty flow mappings like `{}` are allowed but non-empty ones such as `{a: 1}` are flagged. After updating, yamllint refuses to run at all with a config error.
#... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index 0f411ac..19f870a 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -60,6 +60,18 @@ braces (``{`` and ``}``).
object: { key1: 4, key2: 8 }
+#. With ``braces: {forbid: non-empty}``
+
+ the following code snippet would ... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index 19f870a..0f411ac 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -60,18 +60,6 @@ braces (``{`` and ``}``).
object: { key1: 4, key2: 8 }
-#. With ``braces: {forbid: non-empty}``
-
- the following code snippet would ... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 02322e076b6ecb0341faaa3359092d10dcbd50ec3aacf51ec47e3041e949c8d1 | 98004a458842f79b284e836771b7a89c54bf9b0eeec0620454e08dbf542484c5 | yamllint/rules/braces.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_570b452e558dbf1dc5fd0763 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `braces` rule reports spaces *before* empty braces and misses spacing inside them
### Description
The `braces` rule seems to be looking at the wrong side of empty flow mappings (`{}`). It now reports *"too many spaces before empty braces"* on perfectly valid YAML where the only space is the one separating the key ... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index 53bd686..19f870a 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -167,15 +167,15 @@ def check(conf, token, prev, next, nextnext, context):
elif (isinstance(token, yaml.FlowMappingStartToken) and
isinstance... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index 19f870a..53bd686 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -167,15 +167,15 @@ def check(conf, token, prev, next, nextnext, context):
elif (isinstance(token, yaml.FlowMappingStartToken) and
isinstance... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces_empty",
"tests/rules/test_braces.py::ColonTestCase::test_min_and_max_spaces",
"tests/rules/test_braces.py::ColonTestCase::test_m... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 02322e076b6ecb0341faaa3359092d10dcbd50ec3aacf51ec47e3041e949c8d1 | 27d1c59d33bb3eed8e8ecfd9273826379c16297ce065cd943f8da77e714e3cad | yamllint/rules/braces.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_5ceb86c2be8e4a9cd6ffd57b | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `braces` rule no longer applies `min-spaces-inside` / `max-spaces-inside` to empty flow mappings
### Description
When `min-spaces-inside-empty` or `max-spaces-inside-empty` is set to `-1`, the `braces` rule used to fall back to the general `min-spaces-inside` / `max-spaces-inside` settings. Empty flow mappings now app... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index fcbf810..19f870a 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -167,14 +167,16 @@ def check(conf, token, prev, next, nextnext, context):
elif (isinstance(token, yaml.FlowMappingStartToken) and
isinstance... | diff --git a/yamllint/rules/braces.py b/yamllint/rules/braces.py
index 19f870a..fcbf810 100644
--- a/yamllint/rules/braces.py
+++ b/yamllint/rules/braces.py
@@ -167,16 +167,14 @@ def check(conf, token, prev, next, nextnext, context):
elif (isinstance(token, yaml.FlowMappingStartToken) and
isinstance... | [
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces",
"tests/rules/test_braces.py::ColonTestCase::test_min_and_max_spaces",
"tests/rules/test_braces.py::ColonTestCase::test_min_spaces"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 02322e076b6ecb0341faaa3359092d10dcbd50ec3aacf51ec47e3041e949c8d1 | 6886c4863d66ff3a5b2b7fe10b1b384de20d1c85c0b736039d8034cbef1c6cd0 | yamllint/rules/braces.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_40c6a734c28b816cab09da6e | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### `brackets` rule: `min-spaces-inside` / `max-spaces-inside` are ignored for empty brackets
When only `min-spaces-inside` or `max-spaces-inside` is set for the `brackets` rule and the corresponding `-empty` option is left unset, the non-empty setting is no longer applied to empty brackets (`[]`). It used to fall bac... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index bd45119..f1c08d5 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -133,7 +133,8 @@ inside brackets (``[`` and ``]``).
"""
-import yaml, re
+import yaml
+
from yamllint.linter import LintProblem
from yamllint.rul... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index f1c08d5..bd45119 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -133,8 +133,7 @@ inside brackets (``[`` and ``]``).
"""
-import yaml
-
+import yaml, re
from yamllint.linter import LintProblem
from yamllint.rul... | [
"tests/rules/test_brackets.py::ColonTestCase::test_min_spaces",
"tests/rules/test_brackets.py::ColonTestCase::test_min_spaces_empty"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 7a2d01f1d02d3f5a9fe7c8f832d931d0a68a718d3dcc93ae3ad31d0c1d36601e | 83180e68d9c1d6ccd8cbd761fcb157935dd3a0a3feba4d3294927c189dcc13b6 | yamllint/rules/brackets.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_ddb1cdbbff875243632b9032 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `brackets` rule reports errors on the wrong side of flow sequences
### Description
The `brackets` rule appears to check the wrong side of flow sequence delimiters. Spaces before `[` are reported as being “inside brackets”, while spaces actually inside `[ ... ]` are ignored.
### Steps to Reproduce
With `test.yaml`:
`... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index d699390..f1c08d5 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -166,7 +166,7 @@ def check(conf, token, prev, next, nextnext, context):
token.end_mark.column + 1,
... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index f1c08d5..d699390 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -166,7 +166,7 @@ def check(conf, token, prev, next, nextnext, context):
token.end_mark.column + 1,
... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_braces.py::ColonTestCase::test_disabled",
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces_empty",
"tests/rules/test_braces.py::ColonTestCase::test_min_and_max... | 7a2d01f1d02d3f5a9fe7c8f832d931d0a68a718d3dcc93ae3ad31d0c1d36601e | 830481269f2d1fb923877baf4b15a83933cd7750970b64965c1daf6061d51499 | yamllint/rules/brackets.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_9492da2c497d753f69415dfb | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **yamllint crashes with `AttributeError: 'ValueToken' object has no attribute 'value'` on any YAML file containing a mapping**
### Description
After updating to the latest development version, yamllint crashes on virtually any valid YAML file that contains a mapping. A minimal file with a single key-value pair is eno... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index 4dd7feb..2a181c6 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -79,7 +79,7 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
-import re
+
from yamllint.rules.common import i... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index 2a181c6..4dd7feb 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -79,7 +79,7 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
-
+import re
from yamllint.rules.common import i... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_colons.py::ColonTestCase::test_disabled",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_dos_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_first_line",
... | 23bba49e5f082aa394d9f794a6e7ecac7649267559f3526882863fcb66945fab | 4321154b5d2e5e47304803d2d21e3ed67254298b0ced25920b1609f39fe99755 | yamllint/rules/colons.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_c97350f4c1af5893f3943d1c | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `colons` rule ignores `max-spaces-before` entirely
### Description
With the `colons` rule enabled, spaces before a colon are no longer reported. Setting `max-spaces-before` (or relying on the default of `0`) has no effect, and `yamllint` exits cleanly on files that clearly have extra spaces before the colon.
### E... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index 07b8035..2a181c6 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -80,7 +80,7 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
-from yamllint.rules.common import is_explicit_ke... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index 2a181c6..07b8035 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -80,7 +80,7 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
-from yamllint.rules.common import is_explicit_ke... | [
"tests/rules/test_colons.py::ColonTestCase::test_before_enabled",
"tests/rules/test_colons.py::ColonTestCase::test_before_max",
"tests/rules/test_colons.py::ColonTestCase::test_before_with_explicit_block_mappings",
"tests/rules/test_colons.py::ColonTestCase::test_both_before_and_after",
"tests/rules/test_co... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 23bba49e5f082aa394d9f794a6e7ecac7649267559f3526882863fcb66945fab | a9690207a43ba6387dc6ca2450ca6f82fb993e37fffaed23b835e2e8013fa724 | yamllint/rules/colons.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_80a7a2a582ff6c71c58a06c8 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## yamllint crashes with `NameError: name 'spaces_before' is not defined` on any YAML file
Running `yamllint` on even a trivial, valid YAML file now produces a traceback instead of linting the file.
### Steps to Reproduce
Create a simple file `test.yaml`:
```yaml
---
key: value
```
Run yamllint:
```
$ yamllint te... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index 57a10ed..2a181c6 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -80,6 +80,7 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
+from yamllint.rules.common import is_explicit_ke... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index 2a181c6..57a10ed 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -80,7 +80,6 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
-from yamllint.rules.common import is_explicit_ke... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_colons.py::ColonTestCase::test_disabled",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_dos_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_first_line",
... | 23bba49e5f082aa394d9f794a6e7ecac7649267559f3526882863fcb66945fab | 92bcba309fd8e5949181df3009e19c41b14432ef051c12202ca14381ab412971 | yamllint/rules/colons.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_2c362e7ffa49a551fd0adf72 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `colons` rule no longer reports problems for regular mappings
### Description
It looks like the `colons` rule stopped detecting spacing issues around colons in ordinary block/flow mappings. Configuring `max-spaces-before`/`max-spaces-after` doesn't have any effect anymore for `key: value` style entries.
### Expect... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index ad0ebc1..2a181c6 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -80,7 +80,7 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
-from yamllint.rules.common import is_explicit_ke... | diff --git a/yamllint/rules/colons.py b/yamllint/rules/colons.py
index 2a181c6..ad0ebc1 100644
--- a/yamllint/rules/colons.py
+++ b/yamllint/rules/colons.py
@@ -80,7 +80,7 @@ Use this rule to control the number of spaces before and after colons (``:``).
import yaml
-from yamllint.rules.common import is_explicit_ke... | [
"tests/rules/test_colons.py::ColonTestCase::test_after_enabled",
"tests/rules/test_colons.py::ColonTestCase::test_after_enabled_question_mark",
"tests/rules/test_colons.py::ColonTestCase::test_after_max",
"tests/rules/test_colons.py::ColonTestCase::test_after_with_explicit_block_mappings",
"tests/rules/test... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 23bba49e5f082aa394d9f794a6e7ecac7649267559f3526882863fcb66945fab | 6bf47880ea5e0d13a3e213b2a693316a9f68807f9b74bbbfb68d777077057c85 | yamllint/rules/colons.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_112fe3c014083aff1cb92ad2 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### yamllint crashes with `KeyError: 'min-spaces-inside'` on any file
Running `yamllint` on a normal YAML file fails immediately with a traceback, even when the file has no lint problems.
### Expected behavior
`yamllint` should lint the file normally, e.g. produce no output for a clean file.
### Actual behavior
`y... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index 79e6a7a..f1c08d5 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -140,13 +140,16 @@ from yamllint.rules.common import spaces_after, spaces_before
ID = 'brackets'
TYPE = 'token'
-CONF = {
- 'forbid': (bool, 'non... | diff --git a/yamllint/rules/brackets.py b/yamllint/rules/brackets.py
index f1c08d5..79e6a7a 100644
--- a/yamllint/rules/brackets.py
+++ b/yamllint/rules/brackets.py
@@ -140,16 +140,13 @@ from yamllint.rules.common import spaces_after, spaces_before
ID = 'brackets'
TYPE = 'token'
-CONF = {'forbid': (bool, 'non-empty... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_common.py::CommonTestCase::test_get_line_indent",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_anchors",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows",
"tests/rules/test_indentation.py::IndentationStackTestCase::test_flows_imbrication",
"tests/... | 7a2d01f1d02d3f5a9fe7c8f832d931d0a68a718d3dcc93ae3ad31d0c1d36601e | 49bb61b6e9fb7d4efb1ab3f93db6ef16936a01f834c4057cf7817e91902a973e | yamllint/rules/brackets.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_412b2e1db61e8ddac329d174 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## yamllint crashes with `NameError` on comma-containing flow collections
### Description
After updating to the latest version, running yamllint on a file that contains commas in a flow sequence or flow mapping no longer works — it crashes with a `NameError` in the `commas` rule. This means yamllint can't be used at ... | diff --git a/yamllint/rules/commas.py b/yamllint/rules/commas.py
index c58db9a..baa8b7d 100644
--- a/yamllint/rules/commas.py
+++ b/yamllint/rules/commas.py
@@ -104,7 +104,7 @@ Use this rule to control the number of spaces before and after commas (``,``).
import yaml
from yamllint.linter import LintProblem
-from ya... | diff --git a/yamllint/rules/commas.py b/yamllint/rules/commas.py
index baa8b7d..c58db9a 100644
--- a/yamllint/rules/commas.py
+++ b/yamllint/rules/commas.py
@@ -104,7 +104,7 @@ Use this rule to control the number of spaces before and after commas (``,``).
import yaml
from yamllint.linter import LintProblem
-from ya... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces_empty",
"tests/rules/test_braces.py::ColonTestCase::test_min_and_max_spaces_empty",
"tests/rules/test_braces.py::ColonTestCase::test_min_spaces_empty",
"tests/rules/test_brackets.py::ColonTe... | 55431fe9c06268f64b1a51471685e208e4f99511dba0d5e4c4ec541088d3cdf4 | 7e2142008977c30d09104b1d79aff0c8eb5f0be460c3ce37d00a48913641344c | yamllint/rules/commas.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_17f9133003d07de3ca6b7d22 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### `commas`: false positive “too many spaces before comma” for every comma in flow collections
#### Description
After upgrading, the `commas` rule reports `too many spaces before comma` for every comma inside flow sequences and mappings, even when the YAML is correctly spaced. For example, a simple flow sequence with... | diff --git a/yamllint/rules/commas.py b/yamllint/rules/commas.py
index 6e2a94e..baa8b7d 100644
--- a/yamllint/rules/commas.py
+++ b/yamllint/rules/commas.py
@@ -104,7 +104,7 @@ Use this rule to control the number of spaces before and after commas (``,``).
import yaml
from yamllint.linter import LintProblem
-from ya... | diff --git a/yamllint/rules/commas.py b/yamllint/rules/commas.py
index baa8b7d..6e2a94e 100644
--- a/yamllint/rules/commas.py
+++ b/yamllint/rules/commas.py
@@ -104,7 +104,7 @@ Use this rule to control the number of spaces before and after commas (``,``).
import yaml
from yamllint.linter import LintProblem
-from ya... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_braces.py::ColonTestCase::test_max_spaces_empty",
"tests/rules/test_braces.py::ColonTestCase::test_min_and_max_spaces_empty",
"tests/rules/test_braces.py::ColonTestCase::test_min_spaces_empty",
"tests/rules/test_brackets.py::ColonTe... | 55431fe9c06268f64b1a51471685e208e4f99511dba0d5e4c4ec541088d3cdf4 | 1b5d9bea3fe7dc5e09ba88013257f989626e4cafd86f2371518694feaef4208a | yamllint/rules/commas.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_c2b11e1b08d81d59abb65815 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### `commas`: `max-spaces-before` is no longer enforced
It seems like the `commas` rule stopped reporting spaces before commas. With a config like:
```yaml
rules:
commas:
max-spaces-before: 0
min-spaces-after: 0
max-spaces-after: -1
```
and a file like:
```yaml
---
array: [1, 2 , 3, 4]
...
```
I'd e... | diff --git a/yamllint/rules/commas.py b/yamllint/rules/commas.py
index 3fd0a9d..baa8b7d 100644
--- a/yamllint/rules/commas.py
+++ b/yamllint/rules/commas.py
@@ -104,7 +104,7 @@ Use this rule to control the number of spaces before and after commas (``,``).
import yaml
from yamllint.linter import LintProblem
-from ya... | diff --git a/yamllint/rules/commas.py b/yamllint/rules/commas.py
index baa8b7d..3fd0a9d 100644
--- a/yamllint/rules/commas.py
+++ b/yamllint/rules/commas.py
@@ -104,7 +104,7 @@ Use this rule to control the number of spaces before and after commas (``,``).
import yaml
from yamllint.linter import LintProblem
-from ya... | [
"tests/rules/test_commas.py::CommaTestCase::test_before_max",
"tests/rules/test_commas.py::CommaTestCase::test_before_max_3",
"tests/rules/test_commas.py::CommaTestCase::test_before_max_with_comma_on_new_line",
"tests/rules/test_commas.py::CommaTestCase::test_both_before_and_after"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 55431fe9c06268f64b1a51471685e208e4f99511dba0d5e4c4ec541088d3cdf4 | 8d101d43d2f005f8ba47730d45373fb99225e1c96a6d0a761d136e01f01675a4 | yamllint/rules/commas.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_3e19efa3e202934291fe0ccc | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **Title:** yamllint incorrectly flags empty comments with CRLF line endings as missing a starting space
**Description:**
When using `comments: require-starting-space: true` and a file with Windows-style CRLF line endings, an empty comment line (a line containing only `#`) is reported as a lint error: `missing starting... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 74d2e15..7e4f04c 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,7 +23,9 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 7e4f04c..74d2e15 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,9 +23,7 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | [
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_dos_newlines",
"tests/rules/test_new_lines.py::NewLinesTestCase::test_unix_type_required_st_sp"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | e0438f629854482cd7767047c501f2c2a3364bc3735ec73e00baa303fe5a5d0f | 5919dc35783db1113ca902d853b674aa43a7bc21784f0ed28040050435c7ecea | yamllint/rules/comments.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_915bf77d9500aa25a948f563 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Empty comment on the last line of a file (no trailing newline) is reported as "missing starting space"
I'm running into a weird one with the `comments` rule. An empty comment (`#` with nothing after it) that happens to be the very last line of a file, with no newline character at the end, gets flagged as missing a sta... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index a8a3ff5..7e4f04c 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -82,11 +82,12 @@ CONF = {'require-starting-space': bool,
'min-spaces-from-content': int}
DEFAULT = {'require-starting-space': True,
... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 7e4f04c..a8a3ff5 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -82,12 +82,11 @@ CONF = {'require-starting-space': bool,
'min-spaces-from-content': int}
DEFAULT = {'require-starting-space': True,
... | [
"tests/rules/test_comments.py::CommentsTestCase::test_last_line"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | e0438f629854482cd7767047c501f2c2a3364bc3735ec73e00baa303fe5a5d0f | 9f00ca912ae99044df15e2a688a79adb777a504aad51991b810c7a3ea9a16057 | yamllint/rules/comments.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_5c29359603f3a89fee591917 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **Comments rule reports the same "missing starting space" problem twice**
### Description
With the `comments` rule enabled and `require-starting-space: true` (the default), a comment that is missing the space after `#` is now reported twice, once for the same line and column.
### Expected behavior
A single problem ... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 6d05897..7e4f04c 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -21,10 +21,11 @@ Use this rule to control the position and formatting of comments.
* Use ``require-starting-space`` to require a space character right ... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 7e4f04c..6d05897 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -21,11 +21,10 @@ Use this rule to control the position and formatting of comments.
* Use ``require-starting-space`` to require a space character right ... | [
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_ignore_shebang",
"tests/rules/test_comments.py::CommentsTestCase::test_shebang",
"tests/rules/test_comments.py::CommentsTestCase::test_starting_space",
"tests/rules/test_line_length.py::LineLen... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | e0438f629854482cd7767047c501f2c2a3364bc3735ec73e00baa303fe5a5d0f | b24c115581f848423cf8c57b464df7b74008d5a8b401da999bca15e288759a3e | yamllint/rules/comments.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_326330557297b2296204f3f3 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## Comments rule no longer accepts `min-spaces-from-content` as a number
### Description
My existing `.yamllint` config sets `min-spaces-from-content` for the `comments` rule (as documented and as it has always worked). After updating, yamllint refuses to start and reports that the option must be a boolean:
```
yaml... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index eb176b7..7e4f04c 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,6 +23,9 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 7e4f04c..eb176b7 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,9 +23,6 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | [
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_dos_newlines"... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | e0438f629854482cd7767047c501f2c2a3364bc3735ec73e00baa303fe5a5d0f | a33f24fc05132b017aee1188ff32a4a6c7548ac0a3946b79e2889c55cc733bd7 | yamllint/rules/comments.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_df9684d72b10e2c6063c4df8 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ### Title
`comments` rule flags correctly spaced inline comments and rejects `min-spaces-from-content`
### Description
After updating yamllint, any configuration that uses the `min-spaces-from-content` option for the `comments` rule fails to load with:
```
YamlLintConfigError: invalid config: unknown option "min-spa... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 8445257..7e4f04c 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,6 +23,9 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 7e4f04c..8445257 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,9 +23,6 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | [
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_dos_newlines"... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | e0438f629854482cd7767047c501f2c2a3364bc3735ec73e00baa303fe5a5d0f | a49b42aee188edf929340a4d72e8fbcdb2e137537ce1ad0dbeb4294ed1802c27 | yamllint/rules/comments.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_a23b20f2667af68c0b3507be | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | **`min-spaces-from-content` option for `comments` rule no longer accepted, breaking existing configs**
### Description
It looks like the `comments` rule no longer accepts the `min-spaces-from-content` option. I have an existing `.yamllint` config that has been working fine and now yamllint refuses to load it entirely... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 0da0664..7e4f04c 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,6 +23,9 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | diff --git a/yamllint/rules/comments.py b/yamllint/rules/comments.py
index 7e4f04c..0da0664 100644
--- a/yamllint/rules/comments.py
+++ b/yamllint/rules/comments.py
@@ -23,9 +23,6 @@ Use this rule to control the position and formatting of comments.
* Use ``ignore-shebangs`` to ignore a
`shebang <https://en.wikipedi... | [
"tests/rules/test_comments.py::CommentsTestCase::test_both",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_dos_newlines"... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | e0438f629854482cd7767047c501f2c2a3364bc3735ec73e00baa303fe5a5d0f | 61546cbd4ee08c41c20e33e422cef5149599418aa7b7c761170e7e7754fc30ff | yamllint/rules/comments.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_5b28992c2c68063970a7a8a5 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | ## `comments-indentation` reports false positives for inline comments
### Description
The `comments-indentation` rule seems to check inline comments as if they were block comments, causing errors that shouldn't be reported.
### Steps to Reproduce
Create a file `test.yaml` with:
```yaml
---
- a # inline
# ok
```
Ru... | diff --git a/yamllint/rules/comments_indentation.py b/yamllint/rules/comments_indentation.py
index d9d2834..8bcda4d 100644
--- a/yamllint/rules/comments_indentation.py
+++ b/yamllint/rules/comments_indentation.py
@@ -97,6 +97,11 @@ TYPE = 'comment'
# current: line
def check(conf, comment):
+ # Only check blo... | diff --git a/yamllint/rules/comments_indentation.py b/yamllint/rules/comments_indentation.py
index 8bcda4d..d9d2834 100644
--- a/yamllint/rules/comments_indentation.py
+++ b/yamllint/rules/comments_indentation.py
@@ -97,11 +97,6 @@ TYPE = 'comment'
# current: line
def check(conf, comment):
- # Only check blo... | [
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment",
"tests/rules/test_comments.py::CommentsTestCase::test_multi_line_scalar",
"tests/rules/test_comments.py::CommentsTestCase::test_spaces_from_content",
"tests/rules/test_comments_indentation.py::CommentsIndentationTestCase::test_enabled",
"... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 0593ff6a52eedc656e4b34c31aa284d9b24949d582a041341ad1a5a80c25f44c | 01fa6bd3fe6574c1f7e3feaaf5a4e5c36d67f9e20454e5e5ddef07f1974b4cc9 | yamllint/rules/comments_indentation.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_db9c4cbff18350cc7f55ba15 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | Yamllint crashes on any YAML file containing comments
With the `comments-indentation` rule enabled, `yamllint` crashes whenever it encounters a comment while checking comment indentation.
### Steps to Reproduce
Create a file `test.yaml`:
```yaml
---
# a comment
foo: bar
```
Then run:
```console
$ yamllint test.ya... | diff --git a/yamllint/rules/comments_indentation.py b/yamllint/rules/comments_indentation.py
index e3c815d..8bcda4d 100644
--- a/yamllint/rules/comments_indentation.py
+++ b/yamllint/rules/comments_indentation.py
@@ -74,6 +74,8 @@ Use this rule to force comments to be indented like content.
"""
+import yaml
+
fro... | diff --git a/yamllint/rules/comments_indentation.py b/yamllint/rules/comments_indentation.py
index 8bcda4d..e3c815d 100644
--- a/yamllint/rules/comments_indentation.py
+++ b/yamllint/rules/comments_indentation.py
@@ -74,8 +74,6 @@ Use this rule to force comments to be indented like content.
"""
-import yaml
-
fro... | [
"tests/rules/test_braces.py::ColonTestCase::test_forbid",
"tests/rules/test_brackets.py::ColonTestCase::test_forbid",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment",
"tests/rules/test_comments.py::CommentsTestCase::test_empty_comment_crlf_disabled_newlines",
"tests/rules/test_comments.... | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 0593ff6a52eedc656e4b34c31aa284d9b24949d582a041341ad1a5a80c25f44c | 1740231657d05b5eaac9860a3f7b6875805d4257b4e133812c0dbdbc96e781d4 | yamllint/rules/comments_indentation.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] | |
sweas_830fc7a60baa34f3a194c666 | adrienverge/yamllint | python | devops_infra | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9@sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | swebench/swesmith.x86_64.adrienverge_1776_yamllint.8513d9b9 | sha256:fe4e56639cfe8b34c1f63461bdad354a14d30f40c3580fcfbb25570b9d7e0fb2 | sha256:5414b44d25f094183e6e4c682bfa37477fd407201320212106700b8e1b591707 | /testbed | `comments-indentation` reports false positives for comments at EOF
### Description
With `comments-indentation` enabled, comments at the end of a file are incorrectly reported as “comment not indented like content”. This is especially easy to hit when the file has no trailing newline, or when the last lines are consec... | diff --git a/yamllint/rules/comments_indentation.py b/yamllint/rules/comments_indentation.py
index c980959..8bcda4d 100644
--- a/yamllint/rules/comments_indentation.py
+++ b/yamllint/rules/comments_indentation.py
@@ -103,6 +103,9 @@ def check(conf, comment):
return
next_line_indent = comment.token_after... | diff --git a/yamllint/rules/comments_indentation.py b/yamllint/rules/comments_indentation.py
index 8bcda4d..c980959 100644
--- a/yamllint/rules/comments_indentation.py
+++ b/yamllint/rules/comments_indentation.py
@@ -103,9 +103,6 @@ def check(conf, comment):
return
next_line_indent = comment.token_after... | [
"tests/rules/test_comments.py::CommentsTestCase::test_last_line",
"tests/rules/test_comments_indentation.py::CommentsIndentationTestCase::test_enabled",
"tests/rules/test_comments_indentation.py::CommentsIndentationTestCase::test_no_newline_at_end"
] | [
"tests/rules/test_anchors.py::AnchorsTestCase::test_disabled",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_duplicated_anchors",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_undeclared_aliases",
"tests/rules/test_anchors.py::AnchorsTestCase::test_forbid_unused_anchors",
"tests/ru... | 0593ff6a52eedc656e4b34c31aa284d9b24949d582a041341ad1a5a80c25f44c | a31fea0eeb208e23a9e70edfc1c8aa41cd74647bf82e1617d554f579a5f328db | yamllint/rules/comments_indentation.py | train | 2d04c8bf3ea98de52579294bc7410d0bc49042d3 | true | false | source /opt/miniconda3/bin/activate; conda activate testbed; pytest --disable-warnings --color=no --tb=no --verbose | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.