Documentation ¶
Overview ¶
Package domain contains the domain logic for the homoglyphs rule type
Index ¶
- type HomoglyphProcessor
- type InvisibleCharactersProcessor
- func (ice *InvisibleCharactersProcessor) FindInvisibleCharacters(line string) []*Violation
- func (ice *InvisibleCharactersProcessor) FindViolations(line string) []*Violation
- func (_ *InvisibleCharactersProcessor) GetFailedReviewText() string
- func (_ *InvisibleCharactersProcessor) GetLineCommentText(violation *Violation) string
- func (_ *InvisibleCharactersProcessor) GetPassedReviewText() string
- func (_ *InvisibleCharactersProcessor) GetSubCommentText() string
- type MixedScriptInfo
- type MixedScriptsProcessor
- func (mse *MixedScriptsProcessor) FindMixedScripts(line string) []*Violation
- func (mse *MixedScriptsProcessor) FindViolations(line string) []*Violation
- func (_ *MixedScriptsProcessor) GetFailedReviewText() string
- func (_ *MixedScriptsProcessor) GetLineCommentText(violation *Violation) string
- func (_ *MixedScriptsProcessor) GetPassedReviewText() string
- func (_ *MixedScriptsProcessor) GetSubCommentText() string
- type Violation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HomoglyphProcessor ¶
type HomoglyphProcessor interface { FindViolations(line string) []*Violation GetSubCommentText() string GetLineCommentText(violation *Violation) string GetPassedReviewText() string GetFailedReviewText() string }
HomoglyphProcessor is an interface for a homoglyph processor
func NewInvisibleCharactersProcessor ¶
func NewInvisibleCharactersProcessor() HomoglyphProcessor
NewInvisibleCharactersProcessor creates a new InvisibleCharactersProcessor
func NewMixedScriptsProcessor ¶
func NewMixedScriptsProcessor(ctx context.Context) (HomoglyphProcessor, error)
NewMixedScriptsProcessor creates a new MixedScriptsProcessor
type InvisibleCharactersProcessor ¶
type InvisibleCharactersProcessor struct {
// contains filtered or unexported fields
}
InvisibleCharactersProcessor is a processor for the invisible characters rule type
func (*InvisibleCharactersProcessor) FindInvisibleCharacters ¶
func (ice *InvisibleCharactersProcessor) FindInvisibleCharacters(line string) []*Violation
FindInvisibleCharacters checks for invisible characters in the given line and returns a slice of runes representing the invisible characters found.
func (*InvisibleCharactersProcessor) FindViolations ¶
func (ice *InvisibleCharactersProcessor) FindViolations(line string) []*Violation
FindViolations finds invisible characters in the given line
func (*InvisibleCharactersProcessor) GetFailedReviewText ¶
func (_ *InvisibleCharactersProcessor) GetFailedReviewText() string
GetFailedReviewText returns the failed review text for invisible characters
func (*InvisibleCharactersProcessor) GetLineCommentText ¶
func (_ *InvisibleCharactersProcessor) GetLineCommentText(violation *Violation) string
GetLineCommentText returns the line comment text for invisible characters
func (*InvisibleCharactersProcessor) GetPassedReviewText ¶
func (_ *InvisibleCharactersProcessor) GetPassedReviewText() string
GetPassedReviewText returns the passed review text for invisible characters
func (*InvisibleCharactersProcessor) GetSubCommentText ¶
func (_ *InvisibleCharactersProcessor) GetSubCommentText() string
GetSubCommentText returns the sub comment text for invisible characters
type MixedScriptInfo ¶
MixedScriptInfo contains information about a word that mixes multiple scripts
type MixedScriptsProcessor ¶
type MixedScriptsProcessor struct {
// contains filtered or unexported fields
}
MixedScriptsProcessor is a processor for the mixed scripts rule type
func (*MixedScriptsProcessor) FindMixedScripts ¶
func (mse *MixedScriptsProcessor) FindMixedScripts(line string) []*Violation
FindMixedScripts returns a slice of MixedScriptInfo for words in the input string that mix multiple scripts, ignoring common characters, detecting potential obfuscation in text. Words with only common script characters are not flagged. E.g. “B. C“ is not considered mixed-scripts by default: it contains characters from Latin and Common, but Common is excluded by default.
func (*MixedScriptsProcessor) FindViolations ¶
func (mse *MixedScriptsProcessor) FindViolations(line string) []*Violation
FindViolations finds mixed scripts in the given line
func (*MixedScriptsProcessor) GetFailedReviewText ¶
func (_ *MixedScriptsProcessor) GetFailedReviewText() string
GetFailedReviewText returns the failed review text for mixed scripts
func (*MixedScriptsProcessor) GetLineCommentText ¶
func (_ *MixedScriptsProcessor) GetLineCommentText(violation *Violation) string
GetLineCommentText returns the line comment text for mixed scripts
func (*MixedScriptsProcessor) GetPassedReviewText ¶
func (_ *MixedScriptsProcessor) GetPassedReviewText() string
GetPassedReviewText returns the passed review text for mixed scripts
func (*MixedScriptsProcessor) GetSubCommentText ¶
func (_ *MixedScriptsProcessor) GetSubCommentText() string
GetSubCommentText returns the sub comment text for mixed scripts
type Violation ¶
type Violation struct { // InvisibleChar an invisible character found in a line. InvisibleChar rune // mixedScript is a mixed script found in a line. MixedScript *MixedScriptInfo }
Violation contains the result of a homoglyph violation