repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/lets_confusion/let_us_redundancy.rs
harper-core/src/linting/lets_confusion/let_us_redundancy.rs
use crate::expr::Expr; use crate::expr::SequenceExpr; use crate::{Token, TokenStringExt}; use crate::linting::expr_linter::Chunk; use crate::linting::{ExprLinter, Lint, LintKind, Suggestion}; /// See also: /// harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs /// harper-core/src/linting/lets_...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs
harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs
use crate::TokenKind; use crate::expr::Expr; use crate::expr::LongestMatchOf; use crate::expr::SequenceExpr; use crate::{ Token, linting::{Lint, LintKind, Suggestion}, patterns::WordSet, }; use crate::linting::ExprLinter; use crate::linting::expr_linter::Chunk; /// See also: /// harper-core/src/linting/co...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/lets_confusion/mod.rs
harper-core/src/linting/lets_confusion/mod.rs
mod let_us_redundancy; mod no_contraction_with_verb; use super::merge_linters::merge_linters; use let_us_redundancy::LetUsRedundancy; use no_contraction_with_verb::NoContractionWithVerb; // See also: // harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs // harper-core/src/linting/lets_confusio...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/compound_nouns/compound_noun_after_det_adj.rs
harper-core/src/linting/compound_nouns/compound_noun_after_det_adj.rs
use crate::expr::All; use crate::expr::Expr; use crate::expr::MergeableWords; use crate::expr::OwnedExprExt; use crate::expr::SequenceExpr; use crate::patterns::InflectionOfBe; use crate::{CharStringExt, TokenStringExt, linting::ExprLinter}; use super::{Lint, LintKind, Suggestion, is_content_word, predicate}; use crat...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/compound_nouns/compound_noun_before_aux_verb.rs
harper-core/src/linting/compound_nouns/compound_noun_before_aux_verb.rs
use crate::expr::All; use crate::expr::Expr; use crate::expr::MergeableWords; use crate::expr::SequenceExpr; use crate::patterns::AnyPattern; use crate::{CharStringExt, Lrc, TokenStringExt, linting::ExprLinter}; use super::{Lint, LintKind, Suggestion, is_content_word, predicate}; use crate::Token; use crate::linting:...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/compound_nouns/mod.rs
harper-core/src/linting/compound_nouns/mod.rs
mod compound_noun_after_det_adj; mod compound_noun_after_possessive; mod compound_noun_before_aux_verb; use super::{Lint, LintKind, Suggestion, merge_linters::merge_linters}; use crate::{CharStringExt, DictWordMetadata, Token}; // Helper function to check if a token is a content word (not a function word) pub(crate) ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/compound_nouns/compound_noun_after_possessive.rs
harper-core/src/linting/compound_nouns/compound_noun_after_possessive.rs
use crate::expr::All; use crate::expr::Expr; use crate::expr::MergeableWords; use crate::expr::SequenceExpr; use crate::patterns::AnyPattern; use crate::{CharStringExt, Lrc, TokenStringExt, linting::ExprLinter}; use super::{Lint, LintKind, Suggestion, is_content_word, predicate}; use crate::linting::expr_linter::Chunk...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/hop_hope/mod.rs
harper-core/src/linting/hop_hope/mod.rs
use super::merge_linters::merge_linters; mod to_hop; mod to_hope; use to_hop::ToHop; use to_hope::ToHope; merge_linters!(HopHope => ToHop, ToHope => "Handles common errors involving `hop` and `hope`. Ensures `hop` is used correctly in phrases like `hop on a bus` while correcting mistaken uses of `hope` in contexts wh...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/hop_hope/to_hope.rs
harper-core/src/linting/hop_hope/to_hope.rs
use super::super::{ExprLinter, Lint, LintKind}; use crate::expr::Expr; use crate::expr::SequenceExpr; use crate::linting::Suggestion; use crate::linting::expr_linter::Chunk; use crate::patterns::WordSet; use crate::{Token, char_string::char_string}; pub struct ToHope { expr: Box<dyn Expr>, } impl Default for ToHo...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/hop_hope/to_hop.rs
harper-core/src/linting/hop_hope/to_hop.rs
use super::super::{ExprLinter, Lint, LintKind}; use crate::expr::Expr; use crate::expr::SequenceExpr; use crate::linting::Suggestion; use crate::linting::expr_linter::Chunk; use crate::patterns::WordSet; use crate::{CharString, CharStringExt}; use crate::{Token, char_string::char_string}; pub struct ToHop { expr: ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/mass_nouns/mod.rs
harper-core/src/linting/mass_nouns/mod.rs
mod mass_plurals; mod noun_countability; use mass_plurals::MassPlurals; use noun_countability::NounCountability; use crate::{ Document, linting::{Lint, Linter}, remove_overlaps, spell::Dictionary, }; pub struct MassNouns<D> { mass_plurals: MassPlurals<D>, noun_countability: NounCountability, ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/mass_nouns/noun_countability.rs
harper-core/src/linting/mass_nouns/noun_countability.rs
use crate::linting::expr_linter::Chunk; use crate::{ Lrc, Span, Token, TokenStringExt, expr::{Expr, FirstMatchOf, LongestMatchOf, SequenceExpr}, linting::{ExprLinter, Lint, LintKind, Suggestion}, patterns::{IndefiniteArticle, WordSet}, }; #[derive(Debug, Clone, Copy)] pub enum Correction { // Drop ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/mass_nouns/mass_plurals.rs
harper-core/src/linting/mass_nouns/mass_plurals.rs
use hashbrown::HashSet; use crate::linting::expr_linter::Chunk; use crate::{ CharStringExt, Token, TokenStringExt, expr::{All, Expr, FirstMatchOf, FixedPhrase, SequenceExpr}, linting::{ExprLinter, Lint, LintKind, Suggestion}, spell::Dictionary, }; pub struct MassPlurals<D> { expr: Box<dyn Expr>, ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/phrase_corrections/tests.rs
harper-core/src/linting/phrase_corrections/tests.rs
use crate::linting::tests::{ assert_lint_count, assert_no_lints, assert_nth_suggestion_result, assert_suggestion_result, assert_top3_suggestion_result, }; use super::lint_group; // ACoupleMore #[test] fn corrects_a_couple_of_more() { assert_suggestion_result( "There are a couple of more rules that...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
true
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/phrase_corrections/mod.rs
harper-core/src/linting/phrase_corrections/mod.rs
use crate::linting::LintKind; use super::{LintGroup, MapPhraseLinter}; #[cfg(test)] mod tests; /// Produce a [`LintGroup`] that looks for errors in common phrases. /// Comes pre-configured with the recommended default settings. pub fn lint_group() -> LintGroup { let mut group = LintGroup::default(); macro_r...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
true
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_adjverb_ed_punct.rs
harper-core/src/linting/to_two_too/to_too_adjverb_ed_punct.rs
use crate::char_string::CharStringExt; use crate::{ Token, expr::{Expr, SequenceExpr}, }; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct ToTooAdjVerbEdPunct { expr: Box<dyn Expr>, } impl Default for ToTooAdjVerbEdPunct { fn default() -> Self { ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_eos.rs
harper-core/src/linting/to_two_too/to_too_eos.rs
use crate::{ Document, expr::{ExprExt, SequenceExpr}, linting::Linter, }; use super::{Lint, LintKind, Suggestion}; pub struct ToTooEos { expr: SequenceExpr, } impl ToTooEos { pub fn new() -> Self { Self { expr: SequenceExpr::default() .then_comma() ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_adverb.rs
harper-core/src/linting/to_two_too/to_too_adverb.rs
use crate::patterns::WhitespacePattern; use crate::{ Token, TokenKind, char_string::CharStringExt, expr::{AnchorEnd, Expr, SequenceExpr}, }; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct ToTooAdverb { expr: Box<dyn Expr>, } impl Default for To...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_adjective_punct.rs
harper-core/src/linting/to_two_too/to_too_adjective_punct.rs
use crate::{ Token, TokenKind, char_string::CharStringExt, expr::{Expr, SequenceExpr}, patterns::{SingleTokenPattern, WhitespacePattern, prepositional_preceder}, }; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct ToTooAdjectivePunct { expr: B...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/too_to.rs
harper-core/src/linting/to_two_too/too_to.rs
use harper_brill::UPOS; use crate::Token; use crate::expr::Expr; use crate::expr::SequenceExpr; use crate::patterns::UPOSSet; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct TooTo { expr: Box<dyn Expr>, } impl Default for TooTo { fn default() -> Self {...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_degree_words.rs
harper-core/src/linting/to_two_too/to_too_degree_words.rs
use crate::{ Token, TokenKind, char_string::CharStringExt, expr::{AnchorEnd, Expr, SequenceExpr}, }; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct ToTooDegreeWords { expr: Box<dyn Expr>, } impl Default for ToTooDegreeWords { fn default() -...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/mod.rs
harper-core/src/linting/to_two_too/mod.rs
mod to_too_adjective_end; mod to_too_adjective_punct; mod to_too_adjverb_ed_punct; mod to_too_adverb; mod to_too_chunk_start_comma; mod to_too_degree_words; mod to_too_eos; mod to_too_pronoun_end; mod too_to; use super::merge_linters::merge_linters; use super::{ExprLinter, Lint, LintKind, Suggestion}; use to_too_adjec...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_adjective_end.rs
harper-core/src/linting/to_two_too/to_too_adjective_end.rs
use crate::{ Token, TokenKind, char_string::CharStringExt, expr::{Expr, SequenceExpr}, patterns::{SingleTokenPattern, WhitespacePattern, prepositional_preceder}, }; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct ToTooAdjectiveEnd { expr: Box...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_pronoun_end.rs
harper-core/src/linting/to_two_too/to_too_pronoun_end.rs
use crate::{ Token, TokenKind, char_string::CharStringExt, expr::{AnchorEnd, AnchorStart, Expr, SequenceExpr}, patterns::WhitespacePattern, }; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct ToTooPronounEnd { expr: Box<dyn Expr>, } impl Defa...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/to_two_too/to_too_chunk_start_comma.rs
harper-core/src/linting/to_two_too/to_too_chunk_start_comma.rs
use crate::{ Token, char_string::CharStringExt, expr::{AnchorStart, Expr, SequenceExpr}, patterns::WhitespacePattern, }; use super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct ToTooChunkStartComma { expr: Box<dyn Expr>, } impl Default for ToTooChun...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/its_contraction/general.rs
harper-core/src/linting/its_contraction/general.rs
use harper_brill::UPOS; use crate::{ Document, Token, TokenStringExt, expr::{All, Expr, ExprExt, OwnedExprExt, SequenceExpr}, linting::{Lint, LintKind, Linter, Suggestion}, patterns::{NominalPhrase, Pattern, UPOSSet, WordSet}, }; pub struct General { expr: Box<dyn Expr>, } impl Default for Genera...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/its_contraction/proper_noun.rs
harper-core/src/linting/its_contraction/proper_noun.rs
use std::ops::Range; use std::sync::Arc; use harper_brill::UPOS; use crate::{ Document, Token, TokenStringExt, expr::{Expr, ExprExt, ExprMap, OwnedExprExt, SequenceExpr}, linting::{Lint, LintKind, Linter, Suggestion}, patterns::{DerivedFrom, UPOSSet}, }; pub struct ProperNoun { expr: Box<dyn Expr...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/its_contraction/mod.rs
harper-core/src/linting/its_contraction/mod.rs
use super::merge_linters::merge_linters; mod general; mod proper_noun; use general::General; use proper_noun::ProperNoun; merge_linters!( ItsContraction => General, ProperNoun => "Detects places where the possessive `its` should be the contraction `it's`, including before verbs/clauses and before proper noun...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/pronoun_contraction/should_contract.rs
harper-core/src/linting/pronoun_contraction/should_contract.rs
use std::sync::Arc; use crate::TokenKind; use crate::expr::AnchorStart; use crate::expr::Expr; use crate::expr::OwnedExprExt; use crate::expr::SequenceExpr; use crate::{Token, patterns::WordSet}; use crate::Lint; use crate::linting::expr_linter::Chunk; use crate::linting::{ExprLinter, LintKind, Suggestion}; /// See ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/pronoun_contraction/mod.rs
harper-core/src/linting/pronoun_contraction/mod.rs
use super::merge_linters::merge_linters; mod avoid_contraction; mod should_contract; use avoid_contraction::AvoidContraction; use should_contract::ShouldContract; merge_linters! {PronounContraction => ShouldContract, AvoidContraction => "Choosing when to contract pronouns is a challenging art. This rule looks for fa...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs
harper-core/src/linting/pronoun_contraction/avoid_contraction.rs
use crate::expr::{Expr, SequenceExpr}; use crate::{Token, TokenKind}; use super::super::{ExprLinter, Lint, LintKind, Suggestion}; use crate::linting::expr_linter::Chunk; pub struct AvoidContraction { expr: Box<dyn Expr>, } impl Default for AvoidContraction { fn default() -> Self { let pattern = Seque...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs
harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs
use crate::linting::expr_linter::Chunk; use crate::{ Lrc, Token, expr::{Expr, SequenceExpr}, linting::{ExprLinter, Lint, LintKind, Suggestion}, patterns::{UPOSSet, WordSet}, }; use harper_brill::UPOS; use super::NOUN_VERB_PAIRS; pub struct VerbInsteadOfNoun { expr: Box<dyn Expr>, } impl Default f...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/noun_verb_confusion/mod.rs
harper-core/src/linting/noun_verb_confusion/mod.rs
use super::merge_linters::merge_linters; mod effect_affect; mod noun_instead_of_verb; mod verb_instead_of_noun; // Common noun-verb pairs that are often confused // See also [`NounInsteadOfVerb``] pub(crate) const NOUN_VERB_PAIRS: &[(&str, &str)] = &[ ("advice", "advise"), ("belief", "believe"), ("breath"...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
true
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/general.rs
harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/general.rs
use crate::{ CharStringExt, Lrc, Token, expr::{Expr, FirstMatchOf, LongestMatchOf, SequenceExpr}, linting::{ExprLinter, Lint, LintKind, Suggestion, expr_linter::Chunk}, patterns::{ModalVerb, Word, WordSet}, }; use super::super::NOUN_VERB_PAIRS; /// Pronouns that can come before verbs but not nouns con...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/mod.rs
harper-core/src/linting/noun_verb_confusion/noun_instead_of_verb/mod.rs
mod general; use super::effect_affect::EffectAffect; use crate::linting::merge_linters::merge_linters; use general::GeneralNounInsteadOfVerb; merge_linters! { NounInsteadOfVerb => GeneralNounInsteadOfVerb, EffectAffect => "Corrects noun/verb confusions such as `advice/advise` and handles the c...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/noun_verb_confusion/effect_affect/mod.rs
harper-core/src/linting/noun_verb_confusion/effect_affect/mod.rs
mod affect_to_effect; mod effect_to_affect; use affect_to_effect::AffectToEffect; use effect_to_affect::EffectToAffect; use crate::linting::merge_linters::merge_linters; merge_linters!( EffectAffect => EffectToAffect, AffectToEffect => "Guides writers toward the right choice between `effect` ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/noun_verb_confusion/effect_affect/affect_to_effect.rs
harper-core/src/linting/noun_verb_confusion/effect_affect/affect_to_effect.rs
use std::sync::Arc; use harper_brill::UPOS; use crate::linting::expr_linter::Chunk; use crate::{ CharStringExt, Token, TokenKind, expr::{Expr, ExprMap, SequenceExpr}, linting::{ExprLinter, Lint, LintKind, Suggestion}, patterns::{ModalVerb, Pattern, UPOSSet}, }; pub(super) struct AffectToEffect { ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/noun_verb_confusion/effect_affect/effect_to_affect.rs
harper-core/src/linting/noun_verb_confusion/effect_affect/effect_to_affect.rs
use std::sync::Arc; use harper_brill::UPOS; use crate::linting::expr_linter::Chunk; use crate::{ CharStringExt, Token, TokenKind, expr::{Expr, ExprMap, SequenceExpr}, linting::{ExprLinter, Lint, LintKind, Suggestion}, patterns::WhitespacePattern, }; pub(super) struct EffectToAffect { expr: Box<dy...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/phrase_set_corrections/tests.rs
harper-core/src/linting/phrase_set_corrections/tests.rs
use crate::linting::tests::{ assert_good_and_bad_suggestions, assert_lint_count, assert_no_lints, assert_nth_suggestion_result, assert_suggestion_result, }; use super::lint_group; // 1:1 tests // Ado #[test] fn corrects_further_ado() { assert_suggestion_result( "... but we finally hit a great sp...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
true
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/linting/phrase_set_corrections/mod.rs
harper-core/src/linting/phrase_set_corrections/mod.rs
use crate::linting::LintKind; use super::{LintGroup, MapPhraseSetLinter}; #[cfg(test)] mod tests; /// Produce a [`LintGroup`] that looks for errors in sets of common phrases. pub fn lint_group() -> LintGroup { let mut group = LintGroup::default(); // Each correction pair has a single bad form and a single c...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/isolate_english.rs
harper-core/src/parsers/isolate_english.rs
use super::{Parser, Token, TokenStringExt}; use crate::language_detection::is_likely_english; use crate::spell::Dictionary; /// A parser that wraps another, using heuristics to quickly redact paragraphs of a document that aren't /// intended to be English text. pub struct IsolateEnglish<D: Dictionary> { inner: Box...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/collapse_identifiers.rs
harper-core/src/parsers/collapse_identifiers.rs
use std::collections::VecDeque; use std::sync::Arc; use itertools::Itertools; use super::Parser; use crate::expr::{ExprExt, SequenceExpr}; use crate::spell::Dictionary; use crate::{Lrc, Span, Token, TokenKind, VecExt}; /// A parser that wraps any other parser to collapse token strings that match /// the pattern `wor...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/mask.rs
harper-core/src/parsers/mask.rs
use super::Parser; use crate::mask::Masker; use crate::{Span, Token, TokenKind}; /// Composes a Masker and a Parser to parse only masked chunks of text. pub struct Mask<M, P> where M: Masker, P: Parser, { pub masker: M, pub parser: P, } impl<M, P> Mask<M, P> where M: Masker, P: Parser, { p...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/org_mode.rs
harper-core/src/parsers/org_mode.rs
use super::{Parser, PlainEnglish}; use crate::{Span, Token, TokenKind}; #[derive(Debug, PartialEq, Copy, Clone)] enum SourceBlockMarker { Begin, End, } // Check if a line starts with a header (starts with one or more '*') fn is_header_line(chars: &[char], start: usize) -> bool { chars.get(start).is_some_a...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/markdown.rs
harper-core/src/parsers/markdown.rs
use std::collections::VecDeque; use serde::{Deserialize, Serialize}; use super::{Parser, PlainEnglish}; use crate::{Span, Token, TokenKind, TokenStringExt, VecExt}; /// A parser that wraps the [`PlainEnglish`] parser that allows one to parse /// CommonMark files. /// /// Will ignore code blocks and tables. #[derive(...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/oops_all_headings.rs
harper-core/src/parsers/oops_all_headings.rs
use crate::{Span, Token, TokenKind}; use super::Parser; /// A parser that wraps another, forcing the entirety of the document to be composed of headings. pub struct OopsAllHeadings<P: Parser + 'static> { inner: P, } impl<P: Parser + 'static> OopsAllHeadings<P> { pub fn new(inner: P) -> Self { Self { ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/mod.rs
harper-core/src/parsers/mod.rs
//! Adds support for parsing various programming and markup languages through a unified trait: [`Parser`]. mod collapse_identifiers; mod isolate_english; mod markdown; mod mask; mod oops_all_headings; mod org_mode; mod plain_english; use blanket::blanket; pub use collapse_identifiers::CollapseIdentifiers; pub use iso...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/src/parsers/plain_english.rs
harper-core/src/parsers/plain_english.rs
use super::Parser; use crate::lexing::{FoundToken, lex_token}; use crate::{Span, Token}; /// A parser that will attempt to lex as many tokens as possible, /// without discrimination and until the end of input. #[derive(Clone, Copy)] pub struct PlainEnglish; impl Parser for PlainEnglish { fn parse(&self, source: &...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/tests/linters.rs
harper-core/tests/linters.rs
//! This test creates snapshots of the reports of all linters. //! //! # Usage //! //! To add a new snapshot, simply add the document to `tests/text` and run this //! test. It will automatically create a new snapshot in `tests/text/linters`. //! To update an existing snapshot, also just run this test. //! //! Note: Thi...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/tests/run_tests.rs
harper-core/tests/run_tests.rs
use harper_core::linting::{LintGroup, Linter}; use harper_core::parsers::OrgMode; use harper_core::spell::FstDictionary; use harper_core::{Dialect, Document}; /// Creates a unit test checking that the linting of a Markdown document (in /// `tests_sources`) produces the expected number of lints. macro_rules! create_tes...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/tests/snapshot.rs
harper-core/tests/snapshot.rs
use std::{ marker::Sync, path::{Path, PathBuf}, }; use harper_core::Dialect; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; fn get_tests_dir() -> PathBuf { PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests") } fn get_text_dir() -> PathBuf { get_tests_dir().join("text") } /// Tries ...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/tests/pos_tags.rs
harper-core/tests/pos_tags.rs
//! This test creates snapshots of the part-of-speech (POS) tags assigned by the //! [`Document`] struct to the text files in the `tests/text` directory. //! //! # Usage //! //! To add a new snapshot, simply add the document to `tests/text` and run this //! test. It will automatically create a new snapshot in `tests/te...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-core/benches/parse_essay.rs
harper-core/benches/parse_essay.rs
use criterion::{Criterion, criterion_group, criterion_main}; use harper_core::linting::{LintGroup, Linter}; use harper_core::spell::FstDictionary; use harper_core::{Dialect, Document}; use std::hint::black_box; static ESSAY: &str = include_str!("./essay.md"); fn parse_essay(c: &mut Criterion) { c.bench_function("...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/packages/vscode-plugin/src/tests/fixtures/languages/rust.rs
packages/vscode-plugin/src/tests/fixtures/languages/rust.rs
/// Errorz fn main() { println!("Hello World!"); }
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-stats/src/lib.rs
harper-stats/src/lib.rs
mod record; mod summary; use std::io::{self, Read, Write}; use std::io::{BufRead, BufReader}; use harper_core::TokenKind; pub use record::Record; pub use record::RecordKind; use serde::Serialize; use serde_json::Serializer; pub use summary::Summary; /// A collection of logged statistics for the various Harper fronte...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-stats/src/record.rs
harper-stats/src/record.rs
use harper_core::{ linting::{Lint, LintGroupConfig, LintKind}, Document, FatStringToken, }; use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq)] pub struct Record { pub kind: RecordKind, /// Recorded as seconds from the Unix Epoch pub w...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
Automattic/harper
https://github.com/Automattic/harper/blob/51e02866aea0eade6a0581792c76cfa2c289cb84/harper-stats/src/summary.rs
harper-stats/src/summary.rs
use std::{collections::HashMap, fmt::Display}; use harper_core::linting::{LintGroupConfig, LintKind}; use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Serialize, Deserialize)] pub struct Summary { pub lint_counts: HashMap<LintKind, u32>, pub total_applied: u32, pub final_config: LintGroupConf...
rust
Apache-2.0
51e02866aea0eade6a0581792c76cfa2c289cb84
2026-01-04T15:46:30.661431Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/tools/generate-code/src/types.rs
tools/generate-code/src/types.rs
use std::collections::HashMap; use syn::{ parse_quote, visit_mut::{visit_file_mut, VisitMut}, File, Ident, ItemUse, Path, PathSegment, TypePath, UseTree, }; pub fn qualify_types(mut file: File) -> File { let use_items = collect_use_items(&file); let mut map = HashMap::new(); for item in use_...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/tools/generate-code/src/main.rs
tools/generate-code/src/main.rs
#![allow(clippy::only_used_in_recursion)] use std::path::{Path, PathBuf}; use anyhow::{bail, Context, Result}; use clap::Parser; use swc_config::regex::CachedRegex; use syn::Item; use crate::types::qualify_types; mod generators; mod types; #[derive(Debug, Parser)] struct CliArgs { /// The directory containing ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/tools/generate-code/src/generators/visitor.rs
tools/generate-code/src/generators/visitor.rs
use std::collections::HashSet; use inflector::Inflector; use proc_macro2::{Span, TokenStream}; use quote::{quote, ToTokens}; use swc_config::regex::CachedRegex; use syn::{ parse_quote, Arm, Attribute, Expr, Field, Fields, File, GenericArgument, Ident, Item, Lit, LitInt, Path, PathArguments, Stmt, TraitItem, Ty...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
true
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/tools/generate-code/src/generators/mod.rs
tools/generate-code/src/generators/mod.rs
pub mod visitor;
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/tools/swc-releaser/src/main.rs
tools/swc-releaser/src/main.rs
use std::{ collections::{hash_map::Entry, HashMap}, env, path::{Path, PathBuf}, process::Command, }; use anyhow::{Context, Result}; use cargo_metadata::{semver::Version, DependencyKind}; use changesets::ChangeType; use clap::{Parser, Subcommand}; use indexmap::IndexSet; use petgraph::{prelude::DiGraphM...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_wasm/src/lib.rs
bindings/binding_core_wasm/src/lib.rs
use swc_core::binding_macros::{ build_minify, build_minify_sync, build_parse, build_parse_sync, build_print, build_print_sync, build_transform, build_transform_sync, }; use wasm_bindgen::prelude::*; mod types; /// Custom interface definitions for the @swc/wasm's public interface instead of /// auto generated o...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_wasm/src/types.rs
bindings/binding_core_wasm/src/types.rs
use wasm_bindgen::prelude::wasm_bindgen; /// This is direct copy-paste from `node-swc/src/types` to support typed /// interfaces for @swc/wasm as same as @swc/core. /// /// While this is redundant, wasm-bindgen does not support to import these types /// effeciently (https://github.com/rustwasm/wasm-bindgen/issues/2417...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
true
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/build.rs
bindings/binding_core_node/build.rs
use std::{ env, fs::File, io::{BufWriter, Write}, path::Path, }; extern crate napi_build; #[cfg(all(not(feature = "swc_v1"), not(feature = "swc_v2")))] compile_error!("Please enable swc_v1 or swc_v2 feature"); #[cfg(all(feature = "swc_v1", feature = "swc_v2"))] compile_error!("Features swc_v1 and swc...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/analyze.rs
bindings/binding_core_node/src/analyze.rs
use std::sync::Arc; use napi::{ bindgen_prelude::{AbortSignal, AsyncTask, Buffer}, Env, Task, }; use swc_core::{ base::{wasm_analysis::WasmAnalysisOptions, Compiler}, common::{comments::SingleThreadedComments, FileName}, node::MapErr, }; use tracing::instrument; use crate::{get_fresh_compiler, uti...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/lib.rs
bindings/binding_core_node/src/lib.rs
#![recursion_limit = "2048"] #![allow(dead_code)] #[macro_use] extern crate napi_derive; extern crate swc_malloc; use std::{env, panic::set_hook, sync::Arc}; use backtrace::Backtrace; use swc_core::{ base::Compiler, common::{sync::Lazy, FilePathMapping, SourceMap}, }; #[cfg(feature = "plugin")] mod analyze...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/bundle.rs
bindings/binding_core_node/src/bundle.rs
use std::{ panic::{catch_unwind, AssertUnwindSafe}, sync::Arc, }; use anyhow::{bail, Error}; use napi::{ bindgen_prelude::{AbortSignal, AsyncTask, Buffer}, Env, Status, Task, }; use rustc_hash::FxHashMap; use serde::Deserialize; use swc_core::{ atoms::Atom, base::{ config::SourceMapsCon...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/parse.rs
bindings/binding_core_node/src/parse.rs
use std::{ path::{Path, PathBuf}, sync::Arc, }; use anyhow::Context as _; use napi::{ bindgen_prelude::{AbortSignal, AsyncTask, Buffer}, Either, Env, Task, }; use swc_core::{ base::{ config::{ErrorFormat, ParseOptions}, Compiler, }, common::{comments::Comments, FileName, Mar...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/transform.rs
bindings/binding_core_node/src/transform.rs
use std::{ path::{Path, PathBuf}, sync::Arc, }; use anyhow::Context as _; use napi::{ bindgen_prelude::{AbortSignal, AsyncTask, Buffer}, Env, Task, }; use path_clean::clean; use swc_core::{ base::{config::Options, Compiler, TransformOutput}, common::FileName, ecma::ast::Program, node::{...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/util.rs
bindings/binding_core_node/src/util.rs
#![deny(warnings)] use std::panic::{catch_unwind, AssertUnwindSafe}; use anyhow::{anyhow, Error}; use napi::Env; use swc_core::{ base::{config::ErrorFormat, try_with_handler}, common::{ errors::Handler, sync::{Lrc, OnceCell}, SourceMap, GLOBALS, }, }; use tracing::instrument; use t...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/minify.rs
bindings/binding_core_node/src/minify.rs
use std::sync::Arc; use napi::{ bindgen_prelude::{AbortSignal, AsyncTask, Buffer, External}, Task, }; use rustc_hash::FxHashMap; use swc_core::{ base::{ config::{ErrorFormat, JsMinifyOptions}, JsMinifyExtras, TransformOutput, }, common::{sync::Lrc, FileName, SourceFile, SourceMap}, ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_core_node/src/print.rs
bindings/binding_core_node/src/print.rs
use std::sync::Arc; use napi::{ bindgen_prelude::{AbortSignal, AsyncTask, Buffer}, Env, Task, }; use swc_core::{ base::{ config::{Options, SourceMapsConfig}, Compiler, PrintArgs, TransformOutput, }, common::GLOBALS, ecma::ast::{EsVersion, Program}, node::{deserialize_json, g...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_minifier_wasm/src/lib.rs
bindings/binding_minifier_wasm/src/lib.rs
use swc_core::binding_macros::{build_minify, build_minify_sync}; use wasm_bindgen::prelude::*; mod types; /// Custom interface definitions for the @swc/wasm's public interface instead of /// auto generated one, which is not reflecting most of types in detail. #[wasm_bindgen(typescript_custom_section)] const INTERFACE_...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_minifier_wasm/src/types.rs
bindings/binding_minifier_wasm/src/types.rs
use wasm_bindgen::prelude::wasm_bindgen; /// This is direct copy-paste from `node-swc/src/types` to support typed /// interfaces for @swc/wasm as same as @swc/core. /// /// While this is redundant, wasm-bindgen does not support to import these types /// effeciently (https://github.com/rustwasm/wasm-bindgen/issues/2417...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
true
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_es_ast_viewer/src/lib.rs
bindings/binding_es_ast_viewer/src/lib.rs
use std::sync::Arc; use anyhow::Result; use swc_core::{ self, common::{errors::ColorConfig, FileName, Globals, Mark, SourceMap, GLOBALS}, ecma::{ ast::*, parser::{unstable::Capturing, EsSyntax, Lexer, Parser, StringInput, Syntax, TsSyntax}, transforms::base::resolver, visit:...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_es_ast_viewer/examples/cli.rs
bindings/binding_es_ast_viewer/examples/cli.rs
use std::{env, fs, path::Path}; use binding_es_ast_viewer::parse; fn main() { let args: Vec<String> = env::args().collect(); if args.len() != 2 { eprintln!("Usage: {} <file_path>", args[0]); eprintln!("Example: {} example.js", args[0]); std::process::exit(1); } let file_path ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_minifier_node/build.rs
bindings/binding_minifier_node/build.rs
use std::{ env, fs::File, io::{BufWriter, Write}, path::Path, }; extern crate napi_build; fn main() { let out_dir = env::var("OUT_DIR").expect("Outdir should exist"); let dest_path = Path::new(&out_dir).join("triple.txt"); let mut f = BufWriter::new(File::create(dest_path).expect("...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_minifier_node/src/lib.rs
bindings/binding_minifier_node/src/lib.rs
#![recursion_limit = "2048"] #![allow(dead_code)] #[macro_use] extern crate napi_derive; extern crate swc_malloc; use std::{env, panic::set_hook}; use backtrace::Backtrace; mod minify; mod util; #[napi_derive::module_init] fn init() { if cfg!(debug_assertions) || env::var("SWC_DEBUG").unwrap_or_default() == "...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_minifier_node/src/util.rs
bindings/binding_minifier_node/src/util.rs
#![deny(warnings)] use std::panic::{catch_unwind, AssertUnwindSafe}; use anyhow::{anyhow, Error}; use napi::Env; use swc_core::common::{ errors::Handler, sync::{Lrc, OnceCell}, SourceMap, GLOBALS, }; use swc_error_reporters::handler::try_with_handler; use tracing::instrument; use tracing_chrome::ChromeLay...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_minifier_node/src/minify.rs
bindings/binding_minifier_node/src/minify.rs
use std::sync::Arc; use anyhow::{Context, Error}; use napi::{ bindgen_prelude::{AbortSignal, AsyncTask, Buffer, External}, Task, }; use swc_compiler_base::{ minify_file_comments, parse_js, IdentCollector, PrintArgs, SourceMapsConfig, TransformOutput, }; use swc_config::types::BoolOr; use swc_core::{ co...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_react_compiler_node/build.rs
bindings/binding_react_compiler_node/build.rs
use std::{ env, fs::File, io::{BufWriter, Write}, path::Path, }; extern crate napi_build; fn main() { let out_dir = env::var("OUT_DIR").expect("Outdir should exist"); let dest_path = Path::new(&out_dir).join("triple.txt"); let mut f = BufWriter::new(File::create(dest_path).expect("...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_react_compiler_node/src/support.rs
bindings/binding_react_compiler_node/src/support.rs
use napi::bindgen_prelude::*; use swc_core::{ common::{sync::Lrc, FileName, SourceMap}, ecma::{ast::EsVersion, parser::Syntax}, }; struct IsReactCompilerRequiredTask { code: String, } #[napi] impl Task for IsReactCompilerRequiredTask { type JsValue = bool; type Output = bool; fn compute(&mut ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_react_compiler_node/src/lib.rs
bindings/binding_react_compiler_node/src/lib.rs
#![recursion_limit = "2048"] #![allow(dead_code)] #[macro_use] extern crate napi_derive; extern crate swc_malloc; use std::{env, panic::set_hook}; use backtrace::Backtrace; mod support; #[napi_derive::module_init] fn init() { if cfg!(debug_assertions) || env::var("SWC_DEBUG").unwrap_or_default() == "1" { ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_typescript_wasm/src/lib.rs
bindings/binding_typescript_wasm/src/lib.rs
use std::{ iter::once, mem::take, sync::{Arc, Mutex}, }; use anyhow::Error; use error_reporter::SwcReportHandler; use js_sys::Uint8Array; use miette::{GraphicalTheme, LabeledSpan, ThemeCharacters, ThemeStyles}; use serde::Serialize; use swc_common::{ errors::{DiagnosticBuilder, DiagnosticId, Emitter, H...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_typescript_wasm/src/error_reporter.rs
bindings/binding_typescript_wasm/src/error_reporter.rs
use std::fmt::{self}; use miette::{ Diagnostic, GraphicalTheme, LabeledSpan, ReportHandler, SourceCode, SourceSpan, ThemeCharacters, }; use owo_colors::{OwoColorize, Style}; use unicode_width::UnicodeWidthChar; /** A [`ReportHandler`] that displays a given [`Report`](crate::Report) in a quasi-graphical way, using...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_html_node/build.rs
bindings/binding_html_node/build.rs
use std::{ env, fs::File, io::{BufWriter, Write}, path::Path, }; extern crate napi_build; fn main() { let out_dir = env::var("OUT_DIR").expect("Out dir should exist"); let dest_path = Path::new(&out_dir).join("triple.txt"); let mut f = BufWriter::new(File::create(dest_path).expect(...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_html_node/src/lib.rs
bindings/binding_html_node/src/lib.rs
#[macro_use] extern crate napi_derive; mod tag_omission; mod util; use std::{backtrace::Backtrace, borrow::Cow, env, panic::set_hook}; use anyhow::{bail, Context}; use lightningcss::{printer::PrinterOptions, stylesheet::StyleSheet, targets::Targets}; use napi::{bindgen_prelude::*, Task}; use serde::{Deserialize, Ser...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_html_node/src/tag_omission.rs
bindings/binding_html_node/src/tag_omission.rs
use serde::{ de::{Unexpected, Visitor}, Deserialize, }; #[derive(Debug)] pub enum TagOmission { Bool(bool), KeepHeadAndBody, } struct TagOmissionVisitor; impl Visitor<'_> for TagOmissionVisitor { type Value = TagOmission; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/binding_html_node/src/util.rs
bindings/binding_html_node/src/util.rs
use anyhow::{anyhow, Error}; use swc_common::{errors::Handler, sync::Lrc, FilePathMapping, SourceMap}; use swc_error_reporters::handler::{try_with_handler, HandlerOpts}; pub fn try_with<F, Ret>(op: F) -> Result<Ret, Error> where F: FnOnce(&Lrc<SourceMap>, &Handler) -> Result<Ret, Error>, { let cm = Lrc::new(So...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/bindings/swc_cli/src/main.rs
bindings/swc_cli/src/main.rs
fn main() -> anyhow::Result<()> { swc_cli_impl::run() }
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/flavor.rs
crates/swc_estree_ast/src/flavor.rs
better_scoped_tls::scoped_tls!(static FLAVOR: Flavor); #[repr(u8)] #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default)] pub enum Flavor { #[default] Babel, Acorn { extra_comments: bool, }, } impl Flavor { pub fn with<F, Ret>(self, op: F) -> Ret where F: FnOnce() -> Ret, ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/decl.rs
crates/swc_estree_ast/src/decl.rs
use serde::{Deserialize, Serialize}; use swc_common::ast_serde; use crate::{ class::ClassDeclaration, common::{BaseNode, Identifier, LVal, Param, TypeAnnotOrNoop, TypeParamDeclOrNoop}, expr::{Expression, FunctionExpression}, flow::{ DeclareClass, DeclareExportAllDeclaration, DeclareExportDeclar...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/ser.rs
crates/swc_estree_ast/src/ser.rs
use serde::Serializer; use crate::flavor::Flavor; pub(crate) fn serialize_optional<S>(o: &Option<bool>, s: S) -> Result<S::Ok, S::Error> where S: Serializer, { s.serialize_some(&o.unwrap_or(false)) } /// Always serializes as a boolean value. pub(crate) fn serialize_as_bool<S>(o: &Option<bool>, s: S) -> Resul...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/object.rs
crates/swc_estree_ast/src/object.rs
use serde::{ser::SerializeMap, Deserialize, Serialize}; use swc_common::ast_serde; use crate::{ common::{ BaseNode, Decorator, Identifier, Param, PatternLike, TypeAnnotOrNoop, TypeParamDeclOrNoop, }, expr::Expression, flavor::Flavor, flow::{ ObjectTypeCallProperty, ObjectTypeIndexer...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/expr.rs
crates/swc_estree_ast/src/expr.rs
use serde::{Deserialize, Serialize}; use swc_atoms::Atom; use swc_common::ast_serde; use crate::{ class::{ClassBody, ClassImpl}, common::{ BaseNode, Decorator, Identifier, LVal, MetaProperty, Param, PrivateName, SpreadElement, SuperTypeParams, TypeAnnotOrNoop, TypeParamDeclOrNoop, }, fl...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/pat.rs
crates/swc_estree_ast/src/pat.rs
use serde::{Deserialize, Serialize}; use swc_common::ast_serde; use crate::{ common::{BaseNode, Decorator, Identifier, PatternLike, RestElement, TypeAnnotOrNoop}, expr::{Expression, MemberExpression}, object::ObjectProperty, }; #[derive(Debug, Clone, PartialEq)] #[ast_serde] pub enum Pattern { #[tag("...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/lib.rs
crates/swc_estree_ast/src/lib.rs
#![deny(clippy::all)] #![allow(clippy::enum_variant_names)] #![allow(clippy::large_enum_variant)] pub use class::*; pub use comment::*; pub use common::*; pub use decl::*; pub use expr::*; pub use flow::*; pub use jsx::*; pub use lit::*; pub use module::*; pub use object::*; pub use pat::*; pub use stmt::*; pub use ty...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/flow.rs
crates/swc_estree_ast/src/flow.rs
use serde::{Deserialize, Serialize}; use swc_atoms::Atom; use swc_common::ast_serde; use crate::{ common::{BaseNode, IdOrQualifiedId, IdOrString, Identifier}, expr::TypeCastExpression, lit::StringLiteral, module::{ExportKind, ExportNamespaceSpecifier, ExportSpecifier}, stmt::BlockStatement, }; #[d...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_ast/src/module.rs
crates/swc_estree_ast/src/module.rs
use serde::{Deserialize, Serialize}; use serde_json::Value; use swc_atoms::Atom; use swc_common::ast_serde; use crate::{ class::ClassDeclaration, comment::Comment, common::{BaseNode, Directive, IdOrString, Identifier}, decl::{Declaration, FunctionDeclaration}, expr::Expression, lit::StringLiter...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false