Repository: ansible/ansible-navigator (language: python)

Issue:
Add yaml to prettier
Also- limit the file types to only those we care about rather than everything.


Discussion / hints:

Fix patch:
diff --git a/.github/chronographer.yml b/.github/chronographer.yml
index 712e8ea29..90858e78a 100644
--- a/.github/chronographer.yml
+++ b/.github/chronographer.yml
@@ -3,5 +3,4 @@ enforce_name:
   suffix: .md
 exclude:
   humans:
-  - pyup-bot
-...
+    - pyup-bot
diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml
index 37b4e9f16..aac910d2a 100644
--- a/.github/workflows/tox.yml
+++ b/.github/workflows/tox.yml
@@ -6,11 +6,11 @@ concurrency:
   cancel-in-progress: true
 
 on:
-  create:  # is used for publishing to PyPI and TestPyPI
-    tags:  # any tag regardless of its name, no branches
+  create: # is used for publishing to PyPI and TestPyPI
+    tags: # any tag regardless of its name, no branches
       - "**"
-  push:  # only publishes pushes to the main branch to TestPyPI
-    branches:  # any integration branch but not tag
+  push: # only publishes pushes to the main branch to TestPyPI
+    branches: # any integration branch but not tag
       - "main"
   pull_request:
 
@@ -44,7 +44,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2
         with:
-          fetch-depth: 0  # needed by setuptools-scm
+          fetch-depth: 0 # needed by setuptools-scm
       - name: Set up Python ${{ matrix.python-version }}
         uses: actions/setup-python@v2
         with:
@@ -71,12 +71,12 @@ jobs:
         uses: codecov/codecov-action@v2
         with:
           directory: .tox
-          files: 'coverage-*.xml'
+          files: "coverage-*.xml"
           name: ${{ matrix.tox_env }}
-          verbose: true  # optional (default = false)
+          verbose: true # optional (default = false)
         if: ${{ startsWith(matrix.tox_env, 'py') }}
 
-  check:  # This job does nothing and is only used for the branch protection
+  check: # This job does nothing and is only used for the branch protection
     if: always()
 
     needs:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6bcd7eb13..0446798a8 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,15 +21,23 @@ repos:
     rev: "v2.5.1"
     hooks:
       - id: prettier
-        # Temporary excludes so we can gradually normalize the formatting
-        exclude: >
-          (?x)^(
-            tests/fixtures/integration/actions/.*\.json|
-            share/ansible_navigator/grammar/.*\.json|
-            share/ansible_navigator/themes/.*\.json|
-            .*\.md|
-            .*\.yml
-          )$
+        # Original hook implementation is flaky due to *several* bugs described
+        # in https://github.com/prettier/prettier/issues/12364
+        # a) CI=1 needed to avoid incomplete output
+        # b) two executions are needed because --list-different works correctly
+        # only when run with --check as with --write the output will also
+        # include other entries and logging level cannot be used to keep only
+        # modified files listed (any file is listes using the log level, regardless if
+        # is modified or not).
+        # c) We avoid letting pre-commit pass each filename in order to avoid
+        # runing multiple instances in parallel. This also ensures that running
+        # prettier from the command line behaves identically with the pre-commit
+        # one. No real performance downsides.
+        # d) exit with the return code from list-different (0=none, 1=some)
+        # rather than the write (0=successfully rewrote files). pre-commit.ci
+        entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec"
+        pass_filenames: false
+        args: []
         additional_dependencies:
           - prettier
           - prettier-plugin-toml
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 000000000..d7f293f7e
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,21 @@
+# Stuff we don't want priettier to ever to look into
+.git/
+.tox/
+.mypy_cache/
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Tracked but not manually edited
+tests/fixtures/integration/actions/**/*.json
+share/ansible_navigator/grammar/**/*.json
+share/ansible_navigator/themes/**/*.json
+
+# Temporary disabled during adoption:
+*.md


Test patch:
diff --git a/tests/fixtures/integration/actions/stdout/site.yml b/tests/fixtures/integration/actions/stdout/site.yml
index c6f43d183..72da3adfd 100644
--- a/tests/fixtures/integration/actions/stdout/site.yml
+++ b/tests/fixtures/integration/actions/stdout/site.yml
@@ -1,13 +1,13 @@
 - hosts: localhost
   gather_facts: False
   tasks:
-  - debug:
-      msg: "message 1"
-  - debug:
-      var: item
-    loop: "{{ items }}"
-    vars:
-      items:
-      - 1
-      - 2
-      - 3
+    - debug:
+        msg: "message 1"
+    - debug:
+        var: item
+      loop: "{{ items }}"
+      vars:
+        items:
+          - 1
+          - 2
+          - 3
diff --git a/tests/fixtures/integration/execution_environment/site.yml b/tests/fixtures/integration/execution_environment/site.yml
index bb38ce114..47e5296e0 100644
--- a/tests/fixtures/integration/execution_environment/site.yml
+++ b/tests/fixtures/integration/execution_environment/site.yml
@@ -2,5 +2,5 @@
 - hosts: localhost
   gather_facts: False
   tasks:
-  - ansible.builtin.debug:
-      msg: "test"
+    - ansible.builtin.debug:
+        msg: "test"
diff --git a/tests/fixtures/integration/execution_environment_image/site.yml b/tests/fixtures/integration/execution_environment_image/site.yml
index bb38ce114..47e5296e0 100644
--- a/tests/fixtures/integration/execution_environment_image/site.yml
+++ b/tests/fixtures/integration/execution_environment_image/site.yml
@@ -2,5 +2,5 @@
 - hosts: localhost
   gather_facts: False
   tasks:
-  - ansible.builtin.debug:
-      msg: "test"
+    - ansible.builtin.debug:
+        msg: "test"
diff --git a/tests/fixtures/integration/pass_environment_variable/site.yml b/tests/fixtures/integration/pass_environment_variable/site.yml
index bb38ce114..47e5296e0 100644
--- a/tests/fixtures/integration/pass_environment_variable/site.yml
+++ b/tests/fixtures/integration/pass_environment_variable/site.yml
@@ -2,5 +2,5 @@
 - hosts: localhost
   gather_facts: False
   tasks:
-  - ansible.builtin.debug:
-      msg: "test"
+    - ansible.builtin.debug:
+        msg: "test"
diff --git a/tests/fixtures/integration/set_environment_variable/site.yml b/tests/fixtures/integration/set_environment_variable/site.yml
index bb38ce114..47e5296e0 100644
--- a/tests/fixtures/integration/set_environment_variable/site.yml
+++ b/tests/fixtures/integration/set_environment_variable/site.yml
@@ -2,5 +2,5 @@
 - hosts: localhost
   gather_facts: False
   tasks:
-  - ansible.builtin.debug:
-      msg: "test"
+    - ansible.builtin.debug:
+        msg: "test"
diff --git a/tests/fixtures/integration/stdout_exit_codes/site.yml b/tests/fixtures/integration/stdout_exit_codes/site.yml
index 47ffec1d8..f6500228c 100644
--- a/tests/fixtures/integration/stdout_exit_codes/site.yml
+++ b/tests/fixtures/integration/stdout_exit_codes/site.yml
@@ -1,5 +1,5 @@
 - hosts: localhost
   gather_facts: False
   tasks:
-  - ansible.builtin.debug:
-      msg: success
+    - ansible.builtin.debug:
+        msg: success
diff --git a/tests/fixtures/unit/configuration_subsystem/ansible-navigator.yml b/tests/fixtures/unit/configuration_subsystem/ansible-navigator.yml
index bc5e76c5a..33630fc0e 100644
--- a/tests/fixtures/unit/configuration_subsystem/ansible-navigator.yml
+++ b/tests/fixtures/unit/configuration_subsystem/ansible-navigator.yml
@@ -5,7 +5,7 @@ ansible-navigator:
     config: /tmp/ansible.cfg
     cmdline: "--forks 15"
     inventories:
-    - /tmp/test_inventory.yml
+      - /tmp/test_inventory.yml
     playbook: /tmp/test_playbook.yml
   ansible-builder:
     workdir: /tmp/
@@ -43,11 +43,11 @@ ansible-navigator:
     image: test_image:latest
     pull-policy: never
     volume-mounts:
-    - src: "/test1"
-      dest: "/test1"
-      label: "Z"
+      - src: "/test1"
+        dest: "/test1"
+        label: "Z"
     container-options:
-    - "--net=host"
+      - "--net=host"
   help-builder: False
   help-config: True
   help-doc: True