Skip to content

Commit 70dced1

Browse files
lib: fixed spelling errors in comments
Co-authored-by: Christian Clauss <[email protected]>
1 parent 0f4097a commit 70dced1

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

lib/find-python.js

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ function colorizeOutput (color, string) {
6565
}
6666

6767
//! on windows debug running with locale cmd (e. g. chcp 866) encoding
68-
// to avoid that uncoment next lines
69-
// locale encdoings couse issues. See run func for more info
68+
// to avoid that uncomment next lines
69+
// locale encodings cause issues. See run func for more info
7070
// this lines only for testing
7171
// win ? cp.execSync("chcp 65001") : null
7272
// log.level = "silly";
@@ -78,7 +78,7 @@ class PythonFinder {
7878
/**
7979
*
8080
* @param {string} configPython force setted from terminal or npm config python path
81-
* @param {(err:Error, found:string) => void} callback succsed/error callback from where result
81+
* @param {(err:Error, found:string) => void} callback succeed/error callback from where result
8282
* is available
8383
*/
8484
constructor (configPython, callback) {
@@ -137,7 +137,7 @@ class PythonFinder {
137137
}
138138

139139
/**
140-
* Getting list of checks which should be cheked
140+
* Getting list of checks which should be checked
141141
*
142142
* @private
143143
* @returns {check[]}
@@ -284,7 +284,7 @@ class PythonFinder {
284284
* @argument {check[]} checks
285285
*/
286286
async runChecks (checks) {
287-
// using this flag becouse Fail is happen when ALL checks fail
287+
// using this flag because Fail is happen when ALL checks fail
288288
let fail = true
289289

290290
for (const check of checks) {
@@ -347,7 +347,7 @@ class PythonFinder {
347347
let args = this.argsExecutable
348348
let shell = false
349349
if (this.win) {
350-
// Arguments have to be manually quoted to avoid bugs with spaces in pathes
350+
// Arguments have to be manually quoted to avoid bugs with spaces in paths
351351
exec = `"${exec}"`
352352
args = args.map((a) => `"${a}"`)
353353
shell = true
@@ -382,8 +382,8 @@ class PythonFinder {
382382

383383
/**
384384
*
385-
* Check if a getted path is correct and
386-
* Python executable hase the correct version to use.
385+
* Check if a gotten path is correct and
386+
* Python executable has the correct version to use.
387387
*
388388
* @private
389389
* @argument {string} execPath path to check
@@ -398,7 +398,7 @@ class PythonFinder {
398398
this.run(execPath, this.argsVersion, false)
399399
.then((ver) => {
400400
// ? may be better code for version check
401-
// ? may be move log messgaes to catchError func
401+
// ? may be move log messages to catchError func
402402
const range = new semver.Range(this.semverRange)
403403
let valid = false
404404

@@ -426,7 +426,7 @@ class PythonFinder {
426426
colorizeOutput(RED, 'THIS VERSION OF PYTHON IS NOT SUPPORTED')
427427
)
428428
// object with error passed for conveniences
429-
// (becouse we may want to pass also stderr or some additional stuff)
429+
// (because we may also want to pass stderr or other variables)
430430
// eslint-disable-next-line prefer-promise-reject-errors
431431
reject({
432432
err: new Error(`Found unsupported Python version ${ver}`)
@@ -471,27 +471,26 @@ class PythonFinder {
471471
)
472472
this.log.silly('execFile: opts = ', JSON.stringify(opts, null, 2))
473473

474-
//* prosible outcomes with error messages on windows (err.message, error.stack?, stderr)
474+
//* possible outcomes with error messages on Windows (err.message, error.stack?, stderr)
475475
// issue of encoding (garbage in terminal ) when 866 or any other locale code
476476
// page is setted
477477
// possible solutions:
478-
// 1. let it be as it is and just warn user that it should use utf8
479-
// (already done in this.catchErros's info statement)
480-
// 2. somehow determine user's terminal encdoing and use utils.TextDecoder
481-
// with getting raw buffer from execFile.
482-
// Requires to correct error.message becouse garbage persists there
483-
// 3. Forse user's terminal to use utf8 encoding via e.g. run "chcp 65001". May broke some user's programs
484-
// 4. use "cmd" command with flag "/U" and "/C" (for more informatiom run "help cmd")
478+
// 1. leave it as is and just warn the user that it should use utf8
479+
// (already done in this.catchError's info statement)
480+
// 2. somehow determine the user's terminal encoding and use utils.TextDecoder
481+
// with the raw buffer from execFile.
482+
// Requires to correct error.message because garbage persists there
483+
// 3. Force the user's terminal to use utf8 encoding via e.g. run "chcp 65001". May break user's programs
484+
// 4. use "cmd" command with flag "/U" and "/C" (for more information run "help cmd")
485485
// which "Causes the output of
486486
// internal commands ... to be Unicode" (utf16le)
487487
//* note: find-python-script.py already send output in utf8 then may become necessary
488488
//* to reencode string with Buffer.from(stderr).toString() or something
489489
//* similar (if needed)
490-
// for this solution all execFile call should look like execFile("cmd /U /C", [command to run, arg1, arg2, ...])
491-
//* all pathes/commands and each argument must be in quotes becouse if they have
492-
//* spaces inside they will broke everything
490+
// for this solution all execFile call should look like execFile("cmd", ["/U", "/C", command to run, arg1, arg2, ...])
491+
//* all paths/commands and each argument must be in quotes if they contain spaces
493492

494-
//* assume that user use utf8 compatible terminal
493+
//* assume we have a utf8 compatible terminal
495494
this.execFile(exec, args, opts, execFileCallback.bind(this))
496495

497496
/**
@@ -506,13 +505,13 @@ class PythonFinder {
506505
(err && err.stack) || err
507506
)
508507

509-
// executed script shouldn't pass anythong to stderr if successful
508+
// executed script shouldn't pass anything to stderr if successful
510509
if (err || stderr) {
511510
reject({ err: err || null, stderr: stderr || null })
512511
} else {
513-
// trim() function remove string endings that break string comparsion
514-
const stdoutTrimed = stdout.trim()
515-
resolve(stdoutTrimed)
512+
// trim() function removes string endings that would break string comparison
513+
const stdoutTrimmed = stdout.trim()
514+
resolve(stdoutTrimmed)
516515
}
517516
}
518517
}.bind(this)
@@ -537,7 +536,7 @@ class PythonFinder {
537536
// array of error codes (type of errors) that we handling
538537
const catchedErrorsCods = ['ENOENT', 9009]
539538

540-
// dont know type of terminal errors
539+
// don't know type of terminal errors
541540
// @ts-ignore
542541
if (catchedErrorsCods.includes(err ? err.code : undefined)) {
543542
// @ts-ignore
@@ -624,7 +623,7 @@ class PythonFinder {
624623
process.nextTick(
625624
this.callback.bind(
626625
null,
627-
// if changing error message dont forget also change it test file too
626+
// if changing error message don't forget also change it test file too
628627
new Error('Could not find any Python installation to use')
629628
)
630629
)
@@ -634,7 +633,7 @@ class PythonFinder {
634633
/**
635634
*
636635
* @param {string} configPython force setted from terminal or npm config python path
637-
* @param {(err:Error, found:string)=> void} callback succsed/error callback from where result
636+
* @param {(err:Error, found:string)=> void} callback succeed/error callback from where result
638637
* is available
639638
*/
640639
function findPython (configPython, callback) {

0 commit comments

Comments
 (0)