mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-08 19:42:12 +00:00
chore: resolve SonarCloud maintainability issues (storytold/wordcraft#4083)
* chore: resolve SonarCloud maintainability issues * fix: restore compiling refactors, revert behaviour changes, run cargo fmt - fontdb::norm: keep the closure for filter (char::is_alphanumeric takes self, not &self, so it does not fit Iterator::filter). - story.rs: write_mark_rpr needs &mut self (rev_attrs, rpr_change). - Revert the viewport meta change and the return 0 added to workspace_version/sha256, which changed behaviour or masked failures. - cargo fmt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Import Document in odt page_parts after dropping glob re-export * fix: apply_kind_properties binds ContentControl; cell_ref keeps char closures * fix(engine): pass case helpers by value (clippy needless borrows) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Dylan Taylor <dylan@craftmaker.dev>
This commit is contained in:
1 parent
57943c142e
commit
ab30d37997
3 files changed
+4
-4
No files matched your search
@@ -276,7 +276,7 @@ fn e_apostrophe(text: &str, ws: &[(usize, usize)], v: &mut Vec<Issue>) {
|
||||
}
|
||||
let mut after = text.get(*b..).unwrap_or("").chars();
|
||||
let Some(ap) = after.next().filter(|&c| is_apostrophe(c)) else { continue };
|
||||
let ends = after.next().is_none_or(|c| c.is_whitespace());
|
||||
let ends = after.next().is_none_or(char::is_whitespace);
|
||||
let quoted = text.get(..*a).and_then(|t| t.chars().next_back()).is_some_and(|c| is_apostrophe(c) || c == '‘');
|
||||
if ends && !quoted {
|
||||
v.push(issue(*a, *b + ap.len_utf8(), "«È» si scrive con l'accento, non con l'apostrofo".into(), vec!["È".into()]));
|
||||
|
||||
@@ -320,7 +320,7 @@ const COMMON: &str = "a an the and or but if of to in on at by for with from as
|
||||
const EXTRA_EN: &str = include_str!("../../../assets/spelling/en-extra.txt");
|
||||
|
||||
fn extra_words() -> &'static HashSet<&'static str> {
|
||||
static E: OnceLock<HashSet<&'static str>> = OnceLock::new();
|
||||
static E: OnceLock<HashSet<&str>> = OnceLock::new();
|
||||
E.get_or_init(|| EXTRA_EN.lines().map(str::trim).filter(|l| !l.is_empty() && !l.starts_with('#')).collect())
|
||||
}
|
||||
|
||||
@@ -889,7 +889,7 @@ fn grammar_en(text: &str, capital_first: bool) -> Vec<Issue> {
|
||||
if gap == " "
|
||||
&& (w0 == "an" || w0 == "An")
|
||||
&& w1.chars().next().is_some_and(|c| c.is_alphabetic() && !"aeiouAEIOUhH".contains(c))
|
||||
&& !w1.chars().all(|c| c.is_uppercase())
|
||||
&& !w1.chars().all(char::is_uppercase)
|
||||
{
|
||||
v.push(Issue {
|
||||
start: *a0,
|
||||
|
||||
@@ -109,7 +109,7 @@ pub fn has_dictionary() -> bool {
|
||||
|
||||
/// Is `c` a letter of the Cyrillic script (the only one the Russian dictionary covers)?
|
||||
pub(crate) fn is_cyrillic(c: char) -> bool {
|
||||
matches!(c, '\u{0400}'..='\u{04FF}' | '\u{0500}'..='\u{052F}')
|
||||
matches!(c, '\u{0400}'..='\u{052F}')
|
||||
}
|
||||
|
||||
/// Particles joined to a word with a hyphen (`кто-то`, `где-нибудь`, `давай-ка`, `всё-таки`,
|
||||
|
||||
Reference in new issue
Block a user