Skip to content

Commit 84182c9

Browse files
Merge branch 'stdlib-js:develop' into stats/cumin
2 parents 7625eb3 + b2909e4 commit 84182c9

File tree

815 files changed

+11772
-2295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

815 files changed

+11772
-2295
lines changed

.github/workflows/scripts/create_address_commit_comments_issues

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,25 @@ is_core_contributor() {
233233

234234
# Updates two indexed arrays (commit_keys and commit_counts) to simulate a map.
235235
#
236-
# $1 - Commit SHA (the key)
237-
# $2 - Comment URL (the link)
236+
# $1 - Full comment object (JSON)
238237
update_commit_map() {
239-
local key="$1"
240-
local link="$2"
238+
local comment="$1"
239+
local key=$(echo "$comment" | jq -r '.commit_id')
240+
local link=$(echo "$comment" | jq -r '.html_url')
241+
local body=$(echo "$comment" | jq -r '.body')
242+
local line=$(echo "$comment" | jq -r '.line')
243+
local path=$(echo "$comment" | jq -r '.path')
241244
local found=0
242245
local i=0
243246

247+
local startLine=$(( line - 3 ))
248+
local endLine=$(( line + 3 ))
249+
local code_snippet="https://github.com/stdlib-js/stdlib/blob/${key}/${path}#L${startLine}-L${endLine}"
250+
244251
for existing in "${commit_keys[@]}"; do
245252
if [ "$existing" = "$key" ]; then
246253
commit_counts[i]=$(( commit_counts[i] + 1 ))
247-
# Append the comment URL (on a new bullet) to the existing list:
248-
commit_links[i]="${commit_links[i]}"$'\n'"- ${link}"
254+
commit_comments[i]="${commit_comments[i]}"$'\n\n'"- ${link}"$'\n\n'" > **Line ${line}**: ${body}"$'\n\n'" ${code_snippet}"
249255
found=1
250256
break
251257
fi
@@ -255,7 +261,7 @@ update_commit_map() {
255261
if [ "$found" -eq 0 ]; then
256262
commit_keys+=("$key")
257263
commit_counts+=("1")
258-
commit_links+=("- ${link}")
264+
commit_comments+=("- ${link}"$'\n\n'" > **Line ${line}**: ${body}"$'\n\n'" ${code_snippet}")
259265
fi
260266
}
261267

@@ -339,12 +345,12 @@ main() {
339345

340346
commit_keys=()
341347
commit_counts=()
342-
commit_links=()
348+
commit_comments=()
343349

344350
for comment in "${all_comments[@]}"; do
345351
# Extract the comment body:
346-
local comment_body
347-
comment_body=$(echo "$comment" | jq -r '.body')
352+
local comment_body=$(echo "$comment" | jq -r '.body')
353+
local comment_line=$(echo "$comment" | jq -r '.line')
348354

349355
# Check if the comment body contains '@stdlib-bot':
350356
if [[ "$comment_body" == *"@stdlib-bot"* ]]; then
@@ -357,10 +363,7 @@ main() {
357363
local commit_sha
358364
commit_sha=$(echo "$comment" | jq -r '.commit_id')
359365
if [ -n "$commit_sha" ]; then
360-
# Extract the comment URL:
361-
local comment_url
362-
comment_url=$(echo "$comment" | jq -r '.html_url')
363-
update_commit_map "$commit_sha" "$comment_url"
366+
update_commit_map "$comment"
364367
fi
365368
else
366369
echo "Skipping comment by non-core contributor: ${comment_author}" >&2
@@ -373,7 +376,7 @@ main() {
373376
for idx in $(seq 0 $(( ${#commit_keys[@]} - 1 ))); do
374377
local commit_sha="${commit_keys[$idx]}"
375378
local count="${commit_counts[$idx]}"
376-
local links="${commit_links[$idx]}"
379+
local comments="${commit_comments[$idx]}"
377380

378381
# Generate a short SHA (first 7 characters):
379382
local short_sha=${commit_sha:0:7}
@@ -385,7 +388,7 @@ main() {
385388
386389
**Comments:**
387390
388-
${links}
391+
${comments}
389392
390393
Interested in helping improve the project? If you are, the comment linked to above has **${count}** comment(s) from core contributors that could use your attention.
391394

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Rejoan Sardar <[email protected]>
9494
Ricky Reusser <[email protected]>
9595
Ridam Garg <[email protected]>
9696
97+
Rishav Tarway <[email protected]>
9798
Robert Gislason <[email protected]>
9899
Roman Stetsyk <[email protected]>
99100
Rutam Kathale <[email protected]>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
type: amend-message
3+
---
4+
chore: fix copy & paste error
5+
PR-URL: #5247
6+
Ref: #5230
7+
8+
Reviewed-by: Philipp Burckhardt <[email protected]>

docs/migration-guides/mathjs/benchmark/benchmark.multiply.number.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var bench = require( '@stdlib/bench' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var filledBy = require( '@stdlib/array/filled-by' );
2727
var uniform = require( '@stdlib/random/base/uniform' ).factory;
28-
var base = require( '@stdlib/math/base/ops/mul' );
28+
var base = require( '@stdlib/number/float64/base/mul' );
2929
var tryRequire = require( '@stdlib/utils/try-require' );
3030
var pkg = require( './../package.json' ).name;
3131

@@ -40,7 +40,7 @@ var opts = {
4040

4141
// MAIN //
4242

43-
bench( pkg+'::stdlib:math/base/ops/mul:value=number', opts, function benchmark( b ) {
43+
bench( pkg+'::stdlib:number/float64/base/mul:value=number', opts, function benchmark( b ) {
4444
var x;
4545
var y;
4646
var z;

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-no-tabs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# No Tabs
2222

23-
> [ESLint rule][eslint-rules] forbidding the use of tabs in JSDoc descriptions.
23+
> [ESLint rule][eslint-rules] forbidding the use of tabs in JSDoc comments.
2424
2525
<section class="intro">
2626

@@ -38,7 +38,7 @@ var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-no-tabs' );
3838

3939
#### rule
4040

41-
[ESLint rule][eslint-rules] forbidding the use of tabs in JSDoc descriptions.
41+
[ESLint rule][eslint-rules] forbidding the use of tabs in JSDoc comments.
4242

4343
**Bad**:
4444

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-no-tabs/lib/main.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,24 @@
2020

2121
// MODULES //
2222

23-
var parseJSDoc = require( 'doctrine' ).parse;
2423
var remark = require( 'remark' );
2524
var remarkLint = require( 'remark-lint' );
2625
var remarkPlugin = require( 'remark-lint-no-tabs' );
26+
var replace = require( '@stdlib/string/replace' );
2727
var isObject = require( '@stdlib/assert/is-object' );
2828
var findJSDoc = require( '@stdlib/_tools/eslint/utils/find-jsdoc' );
2929

3030

3131
// VARIABLES //
3232

33-
var DOPTS = {
34-
'sloppy': true,
35-
'unwrap': true
36-
};
33+
var RE_LEADING_TABS = /^\t+(\*|$)/gm;
3734
var rule;
3835

3936

4037
// FUNCTIONS //
4138

4239
/**
43-
* Rule forbidding the use of tabs in JSDoc descriptions.
40+
* Rule forbidding the use of tabs in JSDoc comments.
4441
*
4542
* @param {Object} context - ESLint context
4643
* @returns {Object} validators
@@ -67,24 +64,23 @@ function main( context ) {
6764
};
6865

6966
/**
70-
* Lints JSDoc descriptions.
67+
* Lints entire JSDoc comments for tabs.
7168
*
7269
* @private
7370
* @param {ASTNode} node - AST node
7471
*/
7572
function validate( node ) {
7673
var jsdoc;
7774
var vfile;
78-
var ast;
75+
var text;
7976

8077
jsdoc = findJSDoc( source, node );
8178
if ( isObject( jsdoc ) ) {
82-
ast = parseJSDoc( jsdoc.value, DOPTS );
83-
if ( ast.description ) {
84-
vfile = lint( ast.description );
85-
if ( vfile.messages.length ) {
86-
reportErrors( vfile.messages, jsdoc.loc );
87-
}
79+
text = jsdoc.value;
80+
text = replace( text, RE_LEADING_TABS, '*' );
81+
vfile = lint( text );
82+
if ( vfile.messages.length ) {
83+
reportErrors( vfile.messages, jsdoc.loc );
8884
}
8985
}
9086
}
@@ -154,7 +150,7 @@ function main( context ) {
154150
rule = {
155151
'meta': {
156152
'docs': {
157-
'description': 'forbid the use of tabs in JSDoc descriptions'
153+
'description': 'forbid the use of tabs in JSDoc comments'
158154
},
159155
'schema': []
160156
},

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-no-tabs/test/fixtures/invalid.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,66 @@ test = {
7070
};
7171
invalid.push( test );
7272

73+
test = {
74+
'code': [
75+
'/**',
76+
'* Beep boop.',
77+
'*',
78+
'* [foo]: http://foo.bar/baz',
79+
'*',
80+
'* @param {string} str - input value',
81+
'* @returns {string} output value',
82+
'*',
83+
'* @example',
84+
'* var out = beep( "boop" );',
85+
'* // returns "beepboop"',
86+
'*/',
87+
'function beep( str ) {',
88+
' return "beep" + str;',
89+
'}'
90+
].join( '\n' ),
91+
'errors': [
92+
{
93+
'message': 'Use spaces instead of tabs',
94+
'type': null
95+
},
96+
{
97+
'message': 'Use spaces instead of tabs',
98+
'type': null
99+
}
100+
]
101+
};
102+
invalid.push( test );
103+
104+
test = {
105+
'code': [
106+
'/**',
107+
'* Beep boop.',
108+
'*',
109+
'* @param {string} str - input value',
110+
'* @returns {string} output value',
111+
'*',
112+
'* @example',
113+
'* var out = beep( "boop" );',
114+
'* // returns "beepboop"',
115+
'*/',
116+
'function beep( str ) {',
117+
' return "beep" + str;',
118+
'}'
119+
].join( '\n' ),
120+
'errors': [
121+
{
122+
'message': 'Use spaces instead of tabs',
123+
'type': null
124+
},
125+
{
126+
'message': 'Use spaces instead of tabs',
127+
'type': null
128+
}
129+
]
130+
};
131+
invalid.push( test );
132+
73133

74134
// EXPORTS //
75135

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-no-tabs/test/fixtures/valid.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,72 @@ test = {
4848
};
4949
valid.push( test );
5050

51+
test = {
52+
'code': [
53+
'/**',
54+
'* @license Apache-2.0',
55+
'*',
56+
'* Copyright (c) 2018 The Stdlib Authors.',
57+
'*',
58+
'* Licensed under the Apache License, Version 2.0 (the "License");',
59+
'* you may not use this file except in compliance with the License.',
60+
'* You may obtain a copy of the License at',
61+
'*',
62+
'* http://www.apache.org/licenses/LICENSE-2.0',
63+
'*',
64+
'* Unless required by applicable law or agreed to in writing, software',
65+
'* distributed under the License is distributed on an "AS IS" BASIS,',
66+
'* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
67+
'* See the License for the specific language governing permissions and',
68+
'* limitations under the License.',
69+
'*/',
70+
'',
71+
'/**',
72+
'* Squares a number.',
73+
'* ',
74+
'* @param {number} x - input number',
75+
'* @returns {number} x squared',
76+
'*',
77+
'* @example',
78+
'* var y = square( 2.0 );',
79+
'* // returns 4.0',
80+
'*/',
81+
'function square( x ) {',
82+
' return x*x;',
83+
'}'
84+
].join( '\n' )
85+
};
86+
valid.push( test );
87+
88+
test = {
89+
'code': [
90+
'/**',
91+
'* Creates a function to calculate powers.',
92+
'*',
93+
'* @param {number} base - base number',
94+
'* @returns {Function} function to calculate powers',
95+
'*',
96+
'* @example',
97+
'* var powerFn = createPowerFn( 2 );',
98+
'* var result = powerFn( 3 );',
99+
'* // returns 8',
100+
'*/',
101+
'function createPowerFn( base ) {',
102+
' /**',
103+
' * Calculates power of base number.',
104+
' *',
105+
' * @private',
106+
' * @param {number} exponent - power to raise base to',
107+
' * @returns {number} result of base raised to exponent',
108+
' */',
109+
' return function power( exponent ) {',
110+
' return Math.pow( base, exponent );',
111+
' };',
112+
'}'
113+
].join( '\n' )
114+
};
115+
valid.push( test );
116+
51117
test = {
52118
'code': [
53119
'/**',

0 commit comments

Comments
 (0)