drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a way to ignore commented out code?

dutterbutter opened this issue · comments

** Q: **

Currently when making use of:

# Also take into account developer comments
dev_comments = true

It will rightfully capture commented out code like below:

// let overhead_for_block_gas = U256::from(crate::transaction_data::block_overhead_gas(
//     gas_per_pubdata_byte_limit,
// ));

I don't want to add all this commented code to the dictionary, or ignore the entire file and I need to keep this commented code for the time being. Is there a way to ignore commented out code like the above? I explored the docs but didnt see anything.

Thanks in advance and appreciate the work done with cargo-spellcheck 🙏

Hey @dutterbutter , that is unfortunately a very difficult problem, disambiguating regular text from user input without pulling out medium-sized machine learning based detectors, which is a bit too big for this project.

I don't have a good solution, only workarounds that will inconvenience you to some degree and not work in all cases:

  • make these comments wrapped in triple-backticks
  • disable spellchecking on dev comments for the time being / elevate all relevant comments to doc comments when aligned to a function scope
  • make the code acutal code, but mark it as dead_code and use stubs fur content elements you don't have
  • keep the code in your history, but not in the repo state

I obviously lack significant amount of context, so to the degree all/any of the above applies varies significantly.

Appreciate the response here ❤️ Thanks!