adrienverge / yamllint

A linter for YAML files.
GNU General Public License v3.0
2.86k stars 273 forks source link

Add forbid-in-block-sequences feature for detecting empty values in block sequences #604

Closed ericalmeidasp closed 11 months ago

ericalmeidasp commented 11 months ago

feat: Add forbid-in-list-items feature to detect empty values in lists

This commit introduces a new feature, forbid-in-list-items, which allows users to check for empty values within lists. The default behavior is set to false, but it can be activated by setting the forbid-in-list-items configuration variable to true.

The check function has been updated to handle this feature, and it will now identify and report empty values within list items when forbid-in-list-items is enabled.

This enhancement provides users with more control and flexibility when using the linter for YAML files.

coveralls commented 11 months ago

Coverage Status

coverage: 99.396% (+0.005%) from 99.391% when pulling 62f54e297cc7c73a8c9063f943350233701fc242 on ericalmeidasp:master into e1d45c3ae56aadbc58f098f05c3600cf95e9b2a1 on adrienverge:master.

ericalmeidasp commented 11 months ago

Hello! Thank you so much for the code review,

In response to the valuable feedback provided, I have made the following changes:

  1. Renamed the feature from forbid-in-list-items to forbid-in-block-sequences.

  2. Updated the documentation paragraph, LintProblem message, and test function names to align with the new feature name.

  3. Set the forbid-in-block-sequences option to be enabled by default, similar to forbid-in-block-mappings and forbid-in-flow-mappings. I agree with u, adjusted to maintain consistency.

In addition to these changes, I've also added more test cases to cover various scenarios. However, due to the forbid-in-block-sequences option being set as the default, I had to modify the existing test cases by including forbid-in-block-sequences: false to avoid interference with the existing test scenarios in the test_empty_values.py file.

Thanks!