Skip to content

Commit

Permalink
refactor: remove code for bad issue (e.g. todo/fixme) reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcartwright committed May 30, 2022
1 parent 825561d commit 5e42967
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 207 deletions.
2 changes: 1 addition & 1 deletion src/format_report_formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ fn error_kind_to_snippet_annotation_type(error_kind: &ErrorKind) -> AnnotationTy
| ErrorKind::BadAttr
| ErrorKind::InvalidGlobPattern(_)
| ErrorKind::VersionMismatch => AnnotationType::Error,
ErrorKind::BadIssue(_) | ErrorKind::DeprecatedAttr => AnnotationType::Warning,
ErrorKind::DeprecatedAttr => AnnotationType::Warning,
}
}
14 changes: 0 additions & 14 deletions src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use self::newline_style::apply_newline_style;
use crate::comment::{CharClasses, FullCodeCharKind};
use crate::config::{Config, FileName, Verbosity};
use crate::formatting::generated::is_generated_file;
use crate::issues::BadIssueSeeker;
use crate::modules::Module;
use crate::parse::parser::{DirectoryOwnership, Parser, ParserError};
use crate::parse::session::ParseSess;
Expand Down Expand Up @@ -332,7 +331,6 @@ impl FormattingError {
ErrorKind::LineOverflow(found, max) => (max, found - max),
ErrorKind::TrailingWhitespace
| ErrorKind::DeprecatedAttr
| ErrorKind::BadIssue(_)
| ErrorKind::BadAttr
| ErrorKind::LostComment
| ErrorKind::LicenseCheck => {
Expand Down Expand Up @@ -483,11 +481,9 @@ struct FormatLines<'a> {
cur_line: usize,
newline_count: usize,
errors: Vec<FormattingError>,
issue_seeker: BadIssueSeeker,
line_buffer: String,
current_line_contains_string_literal: bool,
format_line: bool,
allow_issue_seek: bool,
config: &'a Config,
}

Expand All @@ -497,7 +493,6 @@ impl<'a> FormatLines<'a> {
skipped_range: &'a [(usize, usize)],
config: &'a Config,
) -> FormatLines<'a> {
let issue_seeker = BadIssueSeeker::new();
FormatLines {
name,
skipped_range,
Expand All @@ -506,8 +501,6 @@ impl<'a> FormatLines<'a> {
cur_line: 1,
newline_count: 0,
errors: vec![],
allow_issue_seek: !issue_seeker.is_disabled(),
issue_seeker,
line_buffer: String::with_capacity(config.max_width() * 2),
current_line_contains_string_literal: false,
format_line: config.file_lines().contains_line(name, 1),
Expand Down Expand Up @@ -536,13 +529,6 @@ impl<'a> FormatLines<'a> {
continue;
}

if self.allow_issue_seek && self.format_line {
// Add warnings for bad fixmes
if let Some(issue) = self.issue_seeker.inspect(c) {
self.push_err(ErrorKind::BadIssue(issue), false, false);
}
}

if c == '\n' {
self.new_line(kind);
} else {
Expand Down
185 changes: 0 additions & 185 deletions src/issues.rs

This file was deleted.

8 changes: 1 addition & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use thiserror::Error;
use crate::comment::LineClasses;
use crate::emitter::Emitter;
use crate::formatting::{FormatErrorMap, FormattingError, ReportedErrors, SourceFile};
use crate::issues::Issue;
use crate::modules::ModuleResolutionError;
use crate::parse::parser::DirectoryOwnership;
use crate::shape::Indent;
Expand Down Expand Up @@ -69,7 +68,6 @@ mod format_report_formatter;
pub(crate) mod formatting;
mod ignore_path;
mod imports;
mod issues;
mod items;
mod lists;
mod macros;
Expand Down Expand Up @@ -110,9 +108,6 @@ pub enum ErrorKind {
/// Line ends in whitespace.
#[error("left behind trailing whitespace")]
TrailingWhitespace,
/// TODO or FIXME item without an issue number.
#[error("found {0}")]
BadIssue(Issue),
/// License check has failed.
#[error("license check failed")]
LicenseCheck,
Expand Down Expand Up @@ -236,8 +231,7 @@ impl FormatReport {
ErrorKind::LostComment => {
errs.has_unformatted_code_errors = true;
}
ErrorKind::BadIssue(_)
| ErrorKind::LicenseCheck
ErrorKind::LicenseCheck
| ErrorKind::DeprecatedAttr
| ErrorKind::BadAttr
| ErrorKind::VersionMismatch => {
Expand Down

0 comments on commit 5e42967

Please sign in to comment.