mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 07:55:56 +03:00
Fixed bug in previous commit the caused default include/exclude values not to be provided in the case where a pyproject.toml was present but contained no pyright section. Thanks to @augustelalande for catching this.
This commit is contained in:
parent
4319e03b71
commit
e588c6f984
@ -625,39 +625,17 @@ export class AnalyzerService {
|
|||||||
commandLineOptions.extraPaths
|
commandLineOptions.extraPaths
|
||||||
);
|
);
|
||||||
|
|
||||||
if (commandLineOptions.includeFileSpecs.length > 0) {
|
commandLineOptions.includeFileSpecs.forEach((fileSpec) => {
|
||||||
commandLineOptions.includeFileSpecs.forEach((fileSpec) => {
|
configOptions.include.push(getFileSpec(projectRoot, fileSpec));
|
||||||
configOptions.include.push(getFileSpec(projectRoot, fileSpec));
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commandLineOptions.excludeFileSpecs.length > 0) {
|
commandLineOptions.excludeFileSpecs.forEach((fileSpec) => {
|
||||||
commandLineOptions.excludeFileSpecs.forEach((fileSpec) => {
|
configOptions.exclude.push(getFileSpec(projectRoot, fileSpec));
|
||||||
configOptions.exclude.push(getFileSpec(projectRoot, fileSpec));
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commandLineOptions.ignoreFileSpecs.length > 0) {
|
commandLineOptions.ignoreFileSpecs.forEach((fileSpec) => {
|
||||||
commandLineOptions.ignoreFileSpecs.forEach((fileSpec) => {
|
configOptions.ignore.push(getFileSpec(projectRoot, fileSpec));
|
||||||
configOptions.ignore.push(getFileSpec(projectRoot, fileSpec));
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!configFilePath && !pyprojectFilePath && commandLineOptions.executionRoot) {
|
|
||||||
if (commandLineOptions.includeFileSpecs.length === 0) {
|
|
||||||
// If no config file was found and there are no explicit include
|
|
||||||
// paths specified, assume the caller wants to include all source
|
|
||||||
// files under the execution root path.
|
|
||||||
configOptions.include.push(getFileSpec(executionRoot, '.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commandLineOptions.excludeFileSpecs.length === 0) {
|
|
||||||
// Add a few common excludes to avoid long scan times.
|
|
||||||
defaultExcludes.forEach((exclude) => {
|
|
||||||
configOptions.exclude.push(getFileSpec(executionRoot, exclude));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configOptions.disableTaggedHints = !!commandLineOptions.disableTaggedHints;
|
configOptions.disableTaggedHints = !!commandLineOptions.disableTaggedHints;
|
||||||
|
|
||||||
@ -675,32 +653,30 @@ export class AnalyzerService {
|
|||||||
commandLineOptions
|
commandLineOptions
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const configFileDir = this._primaryConfigFileUri!.getDirectory();
|
|
||||||
|
|
||||||
// If no include paths were provided, assume that all files within
|
|
||||||
// the project should be included.
|
|
||||||
if (configOptions.include.length === 0) {
|
|
||||||
this._console.info(`No include entries specified; assuming ${configFileDir.toUserVisibleString()}`);
|
|
||||||
configOptions.include.push(getFileSpec(configFileDir, '.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there was no explicit set of excludes, add a few common ones to avoid long scan times.
|
|
||||||
if (configOptions.exclude.length === 0) {
|
|
||||||
defaultExcludes.forEach((exclude) => {
|
|
||||||
this._console.info(`Auto-excluding ${exclude}`);
|
|
||||||
configOptions.exclude.push(getFileSpec(configFileDir, exclude));
|
|
||||||
});
|
|
||||||
|
|
||||||
if (configOptions.autoExcludeVenv === undefined) {
|
|
||||||
configOptions.autoExcludeVenv = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
configOptions.autoExcludeVenv = true;
|
|
||||||
configOptions.applyDiagnosticOverrides(commandLineOptions.diagnosticSeverityOverrides);
|
configOptions.applyDiagnosticOverrides(commandLineOptions.diagnosticSeverityOverrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If no include paths were provided, assume that all files within
|
||||||
|
// the project should be included.
|
||||||
|
if (configOptions.include.length === 0) {
|
||||||
|
this._console.info(`No include entries specified; assuming ${projectRoot.toUserVisibleString()}`);
|
||||||
|
configOptions.include.push(getFileSpec(projectRoot, '.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there was no explicit set of excludes, add a few common ones to
|
||||||
|
// avoid long scan times.
|
||||||
|
if (configOptions.exclude.length === 0) {
|
||||||
|
defaultExcludes.forEach((exclude) => {
|
||||||
|
this._console.info(`Auto-excluding ${exclude}`);
|
||||||
|
configOptions.exclude.push(getFileSpec(projectRoot, exclude));
|
||||||
|
});
|
||||||
|
|
||||||
|
if (configOptions.autoExcludeVenv === undefined) {
|
||||||
|
configOptions.autoExcludeVenv = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Override the analyzeUnannotatedFunctions setting based on the command-line setting.
|
// Override the analyzeUnannotatedFunctions setting based on the command-line setting.
|
||||||
if (commandLineOptions.analyzeUnannotatedFunctions !== undefined) {
|
if (commandLineOptions.analyzeUnannotatedFunctions !== undefined) {
|
||||||
configOptions.diagnosticRuleSet.analyzeUnannotatedFunctions =
|
configOptions.diagnosticRuleSet.analyzeUnannotatedFunctions =
|
||||||
|
Loading…
Reference in New Issue
Block a user