src/nitpick/plugins/pre_commit.py
def enforce_repo_block(self, expected_repo_block: OrderedDict) -> Iterator[Fuss]:
        """Enforce a repo with a YAML string configuration."""
        expected_hooks = PreCommitHook.get_all_hooks_from(YAMLFormat(string=expected_repo_block.get(KEY_YAML)).as_list)
        for unique_key, hook in expected_hooks.items():
            if unique_key not in self.actual_hooks:
                yield self.reporter.make_fuss(
                    Violations.HOOK_NOT_FOUND, YAMLFormat(data=hook.yaml.as_data).reformatted, id=hook.hook_id
                )
                continue

            comparison = YAMLFormat(data=self.actual_hooks[unique_key].single_hook).compare_with_dictdiffer(
                hook.single_hook
            )

            # Display the current revision of the hook
            current_revision = comparison.flat_actual.get("rev", None)
            revision_message = f" (rev: {current_revision})" if current_revision else ""
            yield from self.warn_missing_different(comparison, f": hook {hook.hook_id!r}{revision_message}")
Enforce a repo with a YAML string configuration.
Enforce a repo with a YAML string configuration.
Enforce a repo with a YAML string configuration .
def enforce_repo_block(self, expected_repo_block: OrderedDict) -> Iterator[Fuss]:
        expected_hooks = PreCommitHook.get_all_hooks_from(YAMLFormat(string=expected_repo_block.get(KEY_YAML)).as_list)
        for unique_key, hook in expected_hooks.items():
            if unique_key not in self.actual_hooks:
                yield self.reporter.make_fuss(
                    Violations.HOOK_NOT_FOUND, YAMLFormat(data=hook.yaml.as_data).reformatted, id=hook.hook_id
                )
                continue
            comparison = YAMLFormat(data=self.actual_hooks[unique_key].single_hook).compare_with_dictdiffer(
                hook.single_hook
            )
            current_revision = comparison.flat_actual.get("rev", None)
            revision_message = f" (rev: {current_revision})" if current_revision else ""
            yield from self.warn_missing_different(comparison, f": hook {hook.hook_id!r}{revision_message}")
def enforce_repo_block ( self , expected_repo_block : OrderedDict ) -> Iterator [ Fuss ] : expected_hooks = PreCommitHook . get_all_hooks_from ( YAMLFormat ( string = expected_repo_block . get ( KEY_YAML ) ) . as_list ) for unique_key , hook in expected_hooks . items ( ) : if unique_key not in self . actual_hooks : yield self . reporter . make_fuss ( Violations . HOOK_NOT_FOUND , YAMLFormat ( data = hook . yaml . as_data ) . reformatted , id = hook . hook_id ) continue comparison = YAMLFormat ( data = self . actual_hooks [ unique_key ] . single_hook ) . compare_with_dictdiffer ( hook . single_hook ) current_revision = comparison . flat_actual . get ( "rev" , None ) revision_message = f" (rev: {current_revision})" if current_revision else "" yield from self . warn_missing_different ( comparison , f": hook {hook.hook_id!r}{revision_message}" )
Enforce a repo with a YAML string configuration.
Enforce a repo with a YAML string configuration .
"""Enforce a repo with a YAML string configuration.""" # Display the current revision of the hook
self
expected_repo_block
OrderedDict