-
Notifications
You must be signed in to change notification settings - Fork 34
Improve MixedIndentation rule to always emit notes for … #401
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
Improve MixedIndentation rule to always emit notes for … #401
Conversation
…document-level indentation issues and warnings for command sections
@Gyan-max - Please complete the PR checklist. |
@@ -578,7 +578,7 @@ permalink = "https://github.com/aws-samples/amazon-omics-tutorials/blob/c624acf2 | |||
|
|||
[[diagnostics]] | |||
document = "biowdl/tasks:/bcftools.wdl" | |||
message = 'bcftools.wdl:114:75: error: unknown escape sequence `\_`' | |||
message = "bcftools.wdl:114:75: error: unknown escape sequence `/_`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't for this PR, but this escape is in a parameter_meta
entry. I suspect the associated rule is too broad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes,
It's incorrectly flagging valid characters like \_
and /_
as invalid escape sequences in parameter metadata descriptions.
I don't know why but these characters are valid in parameter metadata description and i think they should not be flagged as errors.
I guess I need to clarify. The following three items are checked in your checklist above, but are not done. Please fix them.
|
Sorry for the confusion in the checklist. |
that's good to know, thanks. You still need to fix the failing tests though. We can handle the assigning portions. |
@a-frantz I don't know why there are so many Cl failed tests, initially there was only 3, can you please review my commits and guide me how to fix them |
use crate::Tag; | ||
use crate::TagSet; | ||
use crate::tags::Tag; | ||
use crate::tags::TagSet; | ||
use crate::util::lines_with_offset; | ||
|
||
/// The identifier for the command section mixed indentation rule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// The identifier for the command section mixed indentation rule. | |
/// The identifier for the mixed indentation rule. |
│ ------- this command section uses both tabs and spaces in leading whitespace | ||
13 │ this line has a continuation / | ||
14 │ and should be a warning | ||
│ ^^^ indented with spaces until this tab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a regression. This rule should flag the position where the spacing changed types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the associated test file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lints need to get cleaned up if they're not relevant to what is being tested.
@@ -30,6 +30,14 @@ note[Whitespace]: line contains only whitespace | |||
│ | |||
= fix: remove the whitespace | |||
|
|||
note[CommandSectionMixedIndentation]: mixed indentation throughout document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a command section, so the rule name is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing should have changed in this file.
…yan-max/wdl into fix-document-mixed-indentation
@adthrasher I tried to address all your feedback, |
wdl-lint/src/lib.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did these changes come from?
wdl-lint/src/rules.rs
Outdated
/// Rules for detecting mixed indentation (spaces and tabs) in WDL command | ||
/// sections and documents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Rules for detecting mixed indentation (spaces and tabs) in WDL command | |
/// sections and documents. |
There are no other comments in this list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please respond in writing to the review comments before pushing additional changes
@@ -2,6 +2,7 @@ | |||
|
|||
mod blank_lines_between_elements; | |||
mod call_input_spacing; | |||
#[doc = "Module for detecting mixed indentation in command sections and documents."] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the second time you've added a comment to this file. Instead of deleting it, can you reply and explain why you made this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this file change? It looks like you just reordered these entries, what was the motivation behind that decision?
@@ -334,7 +334,7 @@ fn bump(version: &str, patch_bump: bool) -> String { | |||
|
|||
/// Publishes a crate. | |||
async fn publish(name: &str, version: &str, manifest_path: &Path, dry_run: bool) -> bool { | |||
if !SORTED_CRATES_TO_PUBLISH.iter().any(|s| *s == name) { | |||
if !SORTED_CRATES_TO_PUBLISH.contains(&name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this change?
/// Type alias for backward compatibility | ||
pub type CommandSectionMixedIndentationRule = MixedIndentationRule; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we concerned about backwards compatibility here?
#[derive(Default, Debug, Clone)] | ||
pub struct MixedIndentationRule { | ||
/// The visitor that does the actual work. | ||
visitor: MixedIndentationVisitor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a departure from all of the existing lint rules. Why does this rule need a Visitor member instead of simply implementing the trait for the rule?
} | ||
|
||
fn related_rules(&self) -> &[&'static str] { | ||
&[] | ||
&["Whitespace"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the Whitespace
rule related to this rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this file change?
@adthrasher Sorry for soo much commits, I was just trying to fix the Cl failed tests and in order to fix it I somewhere messed up with code logic and implementation. |
Before we go any further, please respond to the questions I left in my last review. This PR has grown to a much larger set of changes than I would expect and I want to understand how it got to be that way. So if you could explain the changes you've made so far, that'd be great. |
Sure |
I think I messed up the whole PR, just to resolve the Cl test failure. If you allow can I make a fresh start from scratch? |
Per @Gyan-max, closing this PR. |
…document-level indentation issues and warnings for command sections
START SECTION:
This PR improves the
MixedIndentation
rule to consistently detect and report mixed indentation issues throughout WDL documents.The improvement includes:
RULES.md
to reflect the functionalityBefore submitting this PR, please make sure:
CHANGELOG.md
(see"keep a changelog" for more information).
Rule specific checks:
RULES.md
.rules()
function inwdl-lint/src/lib.rs
.wdl-lint/tests/lints
that covers everypossible diagnostic emitted for the rule within the file where the rule
is implemented.
Visitor
callback, you have alsooverridden that callback method for the special
Validator
(
wdl-ast/src/validation.rs
) andLintVisitor
(
wdl-lint/src/visitor.rs
) visitors. These are required to ensure the newvisitor callback will execute.
gauntlet --bless
to ensure that there are nounintended changes to the baseline configuration file (
Gauntlet.toml
).gauntlet --bless --arena
to ensure that all of therules added/removed are now reflected in the baseline configuration file
(
Arena.toml
).Close #201