Skip to content

Remove setting python.formatting.formatOnSave in favor of the vs code setting #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ecc1ca9
Fix Microsoft/vscode#37627 (#1368)
octref Nov 3, 2017
7c5778c
Version 0.7.0 of extension (#1381)
DonJayamanne Nov 9, 2017
9d1bf82
Update README.md
DonJayamanne Nov 9, 2017
ffba179
Update README.md
DonJayamanne Nov 9, 2017
905c713
sync fork with upstream
DonJayamanne Nov 10, 2017
acc2109
fix readme
DonJayamanne Nov 10, 2017
d470523
Merge branch 'master' of https://github.com/Microsoft/vscode-python
DonJayamanne Nov 16, 2017
d392e8b
merged upstream
DonJayamanne Nov 16, 2017
92f775f
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 20, 2017
32a6e53
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 21, 2017
4b30f2c
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 22, 2017
e396752
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 22, 2017
eff4792
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 28, 2017
4553c28
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 28, 2017
3c6520a
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 28, 2017
9e9db48
move files around
DonJayamanne Nov 28, 2017
ed5748b
remove format on save
DonJayamanne Nov 28, 2017
966e516
Merge remote-tracking branch 'upstream/master'
DonJayamanne Nov 28, 2017
4961c3f
Merge branch 'master' into removeFormatOnSave
DonJayamanne Nov 28, 2017
b312df7
merged with master
DonJayamanne Nov 28, 2017
129ae06
merged with master
DonJayamanne Nov 28, 2017
03f6de3
move browser file
DonJayamanne Nov 28, 2017
6875d63
updated error message
DonJayamanne Nov 28, 2017
05156cc
moved registry into platform directory
DonJayamanne Nov 28, 2017
8c476b2
removed unused file
DonJayamanne Nov 28, 2017
60d0b05
one setting per deprecation message
DonJayamanne Nov 28, 2017
346b3bb
notify gulp is alive
DonJayamanne Nov 28, 2017
58bacb2
renamed variable as per code review
DonJayamanne Nov 28, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 59 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const relative = require('relative');
const ts = require('gulp-typescript');
const watch = require('gulp-watch');
const cp = require('child_process');
const colors = require('colors/safe');

/**
* Hygiene works by creating cascading subsets of all our files and
Expand Down Expand Up @@ -179,7 +180,7 @@ const hygiene = exports.hygiene = (some, options) => {
}
};
}
const tsProject = ts.createProject('tsconfig.json', { strict: true });
const tsProject = ts.createProject('tsconfig.json', { strict: true, noImplicitAny: false });
const reporter = customReporter();
return tsProject(reporter);
}
Expand All @@ -203,7 +204,7 @@ const hygiene = exports.hygiene = (some, options) => {
return typescript
.pipe(es.through(null, function () {
if (errorCount > 0) {
this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'gulpfile.js\'.');
this.emit('error', 'Hygiene failed with ' + errorCount + ' errors 👎. Check \'gulpfile.js\'.');
} else {
this.emit('end');
}
Expand All @@ -214,18 +215,23 @@ gulp.task('hygiene', () => hygiene());

gulp.task('hygiene-watch', function () {
return watch(all, function () {
console.clear();
console.log('Checking hygiene...');
run(true, true);
});
});

function run(lintOnlyModifiedFiles, doNotExit) {
function exitProcessOnError(ex) {
console.error();
console.error(ex);
console.error(colors.red(ex));
if (!doNotExit) {
process.exit(1);
}
}
if (lintOnlyModifiedFiles && doNotExit) {
console.log('Watching for changes...');
}
}
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
exitProcessOnError();
Expand All @@ -239,20 +245,62 @@ function run(lintOnlyModifiedFiles, doNotExit) {
}).on('error', exitProcessOnError);
}

const cmd = lintOnlyModifiedFiles ? 'git diff --name-only' : 'git diff --cached --name-only';
cp.exec(cmd, {
let filesPromise;
if (lintOnlyModifiedFiles) {
filesPromise = Promise.all([getCachedFiles(), getModifiedFiles()]).then(filesList => {
const files1 = filesList[0];
const files2 = filesList[1];
files2.forEach(file => {
if (files1.indexOf(file) === -1) {
files1.push(file);
}
});
return files1;
});
} else {
filesPromise = getCachedFiles();
}
filesPromise.then(files => {
hygiene(files, {
skipEOL: skipEOL
})
.on('end', () => {
if (lintOnlyModifiedFiles && doNotExit) {
console.log(colors.green('Hygiene passed with 0 errors 👍.'));
console.log('Watching for changes...');
}
})
.on('error', exitProcessOnError);
}).catch(exitProcessOnError);
});
}
function getCachedFiles() {
return new Promise(resolve => {
cp.exec('git diff --cached --name-only', {
maxBuffer: 2000 * 1024
}, (err, out) => {
if (err) {
exitProcessOnError(err);
return reject(err);
}
const some = out
.split(/\r?\n/)
.filter(l => !!l);

hygiene(some, {
skipEOL: skipEOL
}).on('error', exitProcessOnError);
resolve(some);
});
});
}
function getModifiedFiles() {
return new Promise(resolve => {
cp.exec('git diff --name-only', {
maxBuffer: 2000 * 1024
}, (err, out) => {
if (err) {
return reject(err);
}
const some = out
.split(/\r?\n/)
.filter(l => !!l);
resolve(some);
});
});
}
Expand Down
Loading