xrefcheck-0.3.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Xrefcheck.Core

Description

Various primitives.

Synopsis

Documentation

data Flavor Source #

Markdown flavor.

Unfortunatelly, CMark renderers used on different sites slightly differ, we have to account for that.

Constructors

GitHub 
GitLab 

Instances

Instances details
FromJSON Flavor Source # 
Instance details

Defined in Xrefcheck.Core

Bounded Flavor Source # 
Instance details

Defined in Xrefcheck.Core

Enum Flavor Source # 
Instance details

Defined in Xrefcheck.Core

Show Flavor Source # 
Instance details

Defined in Xrefcheck.Core

caseInsensitiveAnchors :: Flavor -> Bool Source #

Whether anchors are case-sensitive for a given Markdown flavour or not.

newtype Position Source #

Description of element position in source file. We keep this in text because scanners for different formats use different representation of this thing, and it actually appears in reports only.

Constructors

Position Text 

Instances

Instances details
Generic Position Source # 
Instance details

Defined in Xrefcheck.Core

Associated Types

type Rep Position :: Type -> Type #

Methods

from :: Position -> Rep Position x #

to :: Rep Position x -> Position #

Show Position Source # 
Instance details

Defined in Xrefcheck.Core

NFData Position Source # 
Instance details

Defined in Xrefcheck.Core

Methods

rnf :: Position -> () #

Buildable Position Source # 
Instance details

Defined in Xrefcheck.Core

Methods

build :: Position -> Builder #

Eq Position Source # 
Instance details

Defined in Xrefcheck.Core

type Rep Position Source # 
Instance details

Defined in Xrefcheck.Core

type Rep Position = D1 ('MetaData "Position" "Xrefcheck.Core" "xrefcheck-0.3.0-GeqFdwqv2mJ31qwgW3PUq5" 'True) (C1 ('MetaCons "Position" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Reference Source #

Full info about a reference.

Constructors

Reference 

Fields

Instances

Instances details
Generic Reference Source # 
Instance details

Defined in Xrefcheck.Core

Associated Types

type Rep Reference :: Type -> Type #

Show Reference Source # 
Instance details

Defined in Xrefcheck.Core

NFData Reference Source # 
Instance details

Defined in Xrefcheck.Core

Methods

rnf :: Reference -> () #

Given ColorMode => Buildable Reference Source # 
Instance details

Defined in Xrefcheck.Core

Methods

build :: Reference -> Builder #

type Rep Reference Source # 
Instance details

Defined in Xrefcheck.Core

type Rep Reference = D1 ('MetaData "Reference" "Xrefcheck.Core" "xrefcheck-0.3.0-GeqFdwqv2mJ31qwgW3PUq5" 'False) (C1 ('MetaCons "Reference" 'PrefixI 'True) (S1 ('MetaSel ('Just "rName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "rPos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: S1 ('MetaSel ('Just "rInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ReferenceInfo))))

data ReferenceInfo Source #

Info about the reference.

Instances

Instances details
Generic ReferenceInfo Source # 
Instance details

Defined in Xrefcheck.Core

Associated Types

type Rep ReferenceInfo :: Type -> Type #

Show ReferenceInfo Source # 
Instance details

Defined in Xrefcheck.Core

NFData ReferenceInfo Source # 
Instance details

Defined in Xrefcheck.Core

Methods

rnf :: ReferenceInfo -> () #

type Rep ReferenceInfo Source # 
Instance details

Defined in Xrefcheck.Core

type Rep ReferenceInfo = D1 ('MetaData "ReferenceInfo" "Xrefcheck.Core" "xrefcheck-0.3.0-GeqFdwqv2mJ31qwgW3PUq5" 'False) (C1 ('MetaCons "RIExternal" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ExternalLink)) :+: C1 ('MetaCons "RIFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ReferenceInfoFile)))

data ReferenceInfoFile Source #

Constructors

ReferenceInfoFile 

Fields

Instances

Instances details
Generic ReferenceInfoFile Source # 
Instance details

Defined in Xrefcheck.Core

Associated Types

type Rep ReferenceInfoFile :: Type -> Type #

Show ReferenceInfoFile Source # 
Instance details

Defined in Xrefcheck.Core

NFData ReferenceInfoFile Source # 
Instance details

Defined in Xrefcheck.Core

Methods

rnf :: ReferenceInfoFile -> () #

type Rep ReferenceInfoFile Source # 
Instance details

Defined in Xrefcheck.Core

type Rep ReferenceInfoFile = D1 ('MetaData "ReferenceInfoFile" "Xrefcheck.Core" "xrefcheck-0.3.0-GeqFdwqv2mJ31qwgW3PUq5" 'False) (C1 ('MetaCons "ReferenceInfoFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "rifAnchor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "rifLink") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FileLink)))

data ExternalLink Source #

Constructors

ELUrl Text

Reference to a file at outer site, e.g d.

ELOther Text

Entry not to be processed, e.g. mailto:e-mail.

Instances

data FileLink Source #

Constructors

FLAbsolute RelPosixLink

Reference to a file or directory relative to the repository root.

FLRelative RelPosixLink

Reference to a file or directory relative to the given one.

FLLocal

Reference to this file.

Instances

pattern PathSep :: Char Source #

referenceInfo :: Text -> ReferenceInfo Source #

Compute the ReferenceInfo corresponding to a given link.

data AnchorType Source #

Context of anchor.

Constructors

HeaderAnchor Int

Every section header is usually an anchor

HandAnchor

They can be set up manually

BiblioAnchor

Id of entry in bibliography

Instances

Instances details
Generic AnchorType Source # 
Instance details

Defined in Xrefcheck.Core

Associated Types

type Rep AnchorType :: Type -> Type #

Show AnchorType Source # 
Instance details

Defined in Xrefcheck.Core

NFData AnchorType Source # 
Instance details

Defined in Xrefcheck.Core

Methods

rnf :: AnchorType -> () #

Given ColorMode => Buildable AnchorType Source # 
Instance details

Defined in Xrefcheck.Core

Methods

build :: AnchorType -> Builder #

Eq AnchorType Source # 
Instance details

Defined in Xrefcheck.Core

type Rep AnchorType Source # 
Instance details

Defined in Xrefcheck.Core

type Rep AnchorType = D1 ('MetaData "AnchorType" "Xrefcheck.Core" "xrefcheck-0.3.0-GeqFdwqv2mJ31qwgW3PUq5" 'False) (C1 ('MetaCons "HeaderAnchor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: (C1 ('MetaCons "HandAnchor" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BiblioAnchor" 'PrefixI 'False) (U1 :: Type -> Type)))

data Anchor Source #

A referable anchor.

Constructors

Anchor 

Fields

Instances

Instances details
Generic Anchor Source # 
Instance details

Defined in Xrefcheck.Core

Associated Types

type Rep Anchor :: Type -> Type #

Methods

from :: Anchor -> Rep Anchor x #

to :: Rep Anchor x -> Anchor #

Show Anchor Source # 
Instance details

Defined in Xrefcheck.Core

NFData Anchor Source # 
Instance details

Defined in Xrefcheck.Core

Methods

rnf :: Anchor -> () #

Given ColorMode => Buildable Anchor Source # 
Instance details

Defined in Xrefcheck.Core

Methods

build :: Anchor -> Builder #

Eq Anchor Source # 
Instance details

Defined in Xrefcheck.Core

Methods

(==) :: Anchor -> Anchor -> Bool #

(/=) :: Anchor -> Anchor -> Bool #

type Rep Anchor Source # 
Instance details

Defined in Xrefcheck.Core

type Rep Anchor = D1 ('MetaData "Anchor" "Xrefcheck.Core" "xrefcheck-0.3.0-GeqFdwqv2mJ31qwgW3PUq5" 'False) (C1 ('MetaCons "Anchor" 'PrefixI 'True) (S1 ('MetaSel ('Just "aType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AnchorType) :*: (S1 ('MetaSel ('Just "aName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "aPos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position))))

data FileInfo Source #

All information regarding a single file we care about.

Constructors

FileInfo 

Instances

Instances details
Generic FileInfo Source # 
Instance details

Defined in Xrefcheck.Core

Associated Types

type Rep FileInfo :: Type -> Type #

Methods

from :: FileInfo -> Rep FileInfo x #

to :: Rep FileInfo x -> FileInfo #

Show FileInfo Source # 
Instance details

Defined in Xrefcheck.Core

NFData FileInfo Source # 
Instance details

Defined in Xrefcheck.Core

Methods

rnf :: FileInfo -> () #

Given ColorMode => Buildable FileInfo Source # 
Instance details

Defined in Xrefcheck.Core

Methods

build :: FileInfo -> Builder #

type Rep FileInfo Source # 
Instance details

Defined in Xrefcheck.Core

type Rep FileInfo = D1 ('MetaData "FileInfo" "Xrefcheck.Core" "xrefcheck-0.3.0-GeqFdwqv2mJ31qwgW3PUq5" 'False) (C1 ('MetaCons "FileInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "_fiReferences") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Reference]) :*: S1 ('MetaSel ('Just "_fiAnchors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Anchor])))

data ScanPolicy Source #

Constructors

OnlyTracked

Scan and treat as existing only files tracked by Git. Warn when there are scannable files not added to Git yet.

IncludeUntracked

Also scan and treat as existing files that were neither tracked nor ignored by Git.

Instances

Instances details
Show ScanPolicy Source # 
Instance details

Defined in Xrefcheck.Core

Eq ScanPolicy Source # 
Instance details

Defined in Xrefcheck.Core

data FileStatus Source #

Constructors

Scanned FileInfo 
NotScannable

Files that are not supported by our scanners.

NotAddedToGit

We are not scanning files that are not added to git unless --include-untracked CLI option was enabled, but we're gathering information about them to improve reports.

Instances

Instances details
Show FileStatus Source # 
Instance details

Defined in Xrefcheck.Core

data DirectoryStatus Source #

Instances

Instances details
Show DirectoryStatus Source # 
Instance details

Defined in Xrefcheck.Core

data RepoInfo Source #

All tracked files and directories.

Constructors

RepoInfo 

Fields

Instances

Instances details
Given ColorMode => Buildable RepoInfo Source # 
Instance details

Defined in Xrefcheck.Core

Methods

build :: RepoInfo -> Builder #

data VerifyMode Source #

Which parts of verification do we perform.

headerToAnchor :: Flavor -> Text -> Text Source #

Convert section header name to an anchor refering it. Conversion rules: https://docs.gitlab.com/ee/user/markdown.html#header-ids-and-links

stripAnchorDupNo :: Text -> Maybe Text Source #

When there are several anchors with the same name, github automatically attaches "-number" suffixes to duplications to make them referable unambiguously. For instance, if there are two headers called "description", they would gain "description" and "description-1" anchors correspondingly.

This function strips this suffix and returns the original anchor in case when suffix is present.

data VerifyProgress Source #

Constructors

VerifyProgress 

Fields

Instances

Instances details
Show VerifyProgress Source # 
Instance details

Defined in Xrefcheck.Core