brightdigit/ContributeWordPress

View on GitHub

Showing 5 of 9 total issues

Function beginImport has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    from exportsDirectoryURL: URL,
    to rootPublishSiteURL: URL,
    filteringPostsWith postFilters: [PostFilter] = .default,
    redirectsFormattedUsing redirectFromatter: RedirectFormatter? = nil,
    importAssetsBy assetImportSetting: AssetImportSetting = .download,
Severity: Major
Found in Sources/ContributeWordPress/Processing/MarkdownProcessor+Starter.swift - About 50 mins to fix

    Function beginImport has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        from exportsDirectoryURL: URL,
        to rootPublishSiteURL: URL,
        usingGenerator markdownGenerator: MarkdownGenerator =
          PassthroughMarkdownGenerator.shared,
        filteringPostsWith postFilters: [PostFilter] = .default,
    Severity: Major
    Found in Sources/ContributeWordPress/Processing/MarkdownProcessor+Starter.swift - About 50 mins to fix

      Function writeSite has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          _ site: WordPressSite,
          sectionName: String,
          importing assets: [AssetImport],
          to contentDirectoryURL: URL,
          transformFromHTML: @escaping (String) throws -> String,
      Severity: Minor
      Found in Sources/ContributeWordPress/Processing/MarkdownProcessor.swift - About 45 mins to fix

        Function writeAllPosts has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            fromSites sites: [SectionName: WordPressSite],
            withAssets assets: [AssetImport],
            inContentDirectory contentDirectoryURL: URL,
            using htmlToMarkdown: @escaping (String) throws -> String,
            htmlFromSitePost: ((WordPressSite) -> ((WordPressPost) -> String))? = nil
        Severity: Minor
        Found in Sources/ContributeWordPress/Processing/MarkdownProcessor.swift - About 35 mins to fix

          Function matchUrls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            private static func matchUrls(
              in posts: [WordPressPost],
              using regex: NSRegularExpression
            ) -> [(sourceURL: URL, post: WordPressPost)] {
              posts
          Severity: Minor
          Found in Sources/ContributeWordPress/Images/AssetImport+WordPress.swift - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language