## Summary This PR adds initial support for `type: ignore`. It doesn't do anything fancy yet like: * Detecting invalid type ignore comments * Detecting type ignore comments that are part of another suppression comment: `# fmt: skip # type: ignore` * Suppressing specific lints `type: ignore [code]` * Detecting unsused type ignore comments * ... The goal is to add this functionality in separate PRs. ## Test Plan --------- Co-authored-by: Carl Meyer <carl@astral.sh> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
use std::hash::BuildHasherDefault;
|
|
|
|
use rustc_hash::FxHasher;
|
|
|
|
use crate::lint::{LintRegistry, LintRegistryBuilder};
|
|
pub use db::Db;
|
|
pub use module_name::ModuleName;
|
|
pub use module_resolver::{resolve_module, system_module_search_paths, KnownModule, Module};
|
|
pub use program::{Program, ProgramSettings, SearchPathSettings, SitePackages};
|
|
pub use python_version::PythonVersion;
|
|
pub use semantic_model::{HasTy, SemanticModel};
|
|
|
|
pub mod ast_node_ref;
|
|
mod db;
|
|
pub mod lint;
|
|
mod module_name;
|
|
mod module_resolver;
|
|
mod node_key;
|
|
mod program;
|
|
mod python_version;
|
|
pub mod semantic_index;
|
|
mod semantic_model;
|
|
pub(crate) mod site_packages;
|
|
mod stdlib;
|
|
mod suppression;
|
|
pub(crate) mod symbol;
|
|
pub mod types;
|
|
mod unpack;
|
|
mod util;
|
|
|
|
type FxOrderSet<V> = ordermap::set::OrderSet<V, BuildHasherDefault<FxHasher>>;
|
|
|
|
/// Creates a new registry with all known semantic lints.
|
|
pub fn default_lint_registry() -> LintRegistry {
|
|
let mut registry = LintRegistryBuilder::default();
|
|
register_lints(&mut registry);
|
|
registry.build()
|
|
}
|
|
|
|
/// Register all known semantic lints.
|
|
pub fn register_lints(registry: &mut LintRegistryBuilder) {
|
|
types::register_lints(registry);
|
|
}
|