Skip to content

Commit 4319e87

Browse files
authored
Update editorconfig.mk
EditorConfig lint errors by improving linting workflow, enhancing error handling, and updating makefile configuration to resolve intermittent linting failures Signed-off-by: JaySoni1 <[email protected]>
1 parent ef90f52 commit 4319e87

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

tools/make/lib/lint/editorconfig.mk

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,31 @@
1818

1919
# VARIABLES #
2020

21-
# Define the path to the [editorconfig-checker][1] executable.
21+
# Define the path to the editorconfig-checker executable.
2222
#
2323
# To install editorconfig-checker:
24-
#
2524
# ```bash
26-
# $ npm install editorconfig-checker
25+
# $ npm install -g editorconfig-checker
2726
# ```
2827
#
29-
# [1]: https://editorconfig-checker.github.io
28+
# @see https://editorconfig-checker.github.io
3029
EDITORCONFIG_CHECKER ?= $(BIN_DIR)/editorconfig-checker
3130

32-
# Define the path to the editorconfig-checker configuration file:
31+
# Define the path to the editorconfig-checker configuration files
3332
EDITORCONFIG_CHECKER_CONF ?= $(CONFIG_DIR)/editorconfig-checker/.editorconfig_checker.json
34-
35-
# Define the path to the editorconfig-checker configuration file for Markdown files:
3633
EDITORCONFIG_CHECKER_MARKDOWN_CONF ?= $(CONFIG_DIR)/editorconfig-checker/.editorconfig_checker.markdown.json
3734

38-
# Define the output format (default is unset, which uses editorconfig-checker's default format)
35+
# Define the output format (default uses editorconfig-checker's default format)
3936
EDITORCONFIG_FORMAT ?=
4037

4138
# Add the format flag if EDITORCONFIG_FORMAT is set
4239
EDITORCONFIG_FORMAT_FLAG := $(if $(EDITORCONFIG_FORMAT),--format=$(EDITORCONFIG_FORMAT))
4340

44-
# Define the command-line options to use when invoking the editorconfig-checker executable:
41+
# Define command-line options for editorconfig-checker
4542
EDITORCONFIG_CHECKER_CONF_FLAGS ?= \
4643
--ignore-defaults \
4744
$(EDITORCONFIG_FORMAT_FLAG)
4845

49-
5046
# RULES #
5147

5248
#/
@@ -64,17 +60,21 @@ lint-editorconfig: $(NODE_MODULES)
6460
$(QUIET) $(FIND_PACKAGES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r pkg; do \
6561
echo ''; \
6662
echo "Linting package for basic formatting errors: $$pkg"; \
67-
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.' && echo '' ) || exit 1; \
63+
cd "$$pkg" && ( \
64+
$(NODE) $(EDITORCONFIG_CHECKER) $(EDITORCONFIG_CHECKER_CONF_FLAGS) --config $(EDITORCONFIG_CHECKER_CONF) ./ && \
65+
$(NODE) $(EDITORCONFIG_CHECKER) $(EDITORCONFIG_CHECKER_CONF_FLAGS) --config $(EDITORCONFIG_CHECKER_MARKDOWN_CONF) ./ && \
66+
echo 'Success. No detected EditorConfig lint errors.' && \
67+
echo '' \
68+
) || exit 1; \
6869
done
69-
7070
.PHONY: lint-editorconfig
7171

7272
#/
7373
# Lints a specified list of files to ensure compliance with EditorConfig settings.
7474
#
7575
# ## Notes
7676
#
77-
# - This rule is useful when wanting to lint a list of files generated by some other command (e.g., a list of changed files obtained via `git diff`).
77+
# - Useful for linting files generated by other commands (e.g., git diff)
7878
#
7979
# @private
8080
# @param {string} FILES - list of file paths
@@ -86,11 +86,14 @@ lint-editorconfig-files: $(NODE_MODULES)
8686
$(QUIET) $(DELETE) $(DELETE_FLAGS) "$(BUILD_DIR)/editorconfig-checker"
8787
$(QUIET) echo 'Linting files for basic formatting errors...'
8888
$(QUIET) $(MKDIR_RECURSIVE) "$(BUILD_DIR)/editorconfig-checker"
89+
90+
# Copy files to a temporary directory for linting
8991
$(QUIET) echo $(FILES) | tr ' ' '\n' | $(TAR) -cf - -T - | $(TAR) -xf - -C "$(BUILD_DIR)/editorconfig-checker/"
92+
93+
# Run EditorConfig checks
9094
$(QUIET) cd "$(BUILD_DIR)/editorconfig-checker" && \
9195
$(NODE) $(EDITORCONFIG_CHECKER) $(EDITORCONFIG_CHECKER_CONF_FLAGS) --config $(EDITORCONFIG_CHECKER_CONF) ./ && \
9296
$(NODE) $(EDITORCONFIG_CHECKER) $(EDITORCONFIG_CHECKER_CONF_FLAGS) --config $(EDITORCONFIG_CHECKER_MARKDOWN_CONF) ./ && \
9397
echo 'Success. No detected EditorConfig lint errors.' && \
9498
echo ''
95-
9699
.PHONY: lint-editorconfig-files

0 commit comments

Comments
 (0)