Skip to content

Commit 76d5e02

Browse files
committed
Rename environment variable and update documentation
1 parent 9512dbe commit 76d5e02

File tree

2 files changed

+92
-40
lines changed

2 files changed

+92
-40
lines changed

tools/make/lib/complexity/javascript.mk

Lines changed: 90 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# VARIABLES #
2020

2121
# Define the output directory:
22-
JAVASCRIPT_COMPLEXITY_DIR ?= $(COMPLEXITY_DIR)/javascript
22+
JAVASCRIPT_COMPLEXITY_OUT ?= $(COMPLEXITY_DIR)/javascript
2323

2424

2525
# DEPENDENCIES #
@@ -31,93 +31,145 @@ endif
3131

3232
# RULES #
3333

34-
# Analyze code complexity.
35-
#
36-
# This target analyzes all JavaScript source code.
34+
#/
35+
# Analyzes code complexity for all JavaScript code.
3736
#
3837
# TODO: address bash argument length errors
39-
38+
#
39+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory
40+
#
41+
# @example
42+
# make complexity-javascript
43+
#
44+
# @example
45+
# make complexity-javascript JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
46+
#/
4047
complexity-javascript: $(NODE_MODULES)
4148
$(QUIET) $(JAVASCRIPT_COMPLEXITY) $(JAVASCRIPT_COMPLEXITY_FLAGS) $(SOURCES) $(TESTS) $(EXAMPLES) $(BENCHMARKS)
4249

4350
.PHONY: complexity-javascript
4451

45-
46-
# Analyze source code complexity.
47-
#
48-
# This target analyzes only JavaScript source files.
52+
#/
53+
# Analyzes code complexity for JavaScript source code.
4954
#
5055
# TODO: address bash argument length errors
51-
56+
#
57+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory
58+
#
59+
# @example
60+
# make complexity-javascript-src
61+
#
62+
# @example
63+
# make complexity-javascript-src JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
64+
#/
5265
complexity-javascript-src: $(NODE_MODULES)
5366
$(QUIET) $(JAVASCRIPT_COMPLEXITY) $(JAVASCRIPT_COMPLEXITY_FLAGS) $(SOURCES)
5467

5568
.PHONY: complexity-javascript-src
5669

57-
58-
# Analyze test code complexity.
59-
#
60-
# This target analyzes only JavaScript test files.
70+
#/
71+
# Analyzes code complexity for JavaScript test files.
6172
#
6273
# TODO: address bash argument length errors
63-
74+
#
75+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory
76+
#
77+
# @example
78+
# make complexity-javascript-tests
79+
#
80+
# @example
81+
# make complexity-javascript-tests JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
82+
#/
6483
complexity-javascript-tests: $(NODE_MODULES)
6584
$(QUIET) $(JAVASCRIPT_COMPLEXITY) $(JAVASCRIPT_COMPLEXITY_FLAGS) $(TESTS)
6685

6786
.PHONY: complexity-javascript-tests
6887

69-
70-
# Analyze example code complexity.
71-
#
72-
# This target analyzes only JavaScript example files.
88+
#/
89+
# Analyzes code complexity for JavaScript example files.
7390
#
7491
# TODO: address bash argument length errors
75-
92+
#
93+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory
94+
#
95+
# @example
96+
# make complexity-javascript-examples
97+
#
98+
# @example
99+
# make complexity-javascript-examples JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
100+
#/
76101
complexity-javascript-examples: $(NODE_MODULES)
77102
$(QUIET) $(JAVASCRIPT_COMPLEXITY) $(JAVASCRIPT_COMPLEXITY_FLAGS) $(EXAMPLES)
78103

79104
.PHONY: complexity-javascript-examples
80105

81-
82-
# Analyze benchmark code complexity.
83-
#
84-
# This target analyzes only JavaScript benchmark files.
106+
#/
107+
# Analyzes code complexity for JavaScript benchmark files.
85108
#
86109
# TODO: address bash argument length errors
87-
110+
#
111+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory
112+
#
113+
# @example
114+
# make complexity-javascript-benchmarks
115+
#
116+
# @example
117+
# make complexity-javascript-benchmarks JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
118+
#/
88119
complexity-javascript-benchmarks: $(NODE_MODULES)
89120
$(QUIET) $(JAVASCRIPT_COMPLEXITY) $(JAVASCRIPT_COMPLEXITY_FLAGS) $(BENCHMARKS)
90121

91122
.PHONY: complexity-javascript-benchmarks
92123

93-
94-
# Analyze code complexity.
124+
#/
125+
# Analyzes code complexity for a list of JavaScript files.
95126
#
96-
# This target analyzes JavaScript code complexity. Note that we expect `$FILES` to be a JavaScript file list.
97-
127+
# TODO: address bash argument length errors
128+
#
129+
# @param {string} FILES - list of JavaScript file paths
130+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory
131+
#
132+
# @example
133+
# make complexity-javascript-files FILES='/foo/bar.js /beep/boop.js'
134+
#
135+
# @example
136+
# make complexity-javascript-files FILES='/foo/bar.js /beep/boop.js' JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
137+
#/
98138
complexity-javascript-files: $(NODE_MODULES)
99139
$(QUIET) $(JAVASCRIPT_COMPLEXITY) $(JAVASCRIPT_COMPLEXITY_FLAGS) $(FILES)
100140

101141
.PHONY: complexity-javascript-files
102142

103-
104-
# View a complexity report.
143+
#/
144+
# Opens an HTML JavaScript complexity report in a local web browser.
105145
#
106-
# This target opens an HTML JavaScript complexity report in a local web browser.
107-
146+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory containing an HTML JavaScript complexity report
147+
#
148+
# @example
149+
# make view-javascript-complexity
150+
#
151+
# @example
152+
# make view-javascript-complexity JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
153+
#/
108154
view-javascript-complexity:
109155
ifeq ($(JAVASCRIPT_COMPLEXITY_TOOL), plato)
110156
$(QUIET) $(MAKE) -f $(this_file) view-plato-report
111157
endif
112158

113159
.PHONY: view-javascript-complexity
114160

115-
116-
# Remove a complexity directory.
161+
#/
162+
# Removes an output complexity directory.
117163
#
118-
# This target cleans up a JavaScript complexity directory by removing it entirely.
119-
164+
# @param {string} [JAVASCRIPT_COMPLEXITY_OUT] - output directory to be removed
165+
#
166+
# @example
167+
# make clean-javascript-complexity
168+
#
169+
# @example
170+
# make clean-javascript-complexity JAVASCRIPT_COMPLEXITY_OUT=/foo/bar/beep/boop
171+
#/
120172
clean-javascript-complexity:
121-
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(JAVASCRIPT_COMPLEXITY_DIR)
173+
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(JAVASCRIPT_COMPLEXITY_OUT)
122174

123175
.PHONY: clean-javascript-complexity

tools/make/lib/complexity/plato.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ JAVASCRIPT_COMPLEXITY ?= $(PLATO)
3636
PLATO_REPORT_TITLE ?= 'JavaScript Complexity'
3737

3838
# Define the output file path for the HTML report generated by plato:
39-
PLATO_HTML_REPORT ?= $(JAVASCRIPT_COMPLEXITY_DIR)/index.html
39+
PLATO_HTML_REPORT ?= $(JAVASCRIPT_COMPLEXITY_OUT)/index.html
4040

4141
# Define the command-line options to use when invoking the plato executable:
4242
JAVASCRIPT_COMPLEXITY_FLAGS ?= \
43-
--dir $(JAVASCRIPT_COMPLEXITY_DIR) \
43+
--dir $(JAVASCRIPT_COMPLEXITY_OUT) \
4444
--title $(PLATO_REPORT_TITLE)
4545

4646

0 commit comments

Comments
 (0)