Showing 25 of 231 total issues
File DefuncError.scala
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2020 Parsley Contributors <https://github.com/j-mie6/Parsley/graphs/contributors>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Function _number
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Confirmed
override lazy val _number: Parsley[BigDecimal] = {
if (desc.decimalRealsOnly) decimal
else {
def addHex(p: Parsley[BigDecimal]) = {
if (desc.realNumbersCanBeHexadecimal) noZeroHexadecimal <|> p
- Read upRead up
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 _number
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Confirmed
protected [numeric] override lazy val _number: Parsley[BigInt] = {
if (desc.decimalIntegersOnly) decimal
else {
def addHex(p: Parsley[BigInt]) = {
if (desc.integerNumbersCanBeHexadecimal) noZeroHexadecimal <|> p
- Read upRead up
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
File IntrinsicInstrs.scala
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2020 Parsley Contributors <https://github.com/j-mie6/Parsley/graphs/contributors>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Function singlesAndMultis
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
@tailrec final def singlesAndMultis(ctx: Context): Unit = {
spaces(ctx)
if (ctx.moreInput && ctx.input.startsWith(sharedPrefix, ctx.offset)) {
val startsMulti = ctx.input.startsWith(factoredStart, ctx.offset + sharedPrefix.length)
if (startsMulti && multiLineComment(ctx)) singlesAndMultis(ctx)
- Read upRead up
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 ofRadix
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
private def ofRadix(radix: Int, digit: Parsley[Char], leadingDotAllowed: Boolean, endLabel: LabelConfig): Parsley[BigDecimal] = {
lazy val leadingHappened = Ref.make[Boolean]
lazy val _noDoubleDroppedZero = err.preventRealDoubleDroppedZero(leadingHappened.get)
val expDesc = desc.exponentDescForRadix(radix)
val whole = radix match {
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private def render(selfTimes: Map[String, Long], invocations: Map[String, Int]): Unit = {
val combined = selfTimes.map {
case (name, selfTime) =>
val invokes = invocations(name)
(name, (f"${selfTime/1000.0}%.1fμs", invocations(name), f"${selfTime/invokes/1000.0}%.3fμs"))
Function process
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private [parsley] def process: (Map[String, Long], Map[String, Int]) = {
val allEntries = collapse(entries).sortBy(_._2)
val allExits = collapse(exits).sortBy(_._2)
require((allEntries ::: allExits).toSet.size == (allExits.length + allExits.length),
Method foldTablified
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
@tailrec private def foldTablified(tablified: List[(StrictParsley[_], (Char, Iterable[ExpectItem], Int, Boolean))], // scalastyle:ignore parameter.number
labelGen: CodeGenState,
roots: mutable.Map[Char, mutable.ListBuffer[StrictParsley[_]]],
backtracking: mutable.Map[Char, Boolean],
leads: mutable.ListBuffer[Char],
Function readSpecific
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
final private def readSpecific(ctx: Context, j: Int): Unit = {
if (j < strsz) {
val c = specific.codePointAt(j)
if (Character.isSupplementaryCodePoint(c) && ctx.moreInput(2) && readCharCaseHandledSupplementary(ctx) == c) {
ctx.fastConsumeSupplementaryChar()
- Read upRead up
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 process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Confirmed
private [parsley] def process: (Map[String, Long], Map[String, Int]) = {
val allEntries = collapse(entries).sortBy(_._2)
val allExits = collapse(exits).sortBy(_._2)
require((allEntries ::: allExits).toSet.size == (allExits.length + allExits.length),
- Read upRead up
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 merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private [machine] final override def merge(err: DefuncError): DefuncError = {
val cmp = Integer.compareUnsigned(this.underlyingOffset, err.underlyingOffset)
if (cmp > 0) this
else if (cmp < 0) err
else {
- Read upRead up
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 merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private [machine] final override def merge(err: DefuncError): DefuncError = {
val cmp = Integer.compareUnsigned(this.underlyingOffset, err.underlyingOffset)
if (cmp > 0) this
else if (cmp < 0) err
else {
- Read upRead up
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
Constructor has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
inp: Input,
fof: Offset,
tof: Offset,
fps: Pos,
tps: Pos,
Method copy
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
inp: Input = rawInput,
fof: Offset = fromOffset,
tof: Offset = toOffset,
fps: Pos = fromPos,
tps: Pos = toPos,
Constructor has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
var name: String = "",
var internal: String = "",
fullInput: String,
var parse: Option[ParseAttempt] = None,
var cNumber: Option[Long] = None,
Function singlesOnly
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@tailrec private final def singlesOnly(ctx: Context): Unit = {
spaces(ctx)
if (ctx.moreInput) {
val startsSingle = ctx.input.startsWith(line, ctx.offset)
if (startsSingle && singleLineComment(ctx)) singlesOnly(ctx)
- Read upRead up
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 wellNested
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@tailrec private final def wellNested(ctx: Context, unmatched: Int): Boolean = {
if (unmatched == 0) true
else if (ctx.input.startsWith(end, ctx.offset)) {
ctx.fastUncheckedConsumeChars(end.length)
wellNested(ctx, unmatched - 1)
- Read upRead up
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
Method junct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private def junct(init: List[String], last: String, delim: String, junction: String, oxfordComma: Boolean): String = {
Constructor has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private [parsley] final class CalleeSave(var label: Int, localRegs: Set[Ref[_]] @nowarn3, reqSize: Int, slots: List[(Int, Int)], saveArray: Array[AnyRef])