src/nitpick/plugins/ini.py
def enforce_comma_separated_values(self, section, key, raw_actual: Any, raw_expected: Any) -> Iterator[Fuss]:
        """Enforce sections and keys with comma-separated values. The values might contain spaces."""
        actual_set = {s.strip() for s in raw_actual.split(",")}
        expected_set = {s.strip() for s in raw_expected.split(",")}
        missing = expected_set - actual_set
        if not missing:
            return

        joined_values = ",".join(sorted(missing))
        value_to_append = f",{joined_values}"
        if self.fix:
            self.updater[section][key].value += value_to_append
            self.dirty = True
        section_header = "" if section == TOP_SECTION else f"[{section}]\n"
        # TODO: proper testing of top section with separated values in https://github.com/andreoliwa/nitpick/issues/271
        yield self.reporter.make_fuss(
            Violations.MISSING_VALUES_IN_LIST,
            f"{section_header}{key} = (...){value_to_append}",
            key=key,
            fixed=self.fix,
        )
Enforce sections and keys with comma-separated values. The values might contain spaces.
Enforce sections and keys with comma-separated values. The values might contain spaces.
Enforce sections and keys with comma - separated values . The values might contain spaces .
def enforce_comma_separated_values(self, section, key, raw_actual: Any, raw_expected: Any) -> Iterator[Fuss]:
        actual_set = {s.strip() for s in raw_actual.split(",")}
        expected_set = {s.strip() for s in raw_expected.split(",")}
        missing = expected_set - actual_set
        if not missing:
            return
        joined_values = ",".join(sorted(missing))
        value_to_append = f",{joined_values}"
        if self.fix:
            self.updater[section][key].value += value_to_append
            self.dirty = True
        section_header = "" if section == TOP_SECTION else f"[{section}]\n"
        yield self.reporter.make_fuss(
            Violations.MISSING_VALUES_IN_LIST,
            f"{section_header}{key} = (...){value_to_append}",
            key=key,
            fixed=self.fix,
        )
def enforce_comma_separated_values ( self , section , key , raw_actual : Any , raw_expected : Any ) -> Iterator [ Fuss ] : actual_set = { s . strip ( ) for s in raw_actual . split ( "," ) } expected_set = { s . strip ( ) for s in raw_expected . split ( "," ) } missing = expected_set - actual_set if not missing : return joined_values = "," . join ( sorted ( missing ) ) value_to_append = f",{joined_values}" if self . fix : self . updater [ section ] [ key ] . value += value_to_append self . dirty = True section_header = "" if section == TOP_SECTION else f"[{section}]\n" yield self . reporter . make_fuss ( Violations . MISSING_VALUES_IN_LIST , f"{section_header}{key} = (...){value_to_append}" , key = key , fixed = self . fix , )
Enforce sections and keys with comma-separated values.
Enforce sections and keys with comma - separated values .
"""Enforce sections and keys with comma-separated values. The values might contain spaces.""" # TODO: proper testing of top section with separated values in https://github.com/andreoliwa/nitpick/issues/271
self
section
key
raw_actual
Any
raw_expected
Any