Showing 13 of 244 total issues
File HTML.swift
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Confirmed
Confirmed
import Foundation
import OrchardNestKit
import Plot
import Vapor
- Create a ticketCreate a ticket
Function li
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static func li(forEntryItem item: EntryItem, formatDateWith formatter: DateFormatter) -> Self {
return
.li(
.class("blog-post"),
.id("entry-\(item.id.base32Encoded)"),
- Create a ticketCreate a ticket
Function playerForPodcast
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static func playerForPodcast(withAppleId appleId: Int) -> Self {
.ul(
.class("podcast-players"),
.li(
.a(
- Create a ticketCreate a ticket
Function configure
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
public func configure(_ app: Application) throws {
let html = HTMLController(markdownDirectory: app.directory.viewsDirectory)
app.middleware = .init()
app.middleware.use(ErrorPageMiddleware(htmlController: html))
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
- Create a ticketCreate a ticket
Function header
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
static func header() -> Self {
.header(
.class("container"),
.nav(
.class("row"),
- Create a ticketCreate a ticket
Function respond
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response> {
next.respond(to: request).flatMapAlways { result in
let code: UInt
let viewName: String
let html: HTML
- Create a ticketCreate a ticket
Function head
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
static func head(withSubtitle subtitle: String, andDescription description: String) -> Self {
return
.head(
.title("OrchardNest - \(subtitle)"),
.meta(.charset(.utf8)),
- Create a ticketCreate a ticket
Function footer
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static func footer() -> Self {
return footer(
.class("container"),
.div(
.class("row"),
- Create a ticketCreate a ticket
Function respond
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response> {
next.respond(to: request).flatMapAlways { result in
let code: UInt
let viewName: String
let html: HTML
- Read upRead up
- Create a ticketCreate a ticket
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
Function from
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Confirmed
categorySlug: String,
languageCode: String,
channel: FeedChannel,
langMap: [String: Language],
catMap: [String: Category]
- Create a ticketCreate a ticket
Function parseSite
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Confirmed
Confirmed
static func parseSite(_ site: OrganizedSite, using client: Client, on eventLoop: EventLoop) -> EventLoopFuture<Result<FeedChannel, FeedError>> {
return client.get(URI(string: site.site.feed_url.absoluteString)).map { (response) -> Data? in
response.body.map { buffer in
Data(buffer: buffer)
}
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this function. Open
Open
return eventLoop.future(newResult)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return .success(channel)
- Create a ticketCreate a ticket