Skip to content
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

Roadmap #1

Open
33 of 40 tasks
yijunyu opened this issue Feb 5, 2023 · 0 comments
Open
33 of 40 tasks

Roadmap #1

yijunyu opened this issue Feb 5, 2023 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@yijunyu
Copy link
Contributor

yijunyu commented Feb 5, 2023

Tasks

Functionality

Diagnostics

  • Insert two comments around the diagnositic spans
  • Name the comments by the lint rules, and insert the rendered diagnostics into the second comment
  • Insert rendered diagnostic messages into the second comment.

Configuration

  • Add an option '--fix' to invoke flags related to all machine applicable fix rules from rust-clippy project

Measurement

  • Measure the number of warnings per KLOC through count_diagnostics.sh
  • Count clippy fixes

Git History Extraction

  • Select only the relevant marked rules
  • Print out the hunks only when they are relevant to the spans of warning locations
  • Output options
    • Add an option --patch <id> to print out the patch of HEAD.. where is a commit id and HEAD is the current work tree
    • Add an option --commit to print out the hunks only when they have been fixed by the revision
    • Add an option --pair to generate diff records into code pairs
    • Add an option --function to generate diff records with the surrounding function contexts (which was a feature of git diff but not supported by libgit2
    • Add an option --single to select only those diff records that patch exactly one warning
    • Add an option --mixed to save the messages into a file in case the information can be useful context
    • Add an option --location to markup the old_context with the warnings

Refactoring

  • Integrate with transformation systems to fix some of the warnings not yet fixed by clippy
    • Integrate with txl through txl-rs
    • list the marked rules applied to the transformations
    • Updated the TXL refactoring transformation and Rust grammar
    • List the fixed warnings and keep the remaining warnings in the output
    • Store the transformation results before and after clippy --fix into the transform folder
    • Call fix only when the number of warnings is larger than 0
    • Perform rustfmt to output of TXL transformations
  • Infer return type of functions and map them to if-let test: Result => Ok(), Option => Some()

Usability

  • Separate the output files into a different folder, so as to keep using the same ".rs" file extension
  • Save the messages into [$hash]/diagnostics.json to avoid rerun the compilation for changes of the tool features
    where $hash is the hash id of the current work copy of a git repository
  • Swap the order of diagnostic folder name from $id/diagnostics to diagnostics/$id
  • Cache computed data by serialized/deserialize diff hunks
  • Put header ahead of before and after contexts of the hunk pairs
  • Print pair pragma with ## so it is easier to differentiate it with the pragma inside warning hints

Testing

  • Test rust-diagnostics on its own history
  • Generate test results in random folders so there is less interference between tests
  • Fix the ordering of diagnostic hints so that the regression test will be repeatable
  • Make the test cases parallelizable

Maintainability

  • Move the implementation of optional functionalities into rustc_flags, fix features to reduce the dependencies
  • Refactor the code to simplify the logic by introduce a Hunk structure as unified state of various analyses
  • Removed the optional features
  • Remove dependencies requiring nightly, now only depends on stable rust
  • Use cargo-release and cargo-dist to create the new release
@yijunyu yijunyu self-assigned this Feb 5, 2023
@yijunyu yijunyu added the documentation Improvements or additions to documentation label Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant