From ca9dd8cb7a450c32aa17d0c0f98cd0c63f190080 Mon Sep 17 00:00:00 2001
From: Christian Clauss
Date: Wed, 26 Nov 2025 09:27:42 +0100
Subject: [PATCH] Add pre-commit to run standard hooks plus codespell
---
.gitattributes | 2 +-
.github/CODEOWNERS | 2 +-
.github/workflows/ci-test.yml | 14 +-
.gitignore | 2 +-
.pre-commit-config.yaml | 48 ++++
CODE_OF_CONDUCT.md | 14 +-
LICENSE | 2 +-
README.md | 6 +-
package.json | 2 +-
src/scripts/setup-solr.sh | 0
tests/fixtures/solr_configs/8.x.x/schema.xml | 242 +++++++++---------
.../solr_configs/8.x.x/solrconfig.xml | 6 +-
tests/fixtures/solr_configs/9.x.x/schema.xml | 2 +-
13 files changed, 200 insertions(+), 142 deletions(-)
create mode 100644 .pre-commit-config.yaml
mode change 100644 => 100755 src/scripts/setup-solr.sh
diff --git a/.gitattributes b/.gitattributes
index bcc83e0..00f4c25 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
* text=auto eol=lf
-dist/** -diff linguist-generated=true
\ No newline at end of file
+dist/** -diff linguist-generated=true
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index b054dc3..4e92167 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1 +1 @@
-* @dhavalgojiya
\ No newline at end of file
+* @dhavalgojiya
diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml
index 5f86563..cfa36b5 100644
--- a/.github/workflows/ci-test.yml
+++ b/.github/workflows/ci-test.yml
@@ -7,8 +7,18 @@ on:
branches: [ "main" ]
jobs:
+ # -----------------
+ # Job 1: Pre-commit
+ # -----------------
+ pre-commit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v6
+ - uses: pre-commit/action@v3.0.1
+ - uses: pre-commit-ci/lite-action@v1.1.0
+ if: always()
# -----------------------------
- # Job 1: Package Checks & Build
+ # Job 2: Package Checks & Build
# -----------------------------
package:
runs-on: ubuntu-latest
@@ -90,7 +100,7 @@ jobs:
run: |
echo "Pinging Solr Core: ${SOLR_CORE}"
RESPONSE=$(curl -s --fail "http://127.0.0.1:8983/solr/${SOLR_CORE}/admin/ping?wt=json")
-
+
if echo "$RESPONSE" | grep -q '"status":"OK"'; then
echo "🎉 Solr is healthy and responding"
else
diff --git a/.gitignore b/.gitignore
index 794d0d3..be52143 100644
--- a/.gitignore
+++ b/.gitignore
@@ -112,4 +112,4 @@ out
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
-.pnp.*
\ No newline at end of file
+.pnp.*
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..a07441b
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,48 @@
+# Learn more about this config here: https://pre-commit.com/
+
+# To enable these pre-commit hooks run:
+# `pipx install pre-commit` or `brew install pre-commit`
+# Then in the project root directory run `pre-commit install`
+
+exclude: dist/
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v6.0.0
+ hooks:
+ - id: check-added-large-files
+ - id: check-case-conflict
+ - id: check-docstring-first
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-json
+ - id: check-merge-conflict
+ - id: check-shebang-scripts-are-executable
+ - id: check-symlinks
+ - id: check-toml
+ - id: check-vcs-permalinks
+ - id: check-xml
+ - id: check-yaml
+ - id: destroyed-symlinks
+ - id: detect-aws-credentials
+ args:
+ - --allow-missing-credentials
+ - id: detect-private-key
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ - id: forbid-new-submodules
+ - id: forbid-submodules
+ - id: mixed-line-ending
+ args:
+ - --fix=lf
+ - id: sort-simple-yaml
+ - id: trailing-whitespace
+
+ - repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words-list=nd
+ additional_dependencies:
+ - tomli
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index be8b83c..c6bee26 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -51,17 +51,17 @@ Community Moderators take reports of violations seriously and will make every ef
If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident’s impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped.
-1. **Warning**
- Event: A violation involving a single incident or series of actions.
+1. **Warning**
+ Event: A violation involving a single incident or series of actions.
Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
-2. **Temporary Ban**
- Event: A violation involving a series of actions or a single serious incident.
+2. **Temporary Ban**
+ Event: A violation involving a series of actions or a single serious incident.
Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
-3. **Permanent Ban**
- Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member.
- Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior.
+3. **Permanent Ban**
+ Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member.
+ Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior.
Repair: There is no possible repair in cases of this severity.
This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community.
diff --git a/LICENSE b/LICENSE
index 3a78751..8de64a3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
+SOFTWARE.
diff --git a/README.md b/README.md
index 7dec17a..1cf4f93 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-Easily spin up an [Apache Solr](https://solr.apache.org/) instance inside your **GitHub Actions CI** pipeline.
+Easily spin up an [Apache Solr](https://solr.apache.org/) instance inside your **GitHub Actions CI** pipeline.
This action makes it simple to provision Solr during your tests or builds, without needing complex manual setup.
It will:
@@ -223,14 +223,14 @@ This will simulate your workflow on your local machine using [act](https://githu
## 🤝 Contributing
-Want to improve this project? Contributions are welcome!
+Want to improve this project? Contributions are welcome!
Please check out the [Contributing Guide](./CONTRIBUTING.md) for details.
---
## 👨💻 About the Author
-Hi, I’m **Dhaval Gojiya** — a passionate **Software Engineer** and also a **Farmer** 🌱.
+Hi, I’m **Dhaval Gojiya** — a passionate **Software Engineer** and also a **Farmer** 🌱.
I love building open-source tools that simplify workflows, while staying curious and grounded in both tech and nature.
---
diff --git a/package.json b/package.json
index b8339fa..2f2fd20 100644
--- a/package.json
+++ b/package.json
@@ -27,4 +27,4 @@
"tsup": "^8.5.0",
"typescript": "^5.9.2"
}
-}
\ No newline at end of file
+}
diff --git a/src/scripts/setup-solr.sh b/src/scripts/setup-solr.sh
old mode 100644
new mode 100755
diff --git a/tests/fixtures/solr_configs/8.x.x/schema.xml b/tests/fixtures/solr_configs/8.x.x/schema.xml
index 69cf16d..d5559da 100644
--- a/tests/fixtures/solr_configs/8.x.x/schema.xml
+++ b/tests/fixtures/solr_configs/8.x.x/schema.xml
@@ -16,10 +16,10 @@
limitations under the License.
-->
-
@@ -67,15 +67,15 @@
+ -->
-
+
-
+ -->
+
@@ -173,7 +173,7 @@
using copyField below. This is to save space. Use this field for returning and
highlighting document content. Use the "text" field to search the content. -->
-
+
@@ -191,11 +191,11 @@
-
+
@@ -225,14 +225,14 @@
-
+
-
id
@@ -260,21 +260,21 @@
-
+
-
-
-
+
-
-
+
+
+ -->
-
+
@@ -348,11 +348,11 @@
-
+
@@ -634,7 +634,7 @@
@@ -666,7 +666,7 @@
-
@@ -680,12 +680,12 @@
+ any data added to them will be ignored outright. -->
-
+
@@ -749,26 +749,26 @@
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
@@ -795,27 +795,27 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -825,10 +825,10 @@
-
+
-
+
@@ -836,10 +836,10 @@
-
+
-
+
@@ -860,14 +860,14 @@
-
+
-
+
@@ -880,10 +880,10 @@
-
+
-
+
@@ -891,10 +891,10 @@
-
+
-
+
@@ -905,10 +905,10 @@
-
+
-
+
@@ -919,10 +919,10 @@
-
+
-
+
@@ -930,10 +930,10 @@
-
+
-
+
@@ -944,31 +944,31 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -976,10 +976,10 @@
-
+
-
+
@@ -989,7 +989,7 @@
-
+
@@ -1052,7 +1052,7 @@
This dictionary was built with MeCab, it defines a format for the features adapted
for the Korean language.
-
+
Nori also has a convenient user dictionary feature that allows overriding the statistical
model with your own entries for segmentation, part-of-speech tags and readings without a need
to specify weights. Notice that user dictionaries have not been subject to extensive testing.
@@ -1065,7 +1065,7 @@
-->
@@ -1078,17 +1078,17 @@
-
+
-
+
-
+
@@ -1096,10 +1096,10 @@
-
+
-
+
@@ -1109,10 +1109,10 @@
-
+
-
+
@@ -1122,20 +1122,20 @@
-
+
-
+
-
+
-
+
@@ -1143,10 +1143,10 @@
-
+
-
+
@@ -1154,19 +1154,19 @@
-
+
-
+
-
+
-
+
@@ -1184,8 +1184,8 @@