Fix pyproject.toml key

This commit is contained in:
Charlie Marsh 2022-08-28 14:21:44 -04:00
parent 816bb88e3b
commit ea9fde14f6
7 changed files with 114 additions and 65 deletions

View file

@ -5,7 +5,7 @@ use rustpython_parser::ast::{
};
use crate::check_ast::ScopeKind::{Class, Function, Generator, Module};
use crate::checks::{Check, CheckKind};
use crate::checks::{Check, CheckCode, CheckKind};
use crate::settings::Settings;
use crate::visitor;
use crate::visitor::Visitor;
@ -413,15 +413,17 @@ impl Checker<'_> {
}
fn check_dead_scopes(&mut self) {
// TODO(charlie): Handle `__all__`.
for scope in &self.dead_scopes {
for (_, binding) in scope.values.iter().rev() {
if !binding.used {
if let BindingKind::Importation(name) = &binding.kind {
self.checks.push(Check {
kind: CheckKind::UnusedImport(name.clone()),
location: binding.location,
});
if self.settings.select.contains(&CheckCode::F401) {
// TODO(charlie): Handle `__all__`.
for scope in &self.dead_scopes {
for (_, binding) in scope.values.iter().rev() {
if !binding.used {
if let BindingKind::Importation(name) = &binding.kind {
self.checks.push(Check {
kind: CheckKind::UnusedImport(name.clone()),
location: binding.location,
});
}
}
}
}