|
| 1 | +#/ |
| 2 | +# @license Apache-2.0 |
| 3 | +# |
| 4 | +# Copyright (c) 2024 The Stdlib Authors. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +#/ |
| 18 | + |
| 19 | +# VARIABLES # |
| 20 | + |
| 21 | +# Define the path to the [editorconfig-checker][1] executable. |
| 22 | +# |
| 23 | +# To install editorconfig-checker: |
| 24 | +# |
| 25 | +# ```bash |
| 26 | +# $ npm install editorconfig-checker |
| 27 | +# ``` |
| 28 | +# |
| 29 | +# [1]: https://editorconfig-checker.github.io |
| 30 | +EDITORCONFIG_CHECKER ?= $(BIN_DIR)/editorconfig-checker |
| 31 | + |
| 32 | +# Define the path to the editorconfig-checker configuration file: |
| 33 | +EDITORCONFIG_CHECKER_CONF ?= $(CONFIG_DIR)/editorconfig-checker/.editorconfig_checker.json |
| 34 | + |
| 35 | +# Define the path to the editorconfig-checker configuration file for Markdown files: |
| 36 | +EDITORCONFIG_CHECKER_MARKDOWN_CONF ?= $(CONFIG_DIR)/editorconfig-checker/.editorconfig_checker.markdown.json |
| 37 | + |
| 38 | +# Define the command-line options to use when invoking the editorconfig-checker executable: |
| 39 | +EDITORCONFIG_CHECKER_CONF_FLAGS ?= \ |
| 40 | + --ignore-defaults |
| 41 | + |
| 42 | + |
| 43 | +# RULES # |
| 44 | + |
| 45 | +#/ |
| 46 | +# Lints files to ensure compliance with EditorConfig settings. |
| 47 | +# |
| 48 | +# @param {string} [PACKAGES_FILTER] - file path pattern (e.g., `.*/math/base/special/abs/.*`) |
| 49 | +# |
| 50 | +# @example |
| 51 | +# make lint-editorconfig |
| 52 | +# |
| 53 | +# @example |
| 54 | +# make lint-editorconfig PACKAGES_FILTER=".*/math/base/special/abs/.*" |
| 55 | +#/ |
| 56 | +lint-editorconfig: $(NODE_MODULES) |
| 57 | + $(QUIET) $(FIND_PACKAGES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r pkg; do \ |
| 58 | + echo ''; \ |
| 59 | + echo "Linting package: $$pkg"; \ |
| 60 | + cd "$$pkg" && ( $(NODE) $(EDITORCONFIG_CHECKER) $(EDITORCONFIG_CHECKER_CONF_FLAGS) --config $(EDITORCONFIG_CHECKER_CONF) && $(NODE) $(EDITORCONFIG_CHECKER) $(EDITORCONFIG_CHECKER_CONF_FLAGS) --config $(EDITORCONFIG_CHECKER_MARKDOWN_CONF) && echo 'Success. No detected EditorConfig lint errors.' ) || exit 1; \ |
| 61 | + done |
| 62 | + |
| 63 | +.PHONY: lint-editorconfig |
0 commit comments