X Tutup
Skip to content

Commit 2d111a4

Browse files
authored
chore: fix pylint (electron#31138)
* chore: fix pylint * chore: fix linter errors
1 parent 22d683e commit 2d111a4

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

script/lib/git.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,8 @@ def remove_patch_filename(patch):
232232
def export_patches(repo, out_dir, patch_range=None, dry_run=False):
233233
if patch_range is None:
234234
patch_range, num_patches = guess_base_commit(repo)
235-
sys.stderr.write(
236-
"Exporting {} patches in {} since {}\n".format(num_patches, repo, patch_range[0:7])
237-
)
235+
sys.stderr.write("Exporting {} patches in {} since {}\n".format(
236+
num_patches, repo, patch_range[0:7]))
238237
patch_data = format_patch(repo, patch_range)
239238
patches = split_patches(patch_data)
240239

script/lib/native_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import subprocess
55
import sys
66

7-
from util import SRC_DIR
7+
from lib.util import SRC_DIR
88

99
PYYAML_LIB_DIR = os.path.join(SRC_DIR, 'third_party', 'pyyaml', 'lib')
1010
sys.path.append(PYYAML_LIB_DIR)

script/lint.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,21 @@ const IS_WINDOWS = process.platform === 'win32';
2929

3030
function spawnAndCheckExitCode (cmd, args, opts) {
3131
opts = Object.assign({ stdio: 'inherit' }, opts);
32-
const status = childProcess.spawnSync(cmd, args, opts).status;
33-
if (status) process.exit(status);
32+
const { error, status, signal } = childProcess.spawnSync(cmd, args, opts);
33+
if (error) {
34+
// the subsprocess failed or timed out
35+
console.error(error);
36+
process.exit(1);
37+
}
38+
if (status === null) {
39+
// the subprocess terminated due to a signal
40+
console.error(signal);
41+
process.exit(1);
42+
}
43+
if (status !== 0) {
44+
// `status` is an exit code
45+
process.exit(status);
46+
}
3447
}
3548

3649
function cpplint (args) {
@@ -91,7 +104,7 @@ const LINTERS = [{
91104
const rcfile = path.join(DEPOT_TOOLS, 'pylintrc');
92105
const args = ['--rcfile=' + rcfile, ...filenames];
93106
const env = Object.assign({ PYTHONPATH: path.join(SOURCE_ROOT, 'script') }, process.env);
94-
spawnAndCheckExitCode('pylint.py', args, { env });
107+
spawnAndCheckExitCode('pylint', args, { env });
95108
}
96109
}, {
97110
key: 'javascript',

script/patches-mtime-cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def main():
135135
json.load(f) # Make sure it's not an empty file
136136
print("Using existing mtime cache for patches")
137137
return 0
138-
except:
138+
except Exception:
139139
pass
140140

141141
try:

script/release/uploaders/upload.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def main():
100100
# Upload libcxx_objects.zip for linux only
101101
libcxx_objects = get_zip_name('libcxx-objects', ELECTRON_VERSION)
102102
libcxx_objects_zip = os.path.join(OUT_DIR, libcxx_objects)
103-
shutil.copy2(os.path.join(OUT_DIR, 'libcxx_objects.zip'), libcxx_objects_zip)
103+
shutil.copy2(os.path.join(OUT_DIR, 'libcxx_objects.zip'),
104+
libcxx_objects_zip)
104105
upload_electron(release, libcxx_objects_zip, args)
105106

106107
# Upload headers.zip and abi_headers.zip as non-platform specific

script/verify-ffmpeg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def main():
4848
# FIXME: Enable after ELECTRON_ENABLE_LOGGING works again
4949
# env['ELECTRON_ENABLE_LOGGING'] = 'true'
5050
testargs = [electron, test_path]
51-
if sys.platform != 'linux' and (platform.machine() == 'ARM64' or os.environ.get('TARGET_ARCH') == 'arm64'):
51+
if sys.platform != 'linux' and (platform.machine() == 'ARM64' or
52+
os.environ.get('TARGET_ARCH') == 'arm64'):
5253
testargs.append('--disable-accelerated-video-decode')
5354
subprocess.check_call(testargs, env=env)
5455
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)
X Tutup