File package-version-parser.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
var inTool = typeof Package === "undefined";
// Provided by dev_bundle/server-lib/node_modules/semver.
var semver = inTool
? module.parent.require("semver")
Function PV
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PV = function (versionString) {
if (! (typeof versionString === 'string')) {
throw new Error("Invalid PackageVersion argument: " + versionString);
}
if (! versionString) {
Function PV
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
var PV = function (versionString) {
if (! (typeof versionString === 'string')) {
throw new Error("Invalid PackageVersion argument: " + versionString);
}
if (! versionString) {
- 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 validatePackageName
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
PV.validatePackageName = function (packageName, options) {
options = options || {};
var badChar = packageName.match(/[^a-z0-9:.\-]/);
if (badChar) {
Function PackageConstraint
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
PV.PackageConstraint = function (part1, part2) {
if ((typeof part1 !== "string") ||
(part2 && (typeof part2 !== "string") &&
! (part2 instanceof PV.VersionConstraint))) {
throw new Error("constraintString must be a string");
- 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 PackageConstraint
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
PV.PackageConstraint = function (part1, part2) {
if ((typeof part1 !== "string") ||
(part2 && (typeof part2 !== "string") &&
! (part2 instanceof PV.VersionConstraint))) {
throw new Error("constraintString must be a string");
Function prereleaseIdentifierToFraction
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
var prereleaseIdentifierToFraction = function (prerelease) {
if (prerelease.length === 0)
return 0;
return prerelease.reduce(function (memo, part, index) {
- 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 validatePackageName
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
PV.validatePackageName = function (packageName, options) {
options = options || {};
var badChar = packageName.match(/[^a-z0-9:.\-]/);
if (badChar) {
- 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 parseSimpleConstraint
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseSimpleConstraint(constraintString) {
if (! constraintString) {
throw new Error("Non-empty string required");
}
Function compare
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
PV.compare = function (versionOne, versionTwo) {
var v1 = versionOne;
if (typeof v1 === 'string') {
v1 = PV.parse(v1);
}
- 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 parseSimpleConstraint
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function parseSimpleConstraint(constraintString) {
if (! constraintString) {
throw new Error("Non-empty string required");
}
- 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"